mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Oliver Neukum <oneukum@suse.com>,
	Greg KH <gregkh@linuxfoundation.org>,
	Vincent Palatin <vpalatin@chromium.org>,
	Bin Gao <bin.gao@linux.intel.com>,
	Felipe Balbi <felipe.balbi@linux.intel.com>,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCHv6 1/3] usb: USB Type-C connector class
Date: Tue, 30 Aug 2016 17:13:31 +0300	[thread overview]
Message-ID: <20160830141331.GD1751@kuha.fi.intel.com> (raw)
In-Reply-To: <fbf390ec-4912-1fb5-f11b-0afc26273924@roeck-us.net>

On Tue, Aug 30, 2016 at 06:46:24AM -0700, Guenter Roeck wrote:
> On 08/30/2016 03:04 AM, Heikki Krogerus wrote:
> > Hi Oliver,
> > 
> > On Tue, Aug 30, 2016 at 11:32:01AM +0200, Oliver Neukum wrote:
> > > On Mon, 2016-08-29 at 15:36 +0300, Heikki Krogerus wrote:
> > > > +What:          /sys/class/typec/<port>/current_data_role
> > > > +Date:          June 2016
> > > > +Contact:       Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > > > +Description:
> > > > +               The current USB data role the port is operating in.
> > > > This
> > > > +               attribute can be used for requesting data role
> > > > swapping on the
> > > > +               port. Swapping is only supported as an asynchronous
> > > > operation
> > > > +               and requires polling of the attribute in order to know
> > > > the
> > > > +               result, so successful write operation does not mean
> > > > successful
> > > > +               swap.
> > > > +
> > > 
> > > That is badly formulated. Does it mean that poll() or select()
> > > can be used or does the value need to be repearedly read?
> > 
> > Does polling not always mean poll/select?
> > 
> > > And how would you learn about an error?
> > 
> > This is what I'm also really worried about. I'm now wondering did I
> > give up too easily on this to Guenter in hope to move this thing
> > forward. He said it's problematic to do these calls synchronously for
> > him. Was it something related to potential conflicting role swaps from
> > both ends?
> > 
> > Guenter, can you please elaborate? And how do you plan to report
> > failures with the swaps?
> > 
> 
> I thought we had this sorted out. When I said "asynchronous", I did not mean
> that the sysfs operation would not wait for the operation to complete. I meant
> that the Type-C state machine operates in a different context than the sysfs/class
> code. Since the state machine operates in a different context, it may have
> to execute a callback into the class code at any time, independently of
> any pending role changes triggered through sysfs. Please have a look into
> the patch set I submitted for details. Roughly it works as follows.
> 
> Class code context				State machine context
> 
> User requests role change
> Class code calls {dr,pr,vconn}_set
> {dr,pr,vconn}_set code validates request
> {dr,pr,vconn}_set code sends role change
> 	request to state machine		State machine gets role change request
> {dr,pr,vconn}_set code waits for completion
> 						State machine sends role change request
> 						to link partner
> 						Partner reports Accept or Reject
> 						State machine changes state as requested
> 						State machine reports new role to class code
> 							via callbacks
> 						State machine informs Class code that request
> 						is complete
> {dr,pr,vconn}_set code gets results
> 	and returns to caller
> Class code reports results to user
> 
> From user perspective, everything is synchronous. However, the state machine has to be
> able to run independently and report role and other state changes to the class code while
> a role change request from the class code is pending. For example, it has to be able to
> handle incoming role change requests from the link partner, and it has to be able to
> handle link state changes. All those have to be reported to the class code. This is
> impossible if the class code holds a lock while a role change triggered from user space
> is pending, which is why I asked for the locks in the class code to be removed.
> 
> Maybe my use of the term "asynchronous" was misleading, and I should have said "operates
> in a different context" instead. My apologies.

Thanks for the explanation. I remember you did explain this before I
started my parental leave, but I forgot all about it.


Thanks,

-- 
heikki

  reply	other threads:[~2016-08-30 14:20 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-29 12:36 [PATCHv6 0/3] USB Type-C Connector class Heikki Krogerus
2016-08-29 12:36 ` [PATCHv6 1/3] usb: USB Type-C connector class Heikki Krogerus
2016-08-29 13:06   ` Vincent Palatin
2016-08-30  9:32   ` Oliver Neukum
2016-08-30 10:04     ` Heikki Krogerus
2016-08-30 11:16       ` Oliver Neukum
2016-08-30 11:49         ` Heikki Krogerus
2016-08-30 13:11           ` Heikki Krogerus
2016-08-30 13:47             ` Guenter Roeck
2016-08-31 11:09               ` Heikki Krogerus
2016-08-31 13:18                 ` Guenter Roeck
2016-08-30 13:46       ` Guenter Roeck
2016-08-30 14:13         ` Heikki Krogerus [this message]
2016-08-30 15:40       ` Guenter Roeck
2016-08-29 12:36 ` [PATCHv6 2/3] usb: typec: add driver for Intel Whiskey Cove PMIC USB Type-C PHY Heikki Krogerus
2016-08-29 12:36 ` [PATCHv6 3/3] mfd: intel_soc_pmic_bxtwc: add support for USB Type-C PHY on WhiskeyCove Heikki Krogerus
2016-08-30  8:59   ` Lee Jones
2016-08-30 13:35     ` Lee Jones
2016-08-29 13:06 ` [PATCHv6 0/3] USB Type-C Connector class Guenter Roeck
2016-08-29 13:43   ` Heikki Krogerus
  -- strict thread matches above, loose matches on Subject: below --
2016-08-22 12:05 Heikki Krogerus
2016-08-22 12:05 ` [PATCHv6 1/3] usb: USB Type-C connector class Heikki Krogerus
2016-08-24 14:08   ` Vincent Palatin
2016-08-25 11:59     ` Heikki Krogerus
2016-08-26 13:16       ` Vincent Palatin
2016-08-26 14:07         ` Heikki Krogerus
2016-08-29 13:04           ` Guenter Roeck
2016-08-29 13:43             ` Heikki Krogerus
2016-08-29 14:07               ` Heikki Krogerus
2016-08-29 18:50                 ` Guenter Roeck
2016-08-30  8:22                   ` Heikki Krogerus
2016-08-30 15:28                     ` Guenter Roeck
2016-08-30 17:00                     ` Guenter Roeck

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=20160830141331.GD1751@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=bin.gao@linux.intel.com \
    --cc=felipe.balbi@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=oneukum@suse.com \
    --cc=vpalatin@chromium.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome