Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1629640ybk; Thu, 14 May 2020 13:53:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbjTesRnr6V4sY1UGDmkaTFaaCqN/aWhXsWI16XJM6McwhbcwUlK0DTZNAya8FH4ipQqgU X-Received: by 2002:a17:906:5695:: with SMTP id am21mr5593334ejc.223.1589489614107; Thu, 14 May 2020 13:53:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589489614; cv=none; d=google.com; s=arc-20160816; b=yqdMRdR/S4Lw/RvG9fAfAPSfqBwiQSJZPQHG23WynuL1HNBPPyTNUNYY7Y2DAccSlG qzhbUTzilEwXn8ZQD5Bpmym4JzmHCWgyMqqlQKiCYjH4H69H2fqF3fgQGK1VQed1wiKC eNwv5uOhaMX+pGrd+Tq6ljf0tFRMXLCTmaDD8HmndgclsbQ2da5u3gX6mJNFbCz1Qcjp hczjqnOt05lkSrn4mroirxcPwLz9lfziTYUPk+OmjY9vgBle+rONuc0USgEHFikW5awx 8yZfMqLmmhtAf2Nx2hz4fGCeQoyN+/kII6OhacIIAlk1nMVFLft/OUILieVEYjNcO3GP hMcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=CEO5MKxsOiGcoZ39AsHbecY6ymOt3yQ4dCldSFUPnR4=; b=F5byP7AvjIz0gcNGftZuD98+b5QV0srjK31oCJYt/gh5+upiymlJUT4DhSf4lmrF3t qClyTuyIazohcxl1e+cJDvIHqCD1957JZVZrJuYnip89keYspN4raPA0gqppytd/s1XZ THpr4JqpsATlS+/RKUreB1Nhnl5V4TkBqgLodJdjYvEEr3y8Az8WB8YcEn/ys4FJU5K7 SMrpA/HBUIuyogVoj0Ss7n4jCPR5yMTFC6+bKYGF8abu4DBjY67ANWVvmwtwRKvGPK1o +SRTk8jNKe37UXkGJIj2NsyxnFOMFsFDkbgBzt1O2KHuQeX5sbdqjyDo24GI3uuvfkbO MYmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=nSO+tCI9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kq23si15635ejb.104.2020.05.14.13.53.10; Thu, 14 May 2020 13:53:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=nSO+tCI9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728332AbgENUvq (ORCPT + 99 others); Thu, 14 May 2020 16:51:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726035AbgENUvp (ORCPT ); Thu, 14 May 2020 16:51:45 -0400 Received: from mail-qv1-xf42.google.com (mail-qv1-xf42.google.com [IPv6:2607:f8b0:4864:20::f42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E599AC061A0C for ; Thu, 14 May 2020 13:51:44 -0700 (PDT) Received: by mail-qv1-xf42.google.com with SMTP id l3so10365qvo.7 for ; Thu, 14 May 2020 13:51:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CEO5MKxsOiGcoZ39AsHbecY6ymOt3yQ4dCldSFUPnR4=; b=nSO+tCI9Zh7sRx+j/A6zP12qApAJl7YPoucFFniaPNg63f6d/RJbqGvHBbbdz3qR4q wxQNpJ4ZIOCIIsp5ABxFrQkrZWd4iUPjVGPhYw01jxSLQ8Ncs4KZRqZPhr4wZIQxc+9r kRHo62eCYWEsQ51YWnuWSvkk/F9oX8bUbIsU4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CEO5MKxsOiGcoZ39AsHbecY6ymOt3yQ4dCldSFUPnR4=; b=beUBlaXdenBLxDi9IodZETTm+8D1iGzHCb8CISELtc5SwhLXt9iG8eGEPA/zTW3psL DY4ml0hX5JRTjmnKk+ncgBGR4l9H9r/3pt5ojz6PnNUYx17OKP7iBUwbSYXkxnsICNqS b1klZMkPN206edcU/91NG8X4P+mYu+3DxoKPuy/d2AGNyOSgdpT1O+R+JkYt1jqOqhMO UcX8ltJAPOuGVggbCBflIshVLkhRzIo+KNkoQETVjTW8ZRE5tJcnvVEfj0EbfZXDVtiD HYI2icmIFKOV2Nlyazy7l5WkT/peBfw9tADN7CuMBBvXp40ZxABM5UHNsK6s/OJH85o4 j5Tw== X-Gm-Message-State: AOAM533FlkqQo55x/QQcHmARFpaUFkWnyttBLj4VDcgW7DgscxGt3Xef S9D9UEDZEuvIVhIxwNNysQJlkgCRmRETS5P1RrduMA== X-Received: by 2002:a0c:e304:: with SMTP id s4mr303192qvl.133.1589489502504; Thu, 14 May 2020 13:51:42 -0700 (PDT) MIME-Version: 1.0 References: <20200507150900.12102-1-heikki.krogerus@linux.intel.com> <20200507150900.12102-3-heikki.krogerus@linux.intel.com> <20200507224041.GA247416@google.com> <20200508111840.GG645261@kuha.fi.intel.com> <20200511133202.GA2085641@kuha.fi.intel.com> <20200511175719.GA136540@google.com> <20200512142251.GD2085641@kuha.fi.intel.com> <20200512191910.GD136540@google.com> In-Reply-To: <20200512191910.GD136540@google.com> From: Prashant Malani Date: Thu, 14 May 2020 13:51:32 -0700 Message-ID: Subject: Re: [PATCH 2/4] usb: typec: mux: intel_pmc_mux: Support for static SBU/HSL orientation To: Heikki Krogerus Cc: Greg Kroah-Hartman , Benson Leung , "open list:USB NETWORKING DRIVERS" , Linux Kernel Mailing List , linux-acpi@vger.kernel.org, Tim Wawrzynczak Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Heikki, On Tue, May 12, 2020 at 12:19 PM Prashant Malani wrote: > > Hi Heikki, > > On Tue, May 12, 2020 at 05:22:51PM +0300, Heikki Krogerus wrote: > > Hi Prashant, > > > > On Mon, May 11, 2020 at 10:57:19AM -0700, Prashant Malani wrote: > > > Hi Heikki, > > > > > > Thanks a lot for looking into this. Kindly see my response inline: > > > > > > On Mon, May 11, 2020 at 04:32:02PM +0300, Heikki Krogerus wrote: > > > > On Fri, May 08, 2020 at 02:18:44PM +0300, Heikki Krogerus wrote: > > > > > Hi Prashant, > > > > > > > > > > On Thu, May 07, 2020 at 03:40:41PM -0700, Prashant Malani wrote: > > > > > > > +static int sbu_orientation(struct pmc_usb_port *port) > > > > > > > +{ > > > > > > > + if (port->sbu_orientation) > > > > > > > + return port->sbu_orientation - 1; > > > > > > > + > > > > > > > + return port->orientation - 1; > > > > > > > +} > > > > > > > + > > > > > > > +static int hsl_orientation(struct pmc_usb_port *port) > > > > > > > +{ > > > > > > > + if (port->hsl_orientation) > > > > > > > + return port->hsl_orientation - 1; > > > > > > > + > > > > > > > + return port->orientation - 1; > > > > > > > +} > > > > > > > + > > > > > > > static int pmc_usb_command(struct pmc_usb_port *port, u8 *msg, u32 len) > > > > > > > { > > > > > > > u8 response[4]; > > > > > > > @@ -151,8 +170,9 @@ pmc_usb_mux_dp(struct pmc_usb_port *port, struct typec_mux_state *state) > > > > > > > > > > > > > > req.mode_data = (port->orientation - 1) << PMC_USB_ALTMODE_ORI_SHIFT; > > > > > > > req.mode_data |= (port->role - 1) << PMC_USB_ALTMODE_UFP_SHIFT; > > > > > > > - req.mode_data |= (port->orientation - 1) << PMC_USB_ALTMODE_ORI_AUX_SHIFT; > > > > > > > - req.mode_data |= (port->orientation - 1) << PMC_USB_ALTMODE_ORI_HSL_SHIFT; > > > > > > > + > > > > > > > + req.mode_data |= sbu_orientation(port) << PMC_USB_ALTMODE_ORI_AUX_SHIFT; > > > > > > > > > > > > I'm curious to know what would happen when sbu-orientation == "normal". > > > > > > That means |port->sbu_orientation| == 1. > > > > > > > > > > > > It sounds like what should happen is the AUX_SHIFT orientation > > > > > > setting should follow what |port->orientation| is, but here it > > > > > > looks like it will always be set to |port->sbu_orientation - 1|, i.e 0, > > > > > > even if port->orientation == TYPEC_ORIENTATION_REVERSE, i.e 2, meaning > > > > > > it should be set to 1 ? > > > > > > > > > > I'll double check this, and get back to you.. > > > > > > > > This is not exactly an answer to your question, but it seems that > > > > those bits are only valid if "Alternate-Direct" message is used. > > > > Currently the driver does not support that message. > > > Could you kindly provide some detail on when "Alternate-Direct" would be > > > preferred to the current method? > > > > Alternate Mode Direct request is supposed to be used if an alternate > > mode is entered directly from disconnected state. > > Ack. > > > > > Also, is there anything on the PMC side which is preventing the use of > > > "Alternate-Direct" messages? It seems like the state transition diagram > > > there would be simpler, although I'm likely missing significant details > > > here. > > > > So we actually should use the "direct" request if we are in > > disconnected state to enter alt modes if I understood correctly. But > > otherwise we should use the normal Alternate Mode request and not the > > Alternate Mode "direct" request. And I'm afraid I don't know why. > > SG. > > > > > > I think the correct thing to do now is to remove the two lines from > > > > the driver where those bits (ORI-HSL and ORI-Aux) are set. > > > I see. How would orientation then be handled in a retimer configuration > > > where AUX/SBU is flipped by the retimer itself? > > > > Note that if we send a separate "connection" request first, then we > > already tell the HSL and SBU orientation as part of the payload of > > that request. That is why there is no need to tell about the HSL and > > SBU orientation with the normal Alternate Mode Request. > > > > So we have already handled the HSL and SBU orientation by the time > > this function is called. > > Thanks for the explanation. I assume the HSL and SBU bit setting lines > will be removed from pmc_usb_mux_tbt() too? > I just realized, the issue I initially pointed out would apply to the connect message too, i.e I'm not sure if "normal" orientation setting handles the case where port orientation is reversed correctly. Overall, I am not sure that re-using the typec_orientations[] string list is the best option for this use-case. we're looking for "normal" (i.e follows port->orientation) and "fixed" (i.e is always the same orientation, regardless of what port->orientation is), so it is perhaps better to just define a new array just for this driver. > Best regards, > > > > > > thanks, > > > > -- > > heikki