mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Oliver Neukum <oneukum@suse.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
	Rajaram R <rajaram.officemail@gmail.com>,
	Felipe Balbi <felipe.balbi@linux.intel.com>,
	Mathias Nyman <mathias.nyman@linux.intel.com>,
	Greg KH <gregkh@linuxfoundation.org>,
	Guenter Roeck <linux@roeck-us.net>,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [RFC PATCHv2] usb: USB Type-C Connector Class
Date: Tue, 31 May 2016 15:09:01 +0300	[thread overview]
Message-ID: <20160531120901.GB10084@kuha.fi.intel.com> (raw)
In-Reply-To: <1464684509.10800.16.camel@suse.com>

On Tue, May 31, 2016 at 10:48:29AM +0200, Oliver Neukum wrote:
> On Tue, 2016-05-31 at 11:31 +0300, Heikki Krogerus wrote:
> > Hi Oliver,
> > 
> > On Mon, May 30, 2016 at 03:59:27PM +0200, Oliver Neukum wrote:
> > > On Mon, 2016-05-30 at 16:19 +0300, Heikki Krogerus wrote:
> > > > Hi guys,
> > > > 
> > > > I'm attaching a diff instead of full v3. I'm not yet adding attributes
> > > > for the reset and cable_reset. I still don't understand what is the
> > > > case where the userspace would need to be able to tricker reset? Why
> > > > isn't it enough for the userspace to be able to enter/exit modes?
> > > > Oliver! Can you please comment?
> > > 
> > > 1. Because we need error handling.
> > >    Devices crash. Cables will crash. We will get out of sync.
> > >    You never put yourself in a place where you cannot handle an
> > >    IO error.
> > > 2. Because it is in the spec. We do not second guess the spec.
> > >    We implement it.
> > 
> > Error conditions and crashes are the responsibility of the USB PD
> > stack, not userspace. In those cases the stack can not wait for a
> 
> Those are not exclusive conditions.
> 
> > command from the userspace. So for example if a timer like
> > NoResponseTimer times out, the stack an its state machines will have
> > to take care of the reset quite independently.
> 
> Yes. But somebody needs to handle high level errors.
> 
> > If you get out of sync with an alternate mode, you reset that specific
> > alternate mode by exiting and re-entering it, and you do not reset the
> > entire PD connection, port, partner or cable.
> 
> That would be the first step. If that doesn't work you will at that
> point either give up or use the next largest hammer.
> In principle you could do that in kernel space, but that implies
> that the kernel can detect all failures. That is unlikely.

Any PD communication failures the kernel has to be able to detect, so
I guess you mean failures with the alternate modes themselves, right?

In that case, surely exiting the mode is enough to "reset" it? When it
is re-entered, it has to be completely re-configured in any case. I
don't see how resetting the whole port or cable would guarantee that a
mode would become any more functional in case of failures? It will
however make also the other active modes to de-activate even if they
are functioning fine.

> > The resets from userspace would be purely unsolicited. What would the
> > cases where we would need to tricker a reset like that?
> > 
> > I want to be careful with exposing reset to userspace. Reset in USB PD
> > is not just an IO related thing. When you tricker a reset with USB PD,
> > even if it's a soft reset, it may lead into hard reset, which may
> > potentially lead into sudden voltage and current drop, which may lead
> > into the entire system crashing. We really need to understand the
> > cases where it would be necessary to tricker a reset from userspace.
> > Right now I don't see any.
> 
> User space can call reboot. Actually that does not help.
> Reset is an operation that is intended for error handling.
> If all else fails, we will need to use it.
> Its bad consequences apply whether you trigger this from kernel or
> user space. In fact, an operation that may potentially crash the system
> should involve user space.
> 
> > > > We also need to decide how the alternate modes a port support are
> > > > exposed to the userspace. Do we just assume the port drivers will
> > > > create them as devices under the port device itself, just like
> > > > alternate modes of partners and cable plugs are exposed under the
> > > > partners and cable plugs? That works for me, but again, the class does
> > > > not have any effect on that, and it will be just a guideline. Maybe
> > > > we can add some kind of helpers and force the port drivers to use
> > > > them.
> > > 
> > > What are the alternatives?
> > 
> > Can we make a group for them under the port device somehow? Like the
> > supported_alternate_modes I proposed. I guess it's not possible to add
> > devices to a specific group in sysfs. And would it even be useful.
> 
> Please explain. It is not clear to me what you are proposing here.

So is it possible to have a folder in sysfs for the alternate modes
a port supports?

So instead of:

        /sysfs/class/type-c/usbc0/svid:xxx1/
        /sysfs/class/type-c/usbc0/svid:xxx2/
        /sysfs/class/type-c/usbc0/svid:xxx3/
        ...

We would have something like:

        /sysfs/class/type-c/usbc0/supported_alternate_modes/svid:xxx1/
        /sysfs/class/type-c/usbc0/supported_alternate_modes/svid:xxx2/
        /sysfs/class/type-c/usbc0/supported_alternate_modes/svid:xxx3/
        ...


Thanks,

-- 
heikki

  reply	other threads:[~2016-05-31 12:09 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-19 12:44 Heikki Krogerus
2016-05-19 14:47 ` Oliver Neukum
2016-05-20 11:24   ` Heikki Krogerus
2016-05-20 13:37     ` Oliver Neukum
2016-05-21  5:51       ` Guenter Roeck
2016-05-21  6:43         ` Oliver Neukum
2016-05-22 15:54           ` Guenter Roeck
2016-05-23  5:34             ` Oliver Neukum
2016-05-23 13:27               ` Guenter Roeck
2016-05-23 13:58                 ` Oliver Neukum
2016-05-23 14:43                   ` Guenter Roeck
2016-05-23 15:55                     ` Oliver Neukum
2016-05-23 16:52                       ` Guenter Roeck
2016-05-24 10:08                         ` Heikki Krogerus
2016-05-24 10:18                           ` Oliver Neukum
2016-05-24 11:04                             ` Heikki Krogerus
2016-05-19 14:48 ` Oliver Neukum
2016-05-19 15:43   ` Greg KH
2016-05-20 10:58     ` Heikki Krogerus
2016-05-19 17:53 ` Guenter Roeck
2016-05-20 10:47   ` Heikki Krogerus
2016-05-20 17:02     ` Guenter Roeck
2016-05-23  9:23       ` Heikki Krogerus
2016-05-20 14:19 ` Oliver Neukum
2016-05-23  9:57   ` Heikki Krogerus
2016-05-23 11:25     ` Oliver Neukum
2016-05-23 17:09       ` Guenter Roeck
2016-05-24  9:06         ` Oliver Neukum
2016-05-24  9:32       ` Heikki Krogerus
2016-05-24 12:51 ` Oliver Neukum
2016-05-25 11:28   ` Heikki Krogerus
2016-05-25 15:19     ` Guenter Roeck
2016-05-27  7:30       ` Heikki Krogerus
2016-05-24 13:42 ` Guenter Roeck
2016-05-25 11:30   ` Heikki Krogerus
2016-05-25 13:12     ` Guenter Roeck
2016-05-24 19:28 ` Guenter Roeck
2016-05-25 11:51   ` Heikki Krogerus
2016-05-25 13:21     ` Guenter Roeck
2016-05-25 14:04       ` Heikki Krogerus
2016-05-25 14:20         ` Oliver Neukum
2016-05-25 14:59           ` Guenter Roeck
2016-05-27  7:29             ` Heikki Krogerus
2016-05-25 18:35 ` [RFC PATCH] usb: typec: Various API updates and fixes Guenter Roeck
2016-05-27  7:55   ` Heikki Krogerus
2016-05-27 14:06     ` Guenter Roeck
2016-05-30 12:48       ` Heikki Krogerus
2016-05-30 13:19 ` [RFC PATCHv2] usb: USB Type-C Connector Class Heikki Krogerus
2016-05-30 13:59   ` Oliver Neukum
2016-05-31  8:31     ` Heikki Krogerus
2016-05-31  8:48       ` Oliver Neukum
2016-05-31 12:09         ` Heikki Krogerus [this message]
2016-05-31 12:43           ` Heikki Krogerus
2016-05-31 17:20             ` Guenter Roeck
2016-06-01  8:23               ` Heikki Krogerus
2016-06-01  8:31                 ` Oliver Neukum
2016-06-01  9:04                 ` Oliver Neukum
2016-06-01 13:34                   ` Guenter Roeck
2016-06-02  6:24                     ` Oliver Neukum
2016-06-02  6:37                       ` Guenter Roeck
2016-06-02  7:43                         ` Oliver Neukum
2016-05-31 17:14       ` Guenter Roeck
2016-06-01  9:26 ` Oliver Neukum
2016-06-01 23:29   ` Guenter Roeck
2016-06-02  6:30     ` Oliver Neukum
2016-06-02  8:27       ` Heikki Krogerus
2016-06-02 10:18     ` Heikki Krogerus
2016-06-02 16:12       ` Guenter Roeck
2016-06-03 13:21         ` Heikki Krogerus
2016-06-03 13:51           ` Guenter Roeck
2016-06-03 15:17             ` Heikki Krogerus
2016-06-03 18:39               ` Guenter Roeck
2016-06-06 13:28                 ` Heikki Krogerus
2016-06-06 13:35                   ` Oliver Neukum
2016-06-07  8:23                     ` Heikki Krogerus
2016-06-07 16:57                   ` Guenter Roeck
2016-06-02  8:02   ` Heikki Krogerus
2016-06-03 20:20 ` Pavel Machek
2016-06-06 13:45   ` Heikki Krogerus
2016-06-06 14:41     ` Greg KH
2016-06-07  8:25       ` Heikki Krogerus
2016-06-06 16:02     ` Guenter Roeck
2016-06-10 14:34 ` [RFC PATCHv3] " Heikki Krogerus
2016-06-11  7:05   ` Oliver Neukum
2016-06-11 18:03     ` Guenter Roeck
2016-06-13  7:49       ` Heikki Krogerus
2016-06-13  7:48     ` Heikki Krogerus
2016-06-21 13:08 ` [RFC PATCHv2] " Oliver Neukum
2016-06-21 13:24   ` Guenter Roeck
2016-06-21 19:43     ` Oliver Neukum
2016-06-21 21:37       ` Guenter Roeck
2016-06-21 13:58   ` Heikki Krogerus
2016-06-21 20:43     ` Oliver Neukum
2016-06-22  9:31       ` Heikki Krogerus
2016-06-22 10:08         ` Oliver Neukum
2016-06-22 11:19           ` Heikki Krogerus
2016-08-07 21:37           ` Pavel Machek
2016-08-08  8:52             ` Oliver Neukum

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=20160531120901.GB10084@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=andy.shevchenko@gmail.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=mathias.nyman@linux.intel.com \
    --cc=oneukum@suse.com \
    --cc=rajaram.officemail@gmail.com \
    /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

all inboxes | Powered by JetHome®