Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755575AbdCGNAz (ORCPT ); Tue, 7 Mar 2017 08:00:55 -0500 Received: from mail-he1eur01on0053.outbound.protection.outlook.com ([104.47.0.53]:23887 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932551AbdCGNAl (ORCPT ); Tue, 7 Mar 2017 08:00:41 -0500 From: Peter Chen To: Heikki Krogerus , 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 Thread-Topic: [PATCH v17 2/3] usb: USB Type-C connector class Thread-Index: AQHSjE7Zns8DlLo/Z0qwb9O6z97wi6GChcqAgAC3ToCAA9itgIAAyUyAgADLioA= Date: Tue, 7 Mar 2017 01:36:29 +0000 Message-ID: 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> In-Reply-To: <20170306131619.GD6999@kuha.fi.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: linux.intel.com; dkim=none (message not signed) header.d=none;linux.intel.com; dmarc=none action=none header.from=nxp.com; x-originating-ip: [199.59.231.64] x-microsoft-exchange-diagnostics: 1;HE1PR04MB2969;7:PoPzBC4L2kUiHMQyX8DybAQ+KynGFh9C0ZcEZJYDWLGZV6xryulYZNJv1S27c4VWTSrBqhxvdmV5Xpfdq9imyb1vu9X+bvnyZQ3hxccViCJwoUOZrE6h1WCVjuGrIdT5Vrv4Y6vYXzIM8fl/Pj/tBbehCFxeIfrjAaX+R68NSh0pboXsOehcBBre+iBM9Q/kIEZKBpZ2KnrkJrIeaAobDjaoUzD77OR5VUoXJT59L6J3MHD6Z5BUfN+xDaSVoCs6RFiCgZBFbQwiXjkgPgsi1A8VXm9l0Xwmo//LWGCbTTIzOOqeTvdo3dCjZ4QVFR24XftnX5g6RahYAuoDb5BTdw==;23:YcevqWLFNkE/x3jqfF3i1xDxLxiHBrhFl+ixyozeHgGkztzz5Lx12dYI/ZnIOzjGRQrBebBzDSa5/lPRejL/xxGabVdql70e3rNinV2wZjA7RQmIJdek3/n+jn8v1jpsSvsHPsQ8qMElIJlD9wuvTw== x-forefront-antispam-report: SFV:SKI;SCL:-1SFV:NSPM;SFS:(10009020)(6009001)(7916002)(39410400002)(39860400002)(39450400003)(39840400002)(39850400002)(199003)(189002)(24454002)(43544003)(3846002)(4326008)(38730400002)(39060400002)(6436002)(50986999)(6246003)(76176999)(106116001)(2906002)(6116002)(102836003)(54356999)(6506006)(86362001)(77096006)(25786008)(2900100001)(8676002)(31430400001)(8936002)(92566002)(81166006)(189998001)(3660700001)(7696004)(93886004)(66066001)(33656002)(3280700002)(5660300001)(9686003)(54906002)(99286003)(122556002)(53936002)(55016002)(74316002)(7736002)(229853002)(305945005)(2950100002);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR04MB2969;H:HE1PR04MB1450.eurprd04.prod.outlook.com;FPR:;SPF:None;MLV:ovrnspm;PTR:InfoNoRecords;A:1;MX:1;LANG:en; x-ms-office365-filtering-correlation-id: 05745cc0-2b77-4472-41e8-08d464fa60e0 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(48565401081);SRVR:HE1PR04MB2969; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026)(6041248)(20161123564025)(20161123558025)(20161123560025)(20161123555025)(20161123562025)(6072148);SRVR:HE1PR04MB2969;BCL:0;PCL:0;RULEID:;SRVR:HE1PR04MB2969; x-forefront-prvs: 0239D46DB6 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Mar 2017 01:36:29.3962 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR04MB2969 X-OriginatorOrg: nxp.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v27D15Wt003257 Content-Length: 2182 Lines: 45 > >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? If it is correct, there is a notifier between type-C and USB controller driver, how to define this notifier for non-ACPI platform? >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. Peter