Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp16183679rwd; Mon, 26 Jun 2023 06:54:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5BWy3H5F4p9mY1WpYFIecWcKUSoAN1oJcI2RbGVV84Dw6tM6oDW+Ih2PboRk/Z6ndRUjjG X-Received: by 2002:a17:907:1612:b0:98d:cd3e:c193 with SMTP id hb18-20020a170907161200b0098dcd3ec193mr6784488ejc.46.1687787673878; Mon, 26 Jun 2023 06:54:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687787673; cv=none; d=google.com; s=arc-20160816; b=AKpWeSLug6UAH5benAW33r8Mj0STBVTlAvUTUsKhrP5IRWQNKeSD2vThCUMi/y5j6D fYwSu+lOW/x3Uj4AV9QSpdnUU+RGysUuj1RFajuH23+kM1S2d16pEEZMlpW21EpngjSd 0Sf+6EazY5ypC7SQwFpOF6nsI/g7xsU741WgjqBdxuMvHappKYXk7KFRXz5jgzIrvyHU QvXjdGEIY8gUsGV1Q5GLApqK1EmUxrA6QCpv7/2r5DzZcJe7j/Q0wjBiI3B6QFnI6z9K RpNrA8SNUPs9eRAFaB36+uFA+t3HxssLF5WX9sL9R+QM/7FR+/CApZYFtNuNZ64qhi8E Ox/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:references:cc:to:content-language:subject:reply-to :from:user-agent:mime-version:date:message-id:dkim-signature; bh=FX52cR42UjsCJaM68RlRM+9U+7DEs1rV1cvkX/J08Rg=; fh=53kobGOiCQ13rMobjUZ5VSC10unEewoceINfQz1Q0jM=; b=oVIO0Q8DCrooLJQPg3NPPxOFhDX11fu9C8k1QHE4/w1H7LTW7pxsF37Oo9Tih/vlYR R1ZUepZdd7aK0fXfJQdjR1iSvPsw+FMQ8XgBdsSRO+f7l4/w8cwq4ODijPiWi4gci52w gP9fpitDHcRK5eswIh1rRABJ7aBzP8s13LnxZC+I9jl4DxK6AbOHtYDl2cyJcM6IrR0N Pmkg/S9EglLkgzDk5EBJpRWFwQKRbdsbm63xcOFGEW15Z88SZwYbhMce0pEUZ0+Eoq81 8Y7g48Rx7RvDtBcmLcpWJoFKpt5y2UytMSMxO6eWng4FxZwc911bu8JanqwZ0veuloBm +9Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lW8CiMt8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xa10-20020a170907b9ca00b0098c61b9f6d9si2709079ejc.708.2023.06.26.06.54.08; Mon, 26 Jun 2023 06:54:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lW8CiMt8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229800AbjFZNXR (ORCPT + 99 others); Mon, 26 Jun 2023 09:23:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229766AbjFZNXQ (ORCPT ); Mon, 26 Jun 2023 09:23:16 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92E921AB for ; Mon, 26 Jun 2023 06:23:14 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-4fb7b2e3dacso701332e87.0 for ; Mon, 26 Jun 2023 06:23:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687785793; x=1690377793; h=content-transfer-encoding:in-reply-to:organization:references:cc:to :content-language:subject:reply-to:from:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=FX52cR42UjsCJaM68RlRM+9U+7DEs1rV1cvkX/J08Rg=; b=lW8CiMt8OoOEdsnfIH/829zvDo9LhMmt9uwOZByFaoqoTSTnFf1/9zLumViORWwvzL V+1Asd9cQXswC4xk+NAzUMZQiqZBw9xxPWy3dFScUSqc+GPfaknQ6QJ6JXSR3HfvTB7r HN5lwHmSOBD8R8bsl8QD4WwByW4BsSigr0/IG2ffOHmBvtFkZN8wB6MhvSvNijEi45PX tUZc7ttHb1GIHkWbV8u+yHJxW5Jtc8U2IXT5nmtMJegkI/KkUNVzlALNJNCORigIwAiU Yq2c/9LSoe4DsSThii8uc///p3NjJB77dk2bUVnPMvwxUP1EkFXAiYnBgWy2zsJykFV+ 5SpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687785793; x=1690377793; h=content-transfer-encoding:in-reply-to:organization:references:cc:to :content-language:subject:reply-to:from:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FX52cR42UjsCJaM68RlRM+9U+7DEs1rV1cvkX/J08Rg=; b=RJBlb6jjC20AIg5iIVddb+LijcOJcRksIlfrv6mNKd4lRwDgvTjftzu+My13sI8mmV egHusNp6NTnRY+CngLVmxhQ02K4/HFuYSFBz+dd5L+4tfGL+YbL54nEyEjqpKrhLY65U M6HsUVh5B5/k6+iS09aebNKzX1i657IDzq1VZl2BNwQd+7G3YR8+cLPOzRD6Lts+UeQ+ PLl7Cmc3KJ5Ske8tn2ImKEex1qL6BBKydrtc57j6vDYev1D/SqrHhq88oUGB5Hwh1V/h Z+o/VxouR27bk0PxlVAvsgzksnRUiKD2MCfhJ6T40/PWbcOF81lyDBFqB78Oj4YKuTlg c+WA== X-Gm-Message-State: AC+VfDz5ZsKx1gjX9E0l7M6Hq87cS7Iim+bip7D0O7Hvh8aGFVL5kwPe mOt2ISLuDIIzgK4lGrmm4xgqaQ== X-Received: by 2002:a19:ca02:0:b0:4f9:586b:dba1 with SMTP id a2-20020a19ca02000000b004f9586bdba1mr7763330lfg.4.1687785792656; Mon, 26 Jun 2023 06:23:12 -0700 (PDT) Received: from ?IPV6:2a01:e0a:982:cbb0:b25a:b26e:71f3:870c? ([2a01:e0a:982:cbb0:b25a:b26e:71f3:870c]) by smtp.gmail.com with ESMTPSA id h11-20020a1ccc0b000000b003fa8158135esm8427591wmb.11.2023.06.26.06.23.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 26 Jun 2023 06:23:12 -0700 (PDT) Message-ID: Date: Mon, 26 Jun 2023 15:23:11 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 From: Neil Armstrong Reply-To: neil.armstrong@linaro.org Subject: Re: [PATCH 1/3] usb: typec: ucsi: call typec_set_mode on non-altmode partner change Content-Language: en-US To: Heikki Krogerus Cc: Greg Kroah-Hartman , Krzysztof Kozlowski , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org References: <20230614-topic-sm8550-upstream-type-c-audio-v1-0-15a92565146b@linaro.org> <20230614-topic-sm8550-upstream-type-c-audio-v1-1-15a92565146b@linaro.org> Organization: Linaro Developer Services In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 26/06/2023 10:12, Heikki Krogerus wrote: > Hi Neil, > > Sorry to keep you waiting. No problem, thanks for reviewing my patches! > > On Wed, Jun 14, 2023 at 03:10:39PM +0200, Neil Armstrong wrote: >> Add support for calling typec_set_mode() for the DEBUG, AUDIO >> accessory modes. >> >> Let's also call typec_set_mode() for USB as default and SAFE >> when partner is disconnected. >> >> The USB state is only called when ALT mode is specifically >> not specified by the partner status flags in order >> to leave the altmode handlers setup the proper mode to >> switches, muxes and retimers. >> >> Signed-off-by: Neil Armstrong >> --- >> drivers/usb/typec/ucsi/ucsi.c | 17 +++++++++++++++++ >> 1 file changed, 17 insertions(+) >> >> diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c >> index 2b472ec01dc4..44f43cdea5c1 100644 >> --- a/drivers/usb/typec/ucsi/ucsi.c >> +++ b/drivers/usb/typec/ucsi/ucsi.c >> @@ -809,6 +809,23 @@ static void ucsi_partner_change(struct ucsi_connector *con) >> break; >> } >> >> + if (con->status.flags & UCSI_CONSTAT_CONNECTED) { >> + switch (UCSI_CONSTAT_PARTNER_TYPE(con->status.flags)) { >> + case UCSI_CONSTAT_PARTNER_TYPE_DEBUG: >> + typec_set_mode(con->port, TYPEC_MODE_DEBUG); >> + break; >> + case UCSI_CONSTAT_PARTNER_TYPE_AUDIO: >> + typec_set_mode(con->port, TYPEC_MODE_AUDIO); >> + break; >> + default: >> + if (UCSI_CONSTAT_PARTNER_FLAGS(con->status.flags) == >> + UCSI_CONSTAT_PARTNER_FLAG_USB) >> + typec_set_mode(con->port, TYPEC_STATE_USB); >> + } >> + } else { >> + typec_set_mode(con->port, TYPEC_STATE_SAFE); >> + } > > Can you do that (set safe mode) in ucsi_unregister_partner() instead? It seems greg already landed the patch into usb-next, but I can send a fix to move it to unregister Neil > > thanks, >