All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Kyle Tso <kyletso@google.com>
Cc: linux@roeck-us.net, gregkh@linuxfoundation.org,
	badhri@google.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: typec: tcpm: Raise vdm_sm_running flag only when VDM SM is running
Date: Tue, 17 Aug 2021 13:55:10 +0300	[thread overview]
Message-ID: <YRuVjkcbT5058ulV@kuha.fi.intel.com> (raw)
In-Reply-To: <CAGZ6i=0=shyW-Y7G+SrySi7Sum8qnjhpOwp=vC+SUmwHkbQMrw@mail.gmail.com>

On Tue, Aug 17, 2021 at 06:32:55PM +0800, Kyle Tso wrote:
> On Tue, Aug 17, 2021 at 5:39 PM Heikki Krogerus
> <heikki.krogerus@linux.intel.com> wrote:
> >
> > On Mon, Aug 16, 2021 at 03:54:49PM +0800, Kyle Tso wrote:
> > > If the port is going to send Discover_Identity Message, vdm_sm_running
> > > flag was intentionally set before entering Ready States in order to
> > > avoid the conflict because the port and the port partner might start
> > > AMS at almost the same time after entering Ready States.
> > >
> > > However, the original design has a problem. When the port is doing
> > > DR_SWAP from Device to Host, it raises the flag. Later in the
> > > tcpm_send_discover_work, the flag blocks the procedure of sending the
> > > Discover_Identity and it might never be cleared until disconnection.
> >
> > This is a bit off-topic, but I just asked this in another thread: Why
> > do we have to do discovery with data role swap?
> >
> > thanks,
> >
> 
> This can be separated into two cases:
> 
> 1. in PD2: If the port is originally UFP, it cannot send
> Discover_Identity Message according to the Spec. And then DR_SWAP
> happens. The port becomes DFP, and now it can do that.
> 
> 2. in PD3: DFP and UFP are allowed to send Discover_Identity Message
> and the responses may differ based on which roles they are active on.
> 
> Quote from the PD3 Spec:
> ```
> The Discover Identity Command Shall be used to determine the identity
> and/or capabilities of the Port Partner. The following products Shall
> return a Discover Identity Command ACK in response to a Discover
> Identity Command request sent to SOP:
> 
> • A PD-Capable UFP that supports Modal Operation.
> • A PD-Capable product that has multiple DFPs.
> • A PD-Capable [USB4] product.
> ```

Got it. Thanks for the explanation.

> > > Since there exists another flag send_discover representing that the port
> > > is going to send Discover_Identity or not, it is enough to use that flag
> > > to prevent the conflict. Also change the timing of the set/clear of
> > > vdm_sm_running to indicate whether the VDM SM is actually running or
> > > not.
> > >
> > > Fixes: c34e85fa69b9 ("usb: typec: tcpm: Send DISCOVER_IDENTITY from dedicated work")
> > > Cc: Badhri Jagan Sridharan <badhri@google.com>
> > > Signed-off-by: Kyle Tso <kyletso@google.com>

FWIW:

Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>


thanks,

-- 
heikki

  reply	other threads:[~2021-08-17 10:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-16  7:54 [PATCH] usb: typec: tcpm: Raise vdm_sm_running flag only when VDM SM is running Kyle Tso
2021-08-17  9:39 ` Heikki Krogerus
2021-08-17 10:32   ` Kyle Tso
2021-08-17 10:55     ` Heikki Krogerus [this message]
2021-08-18 14:17 ` Guenter Roeck
2021-08-23  7:14   ` Kyle Tso
2021-08-26 11:48 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YRuVjkcbT5058ulV@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=badhri@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kyletso@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.