Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp799308rwb; Thu, 19 Jan 2023 02:54:50 -0800 (PST) X-Google-Smtp-Source: AMrXdXuoN2YDR5vhRsXkUA1O5eAbaXUx9Xd3U8qabtDIvapQX0R8fgEVYuK9zvEmLqJR89tEa8sj X-Received: by 2002:a17:902:efd4:b0:194:5ee5:3c44 with SMTP id ja20-20020a170902efd400b001945ee53c44mr29845480plb.17.1674125690506; Thu, 19 Jan 2023 02:54:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674125690; cv=none; d=google.com; s=arc-20160816; b=cMVHFwE6N2Ygjf/2+4jSNGYfAey6w67wR7tooPd6XZQ9nmAqR4Qv4IlQOIQfQppbwS 39/Cy0eH7ZQuvlF9OTSBDBk5rmUcjfIdjGRzSbRJEwoa3J8VvmFjv/UGDbs7M7u4X9yW mk1tiFmFcLTZiq9t06fug7e40SstIBrilov/eSJBAWHnGXhs9ubuDMQiCGxucncu9EO8 d5pR4YlOxDdndcxG1zqK+RcV5YKS/rnvNID1mj9maUN6S5ANsWE2g6rw7C9k34xwSL4K dLDasLE7b9DxVuF6BqZ1aWp6ijdABKfWIJJjV2+xw2VThS8FRsTGRsWGuRjqB0ngvvpY MdYw== 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=QXqwQrSwt+StZdyqV9+cOyJ8Y9ygdXIHln0bwVMaadk=; b=IQiIjmWXIV91KvzPz8ux7nShUWZTVTmW8G619gfdKoSPfL4p8Vw72D6rg3r8f111JB ETK6e77CpoRg4ViPsATDxEOROZ6K+cxkhS39kVRtkaVFReU/7yBpZGH/Rhg/WLi3DQs6 lVoO/wXOtoEPQ+LSoDOVLYFi7uw6GaaVcoynOSe8WHgR181Gr6YLo/iZa03rgx7cyamK SHJNSDuJhCQV4EuPVLGBhEtfKhzHVyermJ8YNDwnfBM4lVClojjtAeFoVQ2d8vCKScGa hXLaVn49bF0AGOKEqa7Kglr+0fvyiTGCQI4pJZ4JY7vC5M3m9jdQpRFLkUzmn9w1rowu weXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VbKLGzTU; 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 w185-20020a6382c2000000b004cee85bd6c1si9352694pgd.45.2023.01.19.02.54.45; Thu, 19 Jan 2023 02:54:50 -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=VbKLGzTU; 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 S230083AbjASKMm (ORCPT + 44 others); Thu, 19 Jan 2023 05:12:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229981AbjASKMf (ORCPT ); Thu, 19 Jan 2023 05:12:35 -0500 Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9278A1ABD9 for ; Thu, 19 Jan 2023 02:12:32 -0800 (PST) Received: by mail-yb1-xb36.google.com with SMTP id p188so1865237yba.5 for ; Thu, 19 Jan 2023 02:12:32 -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=QXqwQrSwt+StZdyqV9+cOyJ8Y9ygdXIHln0bwVMaadk=; b=VbKLGzTUd+ENkWd/TQLrCp+xkGy68MxxMR6IOzx+XVxV21bj/k70RYjkY6nf1T8f8x i0h7O4r1qb2vIuE9I1KvAEZ1Y/0jAB3V+S9eeQGE4MbLSBxabtOEODMkzs0m0Rj8o41Q 4QoEwPOkJILFtrZwswLmkP35CCDz1lUADGscA= 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=QXqwQrSwt+StZdyqV9+cOyJ8Y9ygdXIHln0bwVMaadk=; b=PSjYAkpeXKHxzdY9mfJyYkBuCuTQJPC65iZJ3v99n9XdYVFoAF/JAgAlMSxn/AYTOO H2/2Khy7S8Yi8FzGbXd9CnFjpH/zUftSTVb6WK8iHSD+9zEJXCQTRgQMXJZduO47zq6Y AEjxy5RgAZm3kWhb4BvH8vOVIWu3MesdXO0kr8G3VAU58BW+xXRBdxKD3lAAEFj0MWDq yu3w5jmWA1nedL5BHMJV08kbWryVnLqUjnzC1cW3+LWWvCtSmUW5pQfOYD94E7DFT5WU X+RRlZd0jAN8XdzGBdJIQzg76pkeu2t6GIdb9fIR1io4lrjKHxxuUWYIvcmpMWZEodWz QPCg== X-Gm-Message-State: AFqh2kpkmKvi2EZNLVpWPmOS8OFktkY76uCdiclWHoLqIHDeqVkP7QDI aIIYYF5KlOYdo2MvqAuW3qVoJ5XEPtJ+DPpOH//lXA== X-Received: by 2002:a05:6902:90e:b0:7c8:3a6f:9b7b with SMTP id bu14-20020a056902090e00b007c83a6f9b7bmr1254860ybb.88.1674123151869; Thu, 19 Jan 2023 02:12:31 -0800 (PST) MIME-Version: 1.0 References: <20230118031514.1278139-1-pmalani@chromium.org> In-Reply-To: From: Prashant Malani Date: Thu, 19 Jan 2023 02:12:20 -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:55 AM Prashant Malani wrote: > > 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. On 2nd thought, would it be safe to drop the calls in tcpm.c ? Following on from your PD controller example above, TCPM might be updating the active state for an altmode which doesn't have an altmode driver registered? Or does it only send out ENTER_MODE for alt modes which have an altmode driver? (Sorry if this is obvious to TCPM users, but I wanted to confirm before proceeding with a v2). > > > > thanks, > > > > -- > > heikki