[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGCq0La71bzMKcRw-+QmnMtOH_eeA-5t0qYAq3fSrLgBToyUrw@mail.gmail.com>
Date: Wed, 16 Oct 2019 16:59:30 +0800
From: Puma Hsu <pumahsu@...gle.com>
To: Randy Dunlap <rdunlap@...radead.org>
Cc: heikki.krogerus@...ux.intel.com, gregkh@...uxfoundation.org,
Badhri Jagan Sridharan <badhri@...gle.com>,
Kyle Tso <kyletso@...gle.com>, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org,
Albert Wang <albertccwang@...gle.com>,
Puma Hsu <pumahsu@...gle.com>
Subject: Re: [PATCH] usb: typec: Add sysfs node to show cc orientation
Hi Randy,
According to include/linux/usb/typec.h, The value of
/sys/class/typec/<port>/cc_orientation is usually “1”, “2”, or “0”
corresponding to “configured in NORMAL side”, “configured in REVERSE
side”, or “nothing configured”.
Refer to the usage in tcpm.c, it claims CC1 is NORMAL and CC2 is REVERSE.
I will update this into Documentation description.
enum typec_orientation {
TYPEC_ORIENTATION_NONE,
TYPEC_ORIENTATION_NORMAL,
TYPEC_ORIENTATION_REVERSE,
};
Thanks in advance.
• Puma Hsu 許誌宏
• Software Engineer, Pixel Phone
• Tel: +886 2 8729 0870
• pumahsu@...gle.com
Thanks in advance.
• Puma Hsu 許誌宏
• Software Engineer, Pixel Phone
• Tel: +886 2 8729 0870
• pumahsu@...gle.com
On Wed, Oct 16, 2019 at 11:47 AM Randy Dunlap <rdunlap@...radead.org> wrote:
>
> On 10/15/19 8:43 PM, pumahsu wrote:
> > Export the Type-C cc orientation so that user space can
> > get this information.
> >
> > Signed-off-by: pumahsu <pumahsu@...gle.com>
>
> Hi,
> what the * is cc orientation?
>
> > ---
> > Documentation/ABI/testing/sysfs-class-typec | 7 +++++++
> > drivers/usb/typec/class.c | 11 +++++++++++
> > 2 files changed, 18 insertions(+)
> >
> > diff --git a/Documentation/ABI/testing/sysfs-class-typec b/Documentation/ABI/testing/sysfs-class-typec
> > index d7647b258c3c..419f952c991d 100644
> > --- a/Documentation/ABI/testing/sysfs-class-typec
> > +++ b/Documentation/ABI/testing/sysfs-class-typec
> > @@ -108,6 +108,13 @@ Contact: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
> > Description:
> > Revision number of the supported USB Type-C specification.
> >
> > +What: /sys/class/typec/<port>/cc_orientation
> > +Date: September 2019
> > +Contact: Puma Hsu <pumahsu@...gle.com>
> > +Description:
> > + Indicates which cc orientation is active now, or 0 when
> > + nothing is connected.
> > +
> >
> > USB Type-C partner devices (eg. /sys/class/typec/port0-partner/)
> >
> > diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
> > index 7d8805d9bf37..00edae63da8e 100644
> > --- a/drivers/usb/typec/class.c
> > +++ b/drivers/usb/typec/class.c
> > @@ -1238,6 +1238,16 @@ static ssize_t usb_power_delivery_revision_show(struct device *dev,
> > }
> > static DEVICE_ATTR_RO(usb_power_delivery_revision);
> >
> > +static ssize_t cc_orientation_show(struct device *dev,
> > + struct device_attribute *attr,
> > + char *buf)
> > +{
> > + struct typec_port *p = to_typec_port(dev);
> > +
> > + return sprintf(buf, "%d\n", typec_get_orientation(p));
> > +}
> > +static DEVICE_ATTR_RO(cc_orientation);
> > +
> > static struct attribute *typec_attrs[] = {
> > &dev_attr_data_role.attr,
> > &dev_attr_power_operation_mode.attr,
> > @@ -1248,6 +1258,7 @@ static struct attribute *typec_attrs[] = {
> > &dev_attr_usb_typec_revision.attr,
> > &dev_attr_vconn_source.attr,
> > &dev_attr_port_type.attr,
> > + &dev_attr_cc_orientation.attr,
> > NULL,
> > };
> > ATTRIBUTE_GROUPS(typec);
> >
>
>
> --
> ~Randy
Powered by blists - more mailing lists