[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160818104456.GW9927@kuha.fi.intel.com>
Date: Thu, 18 Aug 2016 13:44:56 +0300
From: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To: Guenter Roeck <linux@...ck-us.net>
Cc: Greg KH <gregkh@...uxfoundation.org>,
Oliver Neukum <oneukum@...e.com>,
Felipe Balbi <felipe.balbi@...ux.intel.com>,
linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org
Subject: Re: [PATCH v5 1/2] usb: USB Type-C connector class
On Wed, Aug 17, 2016 at 10:58:40AM -0700, Guenter Roeck wrote:
> On Wed, Aug 17, 2016 at 01:34:40PM +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.
> >
> > Signed-off-by: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
> > ---
> [ ... ]
>
> > +
> > +static ssize_t current_power_role_store(struct device *dev,
> > + struct device_attribute *attr,
> > + const char *buf, size_t size)
> > +{
> > + struct typec_port *port = to_typec_port(dev);
> > + enum typec_role role;
> > + int ret = size;
> > +
> > + if (!port->cap->usb_pd) {
> > + dev_dbg(dev, "power role swap only supported with USB PD\n");
> > + return -EOPNOTSUPP;
> > + }
> > +
> > + if (!port->cap->pr_set) {
> > + dev_dbg(dev, "power role swapping not supported\n");
> > + return -EOPNOTSUPP;
> > + }
> > +
> > + if (port->pwr_opmode != TYPEC_PWR_MODE_PD) {
> > + dev_dbg(dev, "partner unable to swap power role\n");
> > + return -EIO;
> > + }
> > +
> > + if (!port->connected)
> > + return size;
> > +
> > + ret = sysfs_strmatch(typec_roles, ARRAY_SIZE(typec_roles), buf);
> > + if (ret < 0)
> > + return ret;
> > +
> > + role = ret;
> > +
> > + ret = port->cap->pr_set(port->cap, role);
>
> if (ret)
> missing.
It also seems to be missing from current_vconn_role_store().. How have
I managed to do that?
Thanks for catching this.
--
heikki
Powered by blists - more mailing lists