Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp785970rwb; Thu, 19 Jan 2023 02:40:22 -0800 (PST) X-Google-Smtp-Source: AMrXdXtarjVXEC8/ozi9XxkeN9SoA2tr0VS5K7eMVGB29fqlM6Jj2Hc+PvrljBgo4KdWOA2pyKPS X-Received: by 2002:a17:90a:160f:b0:228:5b99:3b45 with SMTP id n15-20020a17090a160f00b002285b993b45mr11456205pja.7.1674124821998; Thu, 19 Jan 2023 02:40:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674124821; cv=none; d=google.com; s=arc-20160816; b=i6xzMQSZhjWS0LcwyCokjup2AjISr+rhFxgDTWXrGHEFz8BDk4WYEWHK8La5KhZFhk vwXyzbMPq7SvEXXT/pDrxBC0oTMqft6hhgXGuSrIDk7e8YtZLS+8FMeGaWxX+T2o8zD3 eSIq5KVA16tYHEnGxdfuiNDL6OyCxF1a4xBZzUSzDsjadjIgEEbkDcCZCEu92HeTv+mm B9IG6QaSuU+i3n12FAtgkgKaapmtWDLpcb5QW5YfrpsKzX8B+qvHubuXq/LnW4ox9ZbN 9sHtmhRhjSg316OS+8Z0dHn3aKmzZfVx1aqPT4LQ7AvKnrUoHaLXpRc9Fa2yu7+C+fZw KveA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=gUMk1/bi5g5h2y9BS6a518UMzb1yi0+ArEb6kSFCYTA=; b=OBAlsQsC+IfJcG2TvxadIrFtoALpXc9oICKi9JDsjMOKZG/TQqfh26yOeHmudSKtgq 9j5BqQ8KvKd5EiiJQvon0QYlpE6avE0R8m1cO4me5O2pVRU03oyBNV8Y0Ts6H6HuzMzw c8OEOwwwcclNBFDs/N7zZBPcGDFKtDczH+1mRrT/Z3pvrlUzHwByuPd8egLdtknv5nGe YOW63Nivf93vNl4v2UB/gZYLOC0ivtfGQPeZOGgYgrhZnhAYbNhrTU6uTDn7NQXLRMC5 /sv5p5OuBlnfC9sOn0sU25Gu2GRYFyOfNFXftvI3tU1cyPJYkKnUCRPdiACnEB9wh01a BFIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hxk7z6po; 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=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h190-20020a6383c7000000b00498fda6b663si8641282pge.36.2023.01.19.02.40.16; Thu, 19 Jan 2023 02:40:21 -0800 (PST) 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=@chromium.org header.s=google header.b=hxk7z6po; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230162AbjASJz7 (ORCPT + 46 others); Thu, 19 Jan 2023 04:55:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229699AbjASJzz (ORCPT ); Thu, 19 Jan 2023 04:55:55 -0500 Received: from mail-yb1-xb32.google.com (mail-yb1-xb32.google.com [IPv6:2607:f8b0:4864:20::b32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71DF35D7F8 for ; Thu, 19 Jan 2023 01:55:53 -0800 (PST) Received: by mail-yb1-xb32.google.com with SMTP id 69so1831934ybn.2 for ; Thu, 19 Jan 2023 01:55:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=gUMk1/bi5g5h2y9BS6a518UMzb1yi0+ArEb6kSFCYTA=; b=hxk7z6pogAGXNsbFa2NUorj+q891Jf2Kx66+E9euuWPJgOu31CzAc9Sguknk6DcRrc k6BfM7NV2ImBfVJBNSMtKxArPi69QhV4lZCgVkwgXRlylXxAREtRNfatWdnETIvDn0DN BET2w4ie5jTYs8hkxvuTye8meojQ9lV3CRf6s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gUMk1/bi5g5h2y9BS6a518UMzb1yi0+ArEb6kSFCYTA=; b=fr4OS9l5/RBgZFb5uiTNEJeJ8TcWt9M6NJQjjPy1G9VVZhwADCF/fe/eYjv0cGo/SX JPJkViXyM32ZpcBapf1a4cjyKDJkV0pgX7gVmmTjkWq95w4JuypgAERTooPDJDLq5C1H 4hfhpLWWdrHB+JpbhjSltbh1kHX1xr+79XcPsYzS5Y/7PcvcaGTv/QSA7cGzWnyCVzhI TcBt6nQFGhppvfFtqxOlHg4dqvJv3/E5sCidfjzMZdVHfeAPqCTFbXjw2mQYJ6OrSCo4 4DuS8oOB0LAJnDb52tLTk0IJvtDn4eJnCtq1JPfZhRdYMcB2+noFGVyQ9k0EDoNjJE5G UuVg== X-Gm-Message-State: AFqh2koF2UNRseSVri5nWfS4UKnmaoEdckdVi/ze7jmnIFshzi39av2J 2Ml8Dmguf/TfBegmmb/suH5ZXf2UwmNhSmT1FG25VdUlDKGn8A== X-Received: by 2002:a5b:384:0:b0:7d2:ea96:9038 with SMTP id k4-20020a5b0384000000b007d2ea969038mr1011610ybp.56.1674122152439; Thu, 19 Jan 2023 01:55:52 -0800 (PST) MIME-Version: 1.0 References: <20230118031514.1278139-1-pmalani@chromium.org> In-Reply-To: From: Prashant Malani Date: Thu, 19 Jan 2023 01:55:41 -0800 Message-ID: Subject: Re: [PATCH] usb: typec: altmodes/displayport: Update active state To: Heikki Krogerus Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, bleung@chromium.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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 On Thu, Jan 19, 2023 at 1:26 AM Heikki Krogerus wrote: > > Hi Prashant, > > On Wed, Jan 18, 2023 at 10:26:21AM -0800, Prashant Malani wrote: > > Hi Heikki, > > > > Thanks for reviewing the patch. > > > > On Wed, Jan 18, 2023 at 1:39 AM Heikki Krogerus > > wrote: > > > > > > On Wed, Jan 18, 2023 at 03:15:15AM +0000, Prashant Malani wrote: > > FWIW, I think we can make the typec_altmode_update_active() calls from > > our (cros-ec-typec) port driver too, but displayport.c is parsing the header > > anyway, so it seemed repetitive. Just wanted to clarify the intention here. > > The alt modes may have been entered even if there are no drivers for > them, if for example the PD controller handles the mode entry. In > those cases the port driver needs to update the active state of the > partner alt mode. Ack. Thanks for explaining the rationale here. > > Since the port drivers have to handle that in some cases, for the sake > of consistency I thought that they might as well take care of it in > every case. > > On the other hand, it should be safe to do it in both the port driver > and the altmode driver. > > If you prefer that the altmode drivers always do this, I'm not against > it. But in that case could you patch tcpm.c while at it - in the same > series: Sure, I will send out a v2 with the below diff as Patch 2/2 (I will mark you as "Suggested-by" but as always LMK if you prefer another way to denote attribution). > > diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c > index 904c7b4ce2f0c..0f5a9d4db105a 100644 > --- a/drivers/usb/typec/tcpm/tcpm.c > +++ b/drivers/usb/typec/tcpm/tcpm.c > @@ -1693,14 +1693,11 @@ static int tcpm_pd_svdm(struct tcpm_port *port, struct typec_altmode *adev, > } > break; > case CMD_ENTER_MODE: > - if (adev && pdev) { > - typec_altmode_update_active(pdev, true); > + if (adev && pdev) > *adev_action = ADEV_QUEUE_VDM_SEND_EXIT_MODE_ON_FAIL; > - } > return 0; > case CMD_EXIT_MODE: > if (adev && pdev) { > - typec_altmode_update_active(pdev, false); > /* Back to USB Operation */ > *adev_action = ADEV_NOTIFY_USB_AND_QUEUE_VDM; > return 0; > > That's the only driver that will definitely always requires the > altmode drivers, so perhaps it would be good to drop the calls > from it at the same time. > > thanks, > > -- > heikki