From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7DD0EB64DC for ; Mon, 26 Jun 2023 13:23:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229939AbjFZNXR (ORCPT ); Mon, 26 Jun 2023 09:23:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229623AbjFZNXQ (ORCPT ); Mon, 26 Jun 2023 09:23:16 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92FC61AC for ; Mon, 26 Jun 2023 06:23:14 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-4fb7589b187so1300267e87.1 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=LWLLDkrneK05jd7VcZMLn/5/0sIW22MEFdNNC5I8Xm59AfXgI0EQiX9DX2Q3WYxBns +KqYXB9VVTGCwxetIVh2ZRr3hdnMTQ4Lz2F1VVtaBAv8VmUWr0ZsDiB/faTPpiZ4vE7t voOW67muwODElQrsDiLPlIJZWV8UQQJBjMzvknF9y/z5bJzmE/8SqeZNxFperYY21Rhu u7Q6U15xJa9ohan7ua+lpkIZQ/zlknHA8MdOPbbFvue13+HF4YUNZfuV1fo7EZzT9uZB Utv/y1F62KQ2nJk42N67uhAG2bjIfIDUk3B8YmbPyDx92uYHQmmAl8Wt0NClsFHEjWGU v2PA== X-Gm-Message-State: AC+VfDyhDW5izFnbAP3xYDxgBByB0Sa+iQqpeo3nb67WOF8kDb8UKmkT J2wKVPMe89GLXsGyTbE0Cb4goQ== X-Google-Smtp-Source: ACHHUZ6ThfhatPMJ0vxDsoclNGj83u9LNnGVVi4gVS3IPbj6ktLOHHmeDqsmxik2zI19UoDqnGGvWg== 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 Precedence: bulk List-ID: X-Mailing-List: linux-usb@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, >