Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756764AbdCHEGO (ORCPT ); Tue, 7 Mar 2017 23:06:14 -0500 Received: from bh-25.webhostbox.net ([208.91.199.152]:43247 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756637AbdCHEGM (ORCPT ); Tue, 7 Mar 2017 23:06:12 -0500 Subject: Re: [PATCH v17 2/3] usb: USB Type-C connector class To: Heikki Krogerus , Peter Chen References: <20170221142405.76299-1-heikki.krogerus@linux.intel.com> <20170221142405.76299-3-heikki.krogerus@linux.intel.com> <20170303033529.GA18650@b29397-desktop> <20170303143133.GB6999@kuha.fi.intel.com> <20170306011551.GA23305@b29397-desktop> <20170306131619.GD6999@kuha.fi.intel.com> <20170307085753.GF6999@kuha.fi.intel.com> Cc: Peter Chen , 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: Tue, 7 Mar 2017 17:53:21 -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: <20170307085753.GF6999@kuha.fi.intel.com> 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: 2742 Lines: 59 On 03/07/2017 12:57 AM, Heikki Krogerus wrote: > On Tue, Mar 07, 2017 at 01:36:29AM +0000, Peter Chen wrote: >>> On Mon, Mar 06, 2017 at 09:15:51AM +0800, Peter Chen wrote: >>>>>> 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. >>>>> >>>> >>>> Would you give me an example how kernel handle this? How type-C event >>>> triggers role switch? >>> >>> On our boards, the firmware or EC (or ACPI) configures the hardware as needed >>> and also notifies the components using ACPI if needed. It's often not even possible to >>> directly configure the components/hardware for a particular role. >>> >> >> You mean type-C trigger an ACPI event, and this ACPI event can notify related >> USB controller driver doing role switch? > > No (firmware programs the dual-role hw/registers), but never mind. > That could be the case. > >> If it is correct, there is a notifier between type-C >> and USB controller driver, how to define this notifier for non-ACPI platform? > > Once there is a platform with Type-C like that, the problem needs to > be solved. However.. > >>> I'm not commenting on Roger's dual role patch series, but I don't really think it should >>> be mixed with Type-C. USB Type-C and USB Power Delivery define their own ways >>> of handling the roles, and they are not limited to the data role only. Things like OTG >>> for example will, and actually can not be supported. With Type-C we will have >>> competing state machines compared to OTG. The dual-role framework may be >>> useful on systems that provide more traditional connectors, which possibly have the >>> ID-pin like micro-AB, and possibly also support OTG. It can also be something that >>> exist in parallel with the Type-C class, but there just can not be any dependencies >>> between the two. >>> >> >> Yes, there are two independent things. But if the kernel doesn't have a notifier between >> type-C message sender (type-c class) and message receiver (like USB controller driver >> for role switch or other drivers for alternate mode message), we had to find some ways at >> userspace. > > ..what ever the solution is, it really can't rely on user space. > ... and, at least for our application, using extcon for the necessary notifications works just fine. Guenter