Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751849AbdCCOkc (ORCPT ); Fri, 3 Mar 2017 09:40:32 -0500 Received: from mga09.intel.com ([134.134.136.24]:45101 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751551AbdCCOkb (ORCPT ); Fri, 3 Mar 2017 09:40:31 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,237,1484035200"; d="scan'208";a="940246190" Date: Fri, 3 Mar 2017 16:31:33 +0200 From: Heikki Krogerus To: Peter Chen Cc: Greg KH , Guenter Roeck , Felipe Balbi , Oliver Neukum , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Roger Quadros , Jun Li Subject: Re: [PATCH v17 2/3] usb: USB Type-C connector class Message-ID: <20170303143133.GB6999@kuha.fi.intel.com> References: <20170221142405.76299-1-heikki.krogerus@linux.intel.com> <20170221142405.76299-3-heikki.krogerus@linux.intel.com> <20170303033529.GA18650@b29397-desktop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170303033529.GA18650@b29397-desktop> User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1503 Lines: 49 Hi Peter, On Fri, Mar 03, 2017 at 11:35:29AM +0800, Peter Chen wrote: > On Tue, Feb 21, 2017 at 05:24:04PM +0300, Heikki Krogerus wrote: > > +/* --------------------------------------- */ > > +/* Driver callbacks to report role updates */ > > + > > +/** > > + * typec_set_data_role - Report data role change > > + * @port: The USB Type-C Port where the role was changed > > + * @role: The new data role > > + * > > + * This routine is used by the port drivers to report data role changes. > > + */ > > +void typec_set_data_role(struct typec_port *port, enum typec_data_role role) > > +{ > > + if (port->data_role == role) > > + return; > > + > > + port->data_role = role; > > + sysfs_notify(&port->dev.kobj, NULL, "data_role"); > > + kobject_uevent(&port->dev.kobj, KOBJ_CHANGE); > > +} > > +EXPORT_SYMBOL_GPL(typec_set_data_role); > > + > > Hi Keikki, > > Have you tested this interface with real dual-role controller/board? Yes. Our boards are mostly USB dual-role capable. > What interface you use when you receive this event to handle > dual-role switch? I am wonder if a common dual-role class is > needed, then we can have a common user utility. > > Eg, if "data_role" has changed, the udev can echo "data_role" to > /sys/class/usb-dual-role/role No. If the partner executes successfully for example DR_Swap message, the kernel has to take care everything that is needed for the role to be what ever was negotiated on its own. User space can't be involved with that. Thanks, -- heikki