Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753584AbdCHOAf (ORCPT ); Wed, 8 Mar 2017 09:00:35 -0500 Received: from mga02.intel.com ([134.134.136.20]:13050 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753281AbdCHOAc (ORCPT ); Wed, 8 Mar 2017 09:00:32 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,264,1486454400"; d="scan'208";a="57631564" Date: Wed, 8 Mar 2017 15:58:53 +0200 From: Heikki Krogerus To: Mats Karrman Cc: Guenter Roeck , Greg KH , Felipe Balbi , Oliver Neukum , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: Re: [PATCH v17 2/3] usb: USB Type-C connector class Message-ID: <20170308135853.GH6999@kuha.fi.intel.com> References: <20170221142405.76299-1-heikki.krogerus@linux.intel.com> <20170221142405.76299-3-heikki.krogerus@linux.intel.com> <4b4bbffc-db02-3b54-04bc-e7de79b2d9ed@roeck-us.net> <07618170-d561-e7fe-08e0-91316c53d832@gmail.com> <20170303125940.GA6999@kuha.fi.intel.com> <6ddb2eac-03d5-127e-df1e-ad189968e6b2@gmail.com> <20170306131442.GC6999@kuha.fi.intel.com> <696552a7-c36a-1d73-9517-543907e9da39@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <696552a7-c36a-1d73-9517-543907e9da39@gmail.com> 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: 2592 Lines: 55 On Tue, Mar 07, 2017 at 11:30:54PM +0100, Mats Karrman wrote: > > > So, both the DP controller and the USB PD phy are I2C devices, and now I have to make them both > > > attach to the AM bus as well? > > The DP controller would provide the driver and the USB PD phy > > (actually, the typec class) the device. > > > > Would it be a problem to register these I2C devices with some other > > subsystem, was it extcon or something like AM bus? It really would not > > be that uncommon. Or have I misunderstood your question? > > OK, so a bus could be used for drivers to find each other but it still does not say > anything about how those drivers are supposed to communicate so that must be prescribed > separately, right? Yes. > If I read Heikki's original suggestion I understand it like the DP driver would be > responsible for AM specific USB PD/VDM communication. But wouldn't that lead > to a lot of code duplication since the AM protocol is the same for all drivers of > a kind? No that's not what I mean. I'm still mixing your PD controller with something else above, sorry about that. Your PD controller driver should not ideally even need to be aware of Type-C connector, right? It definitely does not need to do any USB PD communication. I would imagine you have on top of the DP controller, a mux (which could be a DP/USB3 PHY like on Rockchip RK3399, discrete mux like Pericom PI3USB30532, or something else), and a USB Type-C PHY or USB PD controller. The bus would be tying the mux to the Type-C port (PHY or PD controller) and its partner (note that it does not tie the mux to the DP controller). Please correct me if I'm wrong about your hardware. Assuming that is how your board roughly looks like, the driver for the mux would be the driver for the DP altmode devices. That driver would be the one converting things like the Attention messages notifying about HPD into toggling of GPIOs, or what ever is needed on your board, etc. The actual PD communication with VDMs should be considered as just the protocol, so we probable should have "protocol drivers". For example DP alternate mode VDMs and communication will always be the same despite of the hardware. The DP alternate mode "protocol driver" would then be tied to the alternate mode device for the partner, and that driver could have its own hooks for what ever is needed, like HPD signal handling, configuration changes, whatever. In any case, hopefully making things easy and straightforward for the "mux driver", _so that it does not need to care about the actual PD communication_. Thanks, -- heikki