Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-26 Thread Heikki Krogerus
Hi Oliver, I've missed couple of your questions.. > > > Furthermore, do these files support poll? > > At least the current role and mode can change, so in principle > poll() makes sense. Yes I agree. I'll add support for polling. > > > And lastly we can get "Attention" as a message connected

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-26 Thread Heikki Krogerus
Hi Oliver, I've missed couple of your questions.. > > > Furthermore, do these files support poll? > > At least the current role and mode can change, so in principle > poll() makes sense. Yes I agree. I'll add support for polling. > > > And lastly we can get "Attention" as a message connected

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-18 Thread Heikki Krogerus
On Thu, Feb 18, 2016 at 02:44:25PM +0100, Oliver Neukum wrote: > On Thu, 2016-02-18 at 15:25 +0200, Heikki Krogerus wrote: > > Hi, > > > > > We have port directories for port power switching. How is > > > the connector directory linked to them? > > > > I'm sorry, I don't think I understand

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-18 Thread Heikki Krogerus
On Thu, Feb 18, 2016 at 02:44:25PM +0100, Oliver Neukum wrote: > On Thu, 2016-02-18 at 15:25 +0200, Heikki Krogerus wrote: > > Hi, > > > > > We have port directories for port power switching. How is > > > the connector directory linked to them? > > > > I'm sorry, I don't think I understand

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-18 Thread Oliver Neukum
On Thu, 2016-02-18 at 15:25 +0200, Heikki Krogerus wrote: Hi, > > We have port directories for port power switching. How is > > the connector directory linked to them? > > I'm sorry, I don't think I understand this point. Like this: oneukum@linux-dtbq:/sys/bus/usb/devices/3-0:1.0> ls -l

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-18 Thread Oliver Neukum
On Thu, 2016-02-18 at 15:25 +0200, Heikki Krogerus wrote: Hi, > > We have port directories for port power switching. How is > > the connector directory linked to them? > > I'm sorry, I don't think I understand this point. Like this: oneukum@linux-dtbq:/sys/bus/usb/devices/3-0:1.0> ls -l

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-18 Thread Heikki Krogerus
Hi, On Thu, Feb 18, 2016 at 10:35:41AM +0100, Oliver Neukum wrote: > On Thu, 2016-02-18 at 10:47 +0200, Heikki Krogerus wrote: > > Hi, > > > P.S. That reminds me, here's my current draft for the > > Documentation/ABI/. Could you take a look? > > And I am afraid, that I have a few remarks not

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-18 Thread Heikki Krogerus
Hi, On Thu, Feb 18, 2016 at 10:35:41AM +0100, Oliver Neukum wrote: > On Thu, 2016-02-18 at 10:47 +0200, Heikki Krogerus wrote: > > Hi, > > > P.S. That reminds me, here's my current draft for the > > Documentation/ABI/. Could you take a look? > > And I am afraid, that I have a few remarks not

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-18 Thread Heikki Krogerus
On Thu, Feb 18, 2016 at 10:21:48AM +0100, Oliver Neukum wrote: > On Thu, 2016-02-18 at 10:47 +0200, Heikki Krogerus wrote: > > Hi, > > > The modes that can actually be selected have to be supported by both > > the connector and the partner, and this is where I'm putting the ball > > on the

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-18 Thread Heikki Krogerus
On Thu, Feb 18, 2016 at 10:21:48AM +0100, Oliver Neukum wrote: > On Thu, 2016-02-18 at 10:47 +0200, Heikki Krogerus wrote: > > Hi, > > > The modes that can actually be selected have to be supported by both > > the connector and the partner, and this is where I'm putting the ball > > on the

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-18 Thread Oliver Neukum
On Thu, 2016-02-18 at 10:47 +0200, Heikki Krogerus wrote: Hi, > P.S. That reminds me, here's my current draft for the > Documentation/ABI/. Could you take a look? And I am afraid, that I have a few remarks not bound to a specific entry. We have port directories for port power switching. How is

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-18 Thread Oliver Neukum
On Thu, 2016-02-18 at 10:47 +0200, Heikki Krogerus wrote: Hi, > P.S. That reminds me, here's my current draft for the > Documentation/ABI/. Could you take a look? And I am afraid, that I have a few remarks not bound to a specific entry. We have port directories for port power switching. How is

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-18 Thread Oliver Neukum
On Thu, 2016-02-18 at 10:47 +0200, Heikki Krogerus wrote: Hi, > The modes that can actually be selected have to be supported by both > the connector and the partner, and this is where I'm putting the ball > on the userspace at the moment. I'm not offering a list of > "possible_alternate_modes"

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-18 Thread Oliver Neukum
On Thu, 2016-02-18 at 10:47 +0200, Heikki Krogerus wrote: Hi, > The modes that can actually be selected have to be supported by both > the connector and the partner, and this is where I'm putting the ball > on the userspace at the moment. I'm not offering a list of > "possible_alternate_modes"

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-18 Thread Heikki Krogerus
Hi Oliver, On Wed, Feb 17, 2016 at 03:07:27PM +0100, Oliver Neukum wrote: > On Tue, 2016-02-09 at 19:01 +0200, Heikki Krogerus wrote: > > 1. connected - Connection status of the connector > > 2. alternate_mode - The current Alternate Mode > > 3. alternate_modes - Lists all Alternate Modes the

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-18 Thread Heikki Krogerus
Hi Oliver, On Wed, Feb 17, 2016 at 03:07:27PM +0100, Oliver Neukum wrote: > On Tue, 2016-02-09 at 19:01 +0200, Heikki Krogerus wrote: > > 1. connected - Connection status of the connector > > 2. alternate_mode - The current Alternate Mode > > 3. alternate_modes - Lists all Alternate Modes the

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-17 Thread Oliver Neukum
On Tue, 2016-02-09 at 19:01 +0200, Heikki Krogerus wrote: > 1. connected - Connection status of the connector > 2. alternate_mode - The current Alternate Mode > 3. alternate_modes - Lists all Alternate Modes the connector supports > 4. partner_alt_modes - Lists partner's Alternate Modes when

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-17 Thread Oliver Neukum
On Tue, 2016-02-09 at 19:01 +0200, Heikki Krogerus wrote: > 1. connected - Connection status of the connector > 2. alternate_mode - The current Alternate Mode > 3. alternate_modes - Lists all Alternate Modes the connector supports > 4. partner_alt_modes - Lists partner's Alternate Modes when

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-15 Thread Oliver Neukum
On Wed, 2016-02-10 at 13:23 +0200, Heikki Krogerus wrote: > That is tricky, as we would need to keep a list of the preselected > modes and for all SVIDs the connector supports. I don't think it would > be practical to do from this file as we would then use it differently > when connected and not

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-15 Thread Oliver Neukum
On Wed, 2016-02-10 at 13:23 +0200, Heikki Krogerus wrote: > That is tricky, as we would need to keep a list of the preselected > modes and for all SVIDs the connector supports. I don't think it would > be practical to do from this file as we would then use it differently > when connected and not

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-11 Thread Oliver Neukum
On Thu, 2016-02-11 at 16:36 +0200, Heikki Krogerus wrote: > Just in case there are no misunderstandings here, Oliver was > commenting on alternate_mode_store function, and USB of course is not > Alternate Mode. Yes I was because that is the hardest case. In hindsight it is also the most useless.

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-11 Thread Heikki Krogerus
On Thu, Feb 11, 2016 at 10:08:14AM +0100, Oliver Neukum wrote: > I would think that user space should be able to preselect > that we always want to be upstream or downstream or flexible. Agreed. > And it should be able to preemptively disallow power delivery > even if no cable is present. By

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-11 Thread Heikki Krogerus
Hi Felipe, > >> 4. partner_alt_modes - Lists partner's Alternate Modes when connected > > partner_alternate_modes ? (it's a file name, we can spell it out) > > >> 5. partner_type - Can be USB, Charger, Alt Mode or Accessory > >> 6. data_role - The current data role, host or device > >> 7.

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-11 Thread Heikki Krogerus
On Wed, Feb 10, 2016 at 09:26:19AM -0800, Greg KH wrote: > On Wed, Feb 10, 2016 at 12:38:40PM +0200, Heikki Krogerus wrote: > > > And what is userspace going to do with these files? Why does it care? > > > > The OS policy regarding USB Type-C ports needs to come from user > > space. > > What

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-11 Thread Oliver Neukum
On Thu, 2016-02-11 at 10:55 +0200, Felipe Balbi wrote: > Oliver Neukum writes: > > On Tue, 2016-02-09 at 19:01 +0200, Heikki Krogerus wrote: > >> The purpose of this class is to provide unified interface > >> for user space to get the status and basic information about > >> USB Type-C Connectors

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-11 Thread Felipe Balbi
Oliver Neukum writes: > On Tue, 2016-02-09 at 19:01 +0200, Heikki Krogerus wrote: >> The purpose of this class is to provide unified interface >> for user space to get the status and basic information about >> USB Type-C Connectors in the system, control data role >> swapping, and when USB PD is

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-11 Thread Felipe Balbi
Oliver Neukum writes: > On Tue, 2016-02-09 at 19:01 +0200, Heikki Krogerus wrote: >> The purpose of this class is to provide unified interface >> for user space to get the status and basic information about >> USB Type-C Connectors in the system, control data role >> swapping,

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-11 Thread Oliver Neukum
On Thu, 2016-02-11 at 10:55 +0200, Felipe Balbi wrote: > Oliver Neukum writes: > > On Tue, 2016-02-09 at 19:01 +0200, Heikki Krogerus wrote: > >> The purpose of this class is to provide unified interface > >> for user space to get the status and basic information about > >> USB

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-11 Thread Heikki Krogerus
Hi Felipe, > >> 4. partner_alt_modes - Lists partner's Alternate Modes when connected > > partner_alternate_modes ? (it's a file name, we can spell it out) > > >> 5. partner_type - Can be USB, Charger, Alt Mode or Accessory > >> 6. data_role - The current data role, host or device > >> 7.

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-11 Thread Heikki Krogerus
On Thu, Feb 11, 2016 at 10:08:14AM +0100, Oliver Neukum wrote: > I would think that user space should be able to preselect > that we always want to be upstream or downstream or flexible. Agreed. > And it should be able to preemptively disallow power delivery > even if no cable is present. By

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-11 Thread Oliver Neukum
On Thu, 2016-02-11 at 16:36 +0200, Heikki Krogerus wrote: > Just in case there are no misunderstandings here, Oliver was > commenting on alternate_mode_store function, and USB of course is not > Alternate Mode. Yes I was because that is the hardest case. In hindsight it is also the most useless.

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-11 Thread Heikki Krogerus
On Wed, Feb 10, 2016 at 09:26:19AM -0800, Greg KH wrote: > On Wed, Feb 10, 2016 at 12:38:40PM +0200, Heikki Krogerus wrote: > > > And what is userspace going to do with these files? Why does it care? > > > > The OS policy regarding USB Type-C ports needs to come from user > > space. > > What

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-10 Thread Greg KH
On Wed, Feb 10, 2016 at 12:38:40PM +0200, Heikki Krogerus wrote: > > And what is userspace going to do with these files? Why does it care? > > The OS policy regarding USB Type-C ports needs to come from user > space. What drives this "need"? > The user must be allowed to select the USB data

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-10 Thread Heikki Krogerus
Hi Oliver, > > +static ssize_t alternate_mode_store(struct device *dev, > > + struct device_attribute *attr, > > + const char *buf, size_t size) > > +{ > > + struct typec_port *port = to_typec_port(dev); > > + struct typec_alt_mode

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-10 Thread Andy Shevchenko
On Wed, Feb 10, 2016 at 1:11 PM, Heikki Krogerus wrote: > On Wed, Feb 10, 2016 at 01:05:27PM +0200, Andy Shevchenko wrote: >> On Wed, Feb 10, 2016 at 12:49 PM, Oliver Neukum wrote: >> > On Tue, 2016-02-09 at 19:01 +0200, Heikki Krogerus wrote: >> >> The purpose of this class is to provide

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-10 Thread Heikki Krogerus
On Wed, Feb 10, 2016 at 01:05:27PM +0200, Andy Shevchenko wrote: > On Wed, Feb 10, 2016 at 12:49 PM, Oliver Neukum wrote: > > On Tue, 2016-02-09 at 19:01 +0200, Heikki Krogerus wrote: > >> The purpose of this class is to provide unified interface > >> for user space to get the status and basic

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-10 Thread Andy Shevchenko
On Wed, Feb 10, 2016 at 12:49 PM, Oliver Neukum wrote: > On Tue, 2016-02-09 at 19:01 +0200, Heikki Krogerus wrote: >> The purpose of this class is to provide unified interface >> for user space to get the status and basic information about >> USB Type-C Connectors in the system, control data role

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-10 Thread Oliver Neukum
On Tue, 2016-02-09 at 19:01 +0200, Heikki Krogerus wrote: > The purpose of this class is to provide unified interface > for user space to get the status and basic information about > USB Type-C Connectors in the system, control data role > swapping, and when USB PD is available, also power role >

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-10 Thread Heikki Krogerus
On Tue, Feb 09, 2016 at 10:20:45AM -0800, Greg KH wrote: > On Tue, Feb 09, 2016 at 07:01:21PM +0200, Heikki Krogerus wrote: > > The purpose of this class is to provide unified interface > > for user space to get the status and basic information about > > USB Type-C Connectors in the system,

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-10 Thread Greg KH
On Wed, Feb 10, 2016 at 12:38:40PM +0200, Heikki Krogerus wrote: > > And what is userspace going to do with these files? Why does it care? > > The OS policy regarding USB Type-C ports needs to come from user > space. What drives this "need"? > The user must be allowed to select the USB data

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-10 Thread Heikki Krogerus
On Tue, Feb 09, 2016 at 10:20:45AM -0800, Greg KH wrote: > On Tue, Feb 09, 2016 at 07:01:21PM +0200, Heikki Krogerus wrote: > > The purpose of this class is to provide unified interface > > for user space to get the status and basic information about > > USB Type-C Connectors in the system,

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-10 Thread Oliver Neukum
On Tue, 2016-02-09 at 19:01 +0200, Heikki Krogerus wrote: > The purpose of this class is to provide unified interface > for user space to get the status and basic information about > USB Type-C Connectors in the system, control data role > swapping, and when USB PD is available, also power role >

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-10 Thread Andy Shevchenko
On Wed, Feb 10, 2016 at 12:49 PM, Oliver Neukum wrote: > On Tue, 2016-02-09 at 19:01 +0200, Heikki Krogerus wrote: >> The purpose of this class is to provide unified interface >> for user space to get the status and basic information about >> USB Type-C Connectors in the system,

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-10 Thread Heikki Krogerus
Hi Oliver, > > +static ssize_t alternate_mode_store(struct device *dev, > > + struct device_attribute *attr, > > + const char *buf, size_t size) > > +{ > > + struct typec_port *port = to_typec_port(dev); > > + struct typec_alt_mode

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-10 Thread Heikki Krogerus
On Wed, Feb 10, 2016 at 01:05:27PM +0200, Andy Shevchenko wrote: > On Wed, Feb 10, 2016 at 12:49 PM, Oliver Neukum wrote: > > On Tue, 2016-02-09 at 19:01 +0200, Heikki Krogerus wrote: > >> The purpose of this class is to provide unified interface > >> for user space to get the

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-10 Thread Andy Shevchenko
On Wed, Feb 10, 2016 at 1:11 PM, Heikki Krogerus wrote: > On Wed, Feb 10, 2016 at 01:05:27PM +0200, Andy Shevchenko wrote: >> On Wed, Feb 10, 2016 at 12:49 PM, Oliver Neukum wrote: >> > On Tue, 2016-02-09 at 19:01 +0200, Heikki Krogerus wrote:

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-09 Thread Greg KH
On Tue, Feb 09, 2016 at 07:01:21PM +0200, Heikki Krogerus wrote: > The purpose of this class is to provide unified interface > for user space to get the status and basic information about > USB Type-C Connectors in the system, control data role > swapping, and when USB PD is available, also power

Re: [PATCH 1/3] usb: USB Type-C Connector Class

2016-02-09 Thread Greg KH
On Tue, Feb 09, 2016 at 07:01:21PM +0200, Heikki Krogerus wrote: > The purpose of this class is to provide unified interface > for user space to get the status and basic information about > USB Type-C Connectors in the system, control data role > swapping, and when USB PD is available, also power