Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751506AbdCCGDj (ORCPT ); Fri, 3 Mar 2017 01:03:39 -0500 Received: from bh-25.webhostbox.net ([208.91.199.152]:46401 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751323AbdCCGDh (ORCPT ); Fri, 3 Mar 2017 01:03:37 -0500 Subject: Re: [PATCH v17 2/3] usb: USB Type-C connector class To: Peter Chen , Heikki Krogerus References: <20170221142405.76299-1-heikki.krogerus@linux.intel.com> <20170221142405.76299-3-heikki.krogerus@linux.intel.com> <20170303033529.GA18650@b29397-desktop> Cc: Greg KH , Felipe Balbi , Oliver Neukum , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Roger Quadros , Jun Li From: Guenter Roeck Message-ID: Date: Thu, 2 Mar 2017 20:29:07 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20170303033529.GA18650@b29397-desktop> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated_sender: linux@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: linux@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: linux@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1629 Lines: 52 On 03/02/2017 07:35 PM, 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? If it helps, my primary test system is a HP Chromebook 13 G1. > 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. I don't really understand "What interface you use when you receive this event". Can you explain ? > > Eg, if "data_role" has changed, the udev can echo "data_role" to > /sys/class/usb-dual-role/role > That sounds like a kernel event delivered to user space via udev or sysfs notification and returned back into the kernel through a sysfs attribute. Do I understand that correctly ? Thanks, Guenter > Maybe we can enhance Roger's drd framework [1] to fulfill that. > > [1] https://lwn.net/Articles/682531/ >