Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1522480

Re: [PATHCv10 1/2] usb: USB Type-C connector class

From Guenter Roeck <linux@roeck-us.net>
Newsgroups linux.kernel
Subject Re: [PATHCv10 1/2] usb: USB Type-C connector class
Date 2016-11-15 10:30 +0100
Message-ID <sDIdX-33U-1@gated-at.bofh.it> (permalink)
References (1 earlier) <sj4M9-4KI-13@gated-at.bofh.it> <sDmds-5fH-23@gated-at.bofh.it> <sDoIi-709-7@gated-at.bofh.it> <sDwmt-3t4-1@gated-at.bofh.it> <sDG2t-1Lo-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 11/14/2016 11:07 PM, Greg KH wrote:
> On Mon, Nov 14, 2016 at 12:46:50PM -0800, Guenter Roeck wrote:
>> On Mon, Nov 14, 2016 at 02:32:35PM +0200, Heikki Krogerus wrote:
>>> Hi Greg,
>>>
>>> On Mon, Nov 14, 2016 at 10:51:48AM +0100, Greg KH wrote:
>>>> On Mon, Sep 19, 2016 at 02:16:56PM +0300, Heikki Krogerus wrote:
>>>>> The purpose of USB Type-C connector class is to provide
>>>>> unified interface for the user space to get the status and
>>>>> basic information about USB Type-C connectors on a system,
>>>>> control over data role swapping, and when the port supports
>>>>> USB Power Delivery, also control over power role swapping
>>>>> and Alternate Modes.
>>>>>
>>>>> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
>>>>> Tested-by: Guenter Roeck <linux@roeck-us.net>
>>>>> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
>>>>> ---
>>>>>  Documentation/ABI/testing/sysfs-class-typec |  218 ++++++
>>>>>  Documentation/usb/typec.txt                 |  103 +++
>>>>>  MAINTAINERS                                 |    9 +
>>>>>  drivers/usb/Kconfig                         |    2 +
>>>>>  drivers/usb/Makefile                        |    2 +
>>>>>  drivers/usb/typec/Kconfig                   |    7 +
>>>>>  drivers/usb/typec/Makefile                  |    1 +
>>>>>  drivers/usb/typec/typec.c                   | 1075 +++++++++++++++++++++++++++
>>>>>  include/linux/usb/typec.h                   |  252 +++++++
>>>>>  9 files changed, 1669 insertions(+)
>>>>>  create mode 100644 Documentation/ABI/testing/sysfs-class-typec
>>>>>  create mode 100644 Documentation/usb/typec.txt
>>>>>  create mode 100644 drivers/usb/typec/Kconfig
>>>>>  create mode 100644 drivers/usb/typec/Makefile
>>>>>  create mode 100644 drivers/usb/typec/typec.c
>>>>>  create mode 100644 include/linux/usb/typec.h
>>>>
>> [ ... ]
>>
>>>>> +
>>>>> +int typec_connect(struct typec_port *port, struct typec_connection *con)
>>>>> +{
>>>>> +	int ret;
>>>>> +
>>>>> +	if (!con->partner && !con->cable)
>>>>> +		return -EINVAL;
>>>>> +
>>>>> +	port->connected = 1;
>>>>> +	port->data_role = con->data_role;
>>>>> +	port->pwr_role = con->pwr_role;
>>>>> +	port->vconn_role = con->vconn_role;
>>>>> +	port->pwr_opmode = con->pwr_opmode;
>>>>> +
>>>>> +	kobject_uevent(&port->dev.kobj, KOBJ_CHANGE);
>>>>
>>>> This worries me.  Who is listening for it?  What will you do with it?
>>>> Shouldn't you just poll on an attribute file instead?
>>>
>>> Oliver! Did you need this or can we remove it?
>>>
>>> I remember I removed the "connected" attribute because you did not see
>>> any use for it at one point. I don't remember the reason exactly why?
>>>
>>
>> The Android team tells me that they are currently using the udev events
>> to track port role changes, and to detect presence of port partner.
>>
>> Also, there are plans to track changes on usbc*cable to differentiate
>> between cable attach vs. device being attached on the remote end.
>>
>> What is the problem with using kobject_uevent() and thus presumably
>> udev events ?
>
> It's not a "normal" thing to do and is pretty "heavy" to do.  What does
> userspace do with that change event?  Does it read specific attributes?
> What causes the event to happen in the kernel, is it really just a
> change in the specific object, or do new ones get added/removed?
>
> In short, document the heck out of this please so people know how to use
> it, and what is happening when the event happens.
>

Badhri,

can you clarify which events you are using in detail, and what for ?

Thanks,
Guenter

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATHCv10 1/2] usb: USB Type-C connector class Greg KH <gregkh@linuxfoundation.org> - 2016-11-14 11:00 +0100
  Re: [PATHCv10 1/2] usb: USB Type-C connector class Heikki Krogerus <heikki.krogerus@linux.intel.com> - 2016-11-14 13:40 +0100
    Re: [PATHCv10 1/2] usb: USB Type-C connector class Greg KH <gregkh@linuxfoundation.org> - 2016-11-14 15:20 +0100
      Re: [PATHCv10 1/2] usb: USB Type-C connector class Heikki Krogerus <heikki.krogerus@linux.intel.com> - 2016-11-14 15:40 +0100
        Re: [PATHCv10 1/2] usb: USB Type-C connector class Greg KH <gregkh@linuxfoundation.org> - 2016-11-14 16:10 +0100
    Re: [PATHCv10 1/2] usb: USB Type-C connector class Guenter Roeck <linux@roeck-us.net> - 2016-11-14 15:40 +0100
      Re: [PATHCv10 1/2] usb: USB Type-C connector class Oliver Neukum <oneukum@suse.com> - 2016-11-16 10:00 +0100
    Re: [PATHCv10 1/2] usb: USB Type-C connector class Guenter Roeck <linux@roeck-us.net> - 2016-11-14 21:50 +0100
      Re: [PATHCv10 1/2] usb: USB Type-C connector class Greg KH <gregkh@linuxfoundation.org> - 2016-11-15 08:10 +0100
        Re: [PATHCv10 1/2] usb: USB Type-C connector class Guenter Roeck <linux@roeck-us.net> - 2016-11-15 10:30 +0100
          Re: [PATHCv10 1/2] usb: USB Type-C connector class Badhri Jagan Sridharan <badhri@google.com> - 2016-11-16 01:20 +0100
            Re: [PATHCv10 1/2] usb: USB Type-C connector class Heikki Krogerus <heikki.krogerus@linux.intel.com> - 2016-11-16 10:40 +0100
              Re: [PATHCv10 1/2] usb: USB Type-C connector class Greg KH <gregkh@linuxfoundation.org> - 2016-11-16 10:50 +0100
                Re: [PATHCv10 1/2] usb: USB Type-C connector class Heikki Krogerus <heikki.krogerus@linux.intel.com> - 2016-11-16 12:20 +0100
                Re: [PATHCv10 1/2] usb: USB Type-C connector class Oliver Neukum <oneukum@suse.com> - 2016-11-16 12:40 +0100
                Re: [PATHCv10 1/2] usb: USB Type-C connector class Badhri Jagan Sridharan <badhri@google.com> - 2016-11-16 15:40 +0100
                Re: [PATHCv10 1/2] usb: USB Type-C connector class Heikki Krogerus <heikki.krogerus@linux.intel.com> - 2016-11-16 15:50 +0100
              Re: [PATHCv10 1/2] usb: USB Type-C connector class Oliver Neukum <oneukum@suse.com> - 2016-11-16 10:50 +0100
  Re: [PATHCv10 1/2] usb: USB Type-C connector class Badhri Jagan Sridharan <badhri@google.com> - 2016-11-16 16:30 +0100
  Re: [PATHCv10 1/2] usb: USB Type-C connector class Heikki Krogerus <heikki.krogerus@linux.intel.com> - 2016-11-16 16:30 +0100
    Re: [PATHCv10 1/2] usb: USB Type-C connector class Greg KH <gregkh@linuxfoundation.org> - 2016-11-16 16:40 +0100
      Re: [PATHCv10 1/2] usb: USB Type-C connector class Heikki Krogerus <heikki.krogerus@linux.intel.com> - 2016-11-17 09:30 +0100

csiph-web