Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755284AbbBTUAv (ORCPT ); Fri, 20 Feb 2015 15:00:51 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:49545 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752892AbbBTUAs (ORCPT ); Fri, 20 Feb 2015 15:00:48 -0500 Date: Fri, 20 Feb 2015 14:00:26 -0600 From: Felipe Balbi To: David Cohen CC: Felipe Balbi , Linus Walleij , Robert Baldyga , , MyungJoo Ham , Chanwoo Choi , "linux-kernel@vger.kernel.org" , "linux-usb@vger.kernel.org" , Subject: Re: [PATCH v2] extcon: otg_gpio: add driver for USB OTG port controlled by GPIO(s) Message-ID: <20150220200025.GC12522@saruman.tx.rr.com> Reply-To: References: <1419288217-19262-1-git-send-email-david.a.cohen@linux.intel.com> <1424375984-26241-1-git-send-email-david.a.cohen@linux.intel.com> <54E6D721.9070107@samsung.com> <20150220191700.GB15303@psi-dev26.jf.intel.com> <20150220193606.GA12522@saruman.tx.rr.com> <20150220195927.GE15303@psi-dev26.jf.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="UFHRwCdBEJvubb2X" Content-Disposition: inline In-Reply-To: <20150220195927.GE15303@psi-dev26.jf.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4566 Lines: 120 --UFHRwCdBEJvubb2X Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Feb 20, 2015 at 11:59:27AM -0800, David Cohen wrote: > On Fri, Feb 20, 2015 at 01:36:06PM -0600, Felipe Balbi wrote: > > On Fri, Feb 20, 2015 at 11:17:00AM -0800, David Cohen wrote: > > > Hi Linus and Robert, > > >=20 > > > CC'ing Heikki as it involves a RFC from him. > > >=20 > > > On Fri, Feb 20, 2015 at 10:53:44AM +0100, Linus Walleij wrote: > > > > On Fri, Feb 20, 2015 at 7:41 AM, Robert Baldyga wrote: > > > > > Hi David, > > > > > > > > > > On 02/19/2015 08:59 PM, David Cohen wrote: > > > > >> Some Intel platforms have an USB OTG port fully (or partially) > > > > >> controlled by GPIOs: > > > > >> > > > > >> (1) USB ID is connected directly to a pulled up GPIO. > > > > >> > > > > >> Optionally: > > > > >> (2) VBUS is enabled/disabled by a GPIO > > > > >> (3) Platform has 2 USB controllers connected to same port: one f= or > > > > >> device and one for host role. D+/- are switched between phys. > > > > >> according to this GPIO level. > > > > >> > > > > >> This driver configures USB OTG port for device or host role acco= rding to > > > > >> USB ID value. > > > > >> - If USB ID's GPIO level is low, OTG port is configured for hos= t role > > > > >> by sourcing VBUS and switching D+/- to host phy. > > > > >> - If USB ID's GPIO level is high, by standard, the OTG port is > > > > >> configured for device role by not sourcing VBUS and switching= D+/- to > > > > >> device controller. > > > > > > > > > > IMO it's not very elegant to handle VBUS power on/off in extcon d= river. > > > > > Creating fixed regulator would allow to make VBUS handling more g= eneric. > > >=20 > > > I agree. But please, see below. > > >=20 > > > >=20 > > > > IMHO it's just layers of abstraction piled on top of each other her= e. > > > >=20 > > > > I would put this adjacent to the phy driver somewhere in drivers/us= b/* > > > > and make the actual USB-driver thing handle its GPIOs directly. > > > > But I guess David and Felipe have already discussed that as we're > > > > seeing this patch? > > >=20 > > > Felipe suggested to "divide to conquer" instead of having a single > > > extcon driver to handle all these functions: > > >=20 > > > - The mux functions would be controlled by a possible new pinctrl-gpio > > > driver (Linus, your input here would be nice :) > > > - The VBUS would be a fixed regulator > > > - The USB ID would make usage of existent extcon-gpio > > >=20 > > > But the on fw side, this is a single ACPI device representing a virtu= al > > > device for USB OTG port, which is nothing but a bunch of independent > > > GPIOs. > > >=20 > > > I could make a mfd driver to register devices for those simpler and m= ore > > > generic drivers, but according to [1] community recognized it as a ha= ck > > > with ACPI since I'd need to give them the GPIO without requesting on > > > mfd. > > >=20 > > > I'm open for suggestions :) > >=20 > > use MFD to create children devices and pass the required data to each > > one ? >=20 > I'd need to lookup GPIOs via ACPI without requesting them on mfd driver > and then give them to children devices. > Heikki proposed a way to do that on [1], but it got nack'ed by community. you missed [1] :-) --=20 balbi --UFHRwCdBEJvubb2X Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJU55JZAAoJEIaOsuA1yqREYHoP/1HzU4e3w/yEetHtfzRu9oS/ d/2SPYSb9HcNAVUKjBPxwoVUwDIpAySl3q/dzGk4duHv04fxyPX5mPNmdg5qUWyG JZXG6uSHwyLcVaXCX+FRWG9h6rTZ/iPIdLB0DIih+qZF0jlRNi5rjdzEMuHdCi+T MOSlIMQBrU4z6rdwJB8RwyHpEgQd5wI9stLIx5aCFiO3iwVlk8I4LvNycPdLBCpb LvdPvGGfqw4ux1dN9vcN/3Zoa5zyW1a8zsIvFiBagKf/aYm2XlXlveIdAgQV5QQ+ NMmpqMNtGl9qXjyocD46nacNPlxUq4IwYc/G6O1wzMxs1JJ2dwCM81bb8laXx1Ke ba65YD0EMx7b0DvggAHhSlHx3G7EwBn4gNEGEreQxhucNUlzZnGAyaVRJsBeBjA0 N+r0e2ZJeVGLhpHPf9/JCYXdqCpkPmUNQByhJvbSYQ9WZHRg6ERYOgZwiWYZq50q VTPeuvK/AI25IY7LNjl/JFYfUN1iVHs0A6zdg4De3ucE4uroAP5HD/Sc+tGqs4NY 9BLRQ2GozT4QfYTt5z4AcGFDVPH3pI+AriLxQVEDVKGEkNbVAQFho9GEBqorfr8W VyPJ/sKxSzAkBQhjb4QBmR/qZ1Uksn5w6Lzp/Ra8kxgwCsg8XTrawuYSThgji1QS FHKvgo5PKzOhi3UVnGox =FD5O -----END PGP SIGNATURE----- --UFHRwCdBEJvubb2X-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/