Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp16295284rwd; Mon, 26 Jun 2023 08:10:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6UTiUtd+Zv3G1bWv7y64zDim1M3cRAR2kF8TfA7C4p51dWKKfVVp/62uPh26d2Dun8sta1 X-Received: by 2002:a05:6a20:938a:b0:11f:6391:3add with SMTP id x10-20020a056a20938a00b0011f63913addmr20283876pzh.15.1687792245338; Mon, 26 Jun 2023 08:10:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687792245; cv=none; d=google.com; s=arc-20160816; b=0XN52CTAy0icx8wSvwLNpr44joMlRYDOSTUbZCf4BykdgYOEGJ99BPKkbUS5sgPmei wS/cEmEpj4knTi3JwOUeIla1AuOcjxWi3Rhhdd1KU9I0JjMI0KdHnW4r6H8pHoIUyb3u FqalKYD32SGlFq7yD9mx/5ZiBeUWXVTPkFv7Bnk8x7wpYBN0L+bOYDK9J51y8OC3yMb2 RWmmZdZeW0jL0dpqxH89sqkH7i/EpMU0C0L8Z5Ydd5o+87doQ1n59dWAVyPCsxadlBDo l/sfv35NAl7TtK6ZysWnN4MlIqiAtpNb0xpn0aCVT9kOG2J1gvpgvVfMKAftG7zO+3Tm TBKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=DSA9QoK+yBKdcbvG4YrF4B4JqQ0v0hjiiD1glEvBsTQ=; fh=5/HSiIQDlYvfJbnU4qisB7KgvHQM7jfDIpoNN//9/Hs=; b=JSxJ0LUHnOhU7mwiVnTzzB0a5qa2/qqfM1Qi77dVmZu664nwtOvLkpNuV6pNjuPVDz QYsu0hrZAtVZmI46anoF/6CuvnnFPWSl3OpUHG9LT/EYP0nqGthNRLnrYD1Ewae9DCEb lHaDSkT4p0ojmgRKERHIw5dxIB1RoXzNt+ROte5ZBUblEqQIP8bsWjfbRJIeNRwe56Ui UgW0hVmICLLiJ9K3iE6UqzKrmP7UyCN9d0SoO14eXTFGAaxJ694lEJJaUGFYaCF4Z4ND 9sQjYv9A2G+vDkR4T31bv+fL8edtCmACsE1cwCoLAFssZqwiDQZxnCLWAEsrXlDorEXl iK1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="CNZ/WZPR"; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t4-20020a62ea04000000b00668871bc9b1si4700309pfh.210.2023.06.26.08.10.32; Mon, 26 Jun 2023 08:10:45 -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=@linuxfoundation.org header.s=korg header.b="CNZ/WZPR"; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229750AbjFZOnq (ORCPT + 99 others); Mon, 26 Jun 2023 10:43:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229601AbjFZOnk (ORCPT ); Mon, 26 Jun 2023 10:43:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5149FE7E; Mon, 26 Jun 2023 07:43:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C619760C34; Mon, 26 Jun 2023 14:43:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF16DC433C8; Mon, 26 Jun 2023 14:43:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1687790618; bh=SdT5dYqk63aXHMWbRS0vGySaZDKAUnxuNnhGJkSrdRU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CNZ/WZPR3/AThVgJYgL+P+vh7mL1idZHkrilcVKqSlAXPEMwVDJQ8WOYpRIzcl0Ez 7Hv2KnxATg+ts7PvYUrBs4dm0XHQo8VjbCnx8xi0pDz2/H3r1h0lplfaxc3DFDiZA5 SrrJJMK2B6VbiVFrbH0hfyfSPJCs2iYa/LEmKoIk= Date: Mon, 26 Jun 2023 16:43:35 +0200 From: Greg Kroah-Hartman To: Neil Armstrong Cc: Heikki Krogerus , Krzysztof Kozlowski , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: Re: [PATCH 1/3] usb: typec: ucsi: call typec_set_mode on non-altmode partner change Message-ID: <2023062628-pleading-hedging-2ceb@gregkh> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Mon, Jun 26, 2023 at 03:23:11PM +0200, Neil Armstrong wrote: > 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 Yes please.