From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tony Lindgren Subject: Re: [PATCH v2 2/5] devicetree: power: Add docs for TI BQ24190 battery charger Date: Wed, 16 Aug 2017 14:06:45 -0700 Message-ID: <20170816210644.GX3930@atomide.com> References: <20170807195420.20767-1-liam@networkimprov.net> <20170807195420.20767-3-liam@networkimprov.net> <20170811025038.5qnhbabyybx7rgu5@rob-hp-laptop> <20170812164233.won7fairxmrnblps@earth> <20170816154701.GR3930@atomide.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Liam Breck Cc: Sebastian Reichel , Rob Herring , linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Hans de Goede , devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Liam Breck List-Id: linux-pm@vger.kernel.org * Liam Breck [170816 13:11]: > On Wed, Aug 16, 2017 at 8:47 AM, Tony Lindgren wrote: > > * Liam Breck [170812 12:00]: > >> On Sat, Aug 12, 2017 at 9:42 AM, Sebastian Reichel wrote: > >> > On Fri, Aug 11, 2017 at 02:57:10PM -0700, Liam Breck wrote: > >> >> >> +Other features: > >> >> >> +- Use gpio-hog to set the OTG pin high to enable 500mA charge current on USB SDP port. > >> >> > > >> >> > Why doesn't the charger driver control this? > >> >> > >> >> This pin/gpio has to be high when USB is plugged in to make the > >> >> charger chip negotiate 500mA from a SDP port. It should generally be > >> >> configured that way even if the driver is not loaded, as the chip does > >> >> not require a driver to function. Some boards may do that with a > >> >> pull-up. Also the user may want to change this via sysfs and not have > >> >> the driver "fix" it. > >> > > >> > drivers/power/supply/qcom_smbb.c exposes the otg feature as > >> > regulator. I think in this case it could be exposed as > >> > gpio-regulator. > >> > >> Hans is doing that here: > >> https://patchwork.kernel.org/patch/9883717/ > >> > >> The datasheet labels one pin "OTG" but that's misleading; it really > >> enables negotiation of 500mA input current, but does not turn on OTG > >> mode. If this pin is low, it only prevents the driver from starting > >> OTG mode via I2C msg. > > > > Yeah so before the device has enumerated this pin keeps the > > max current at 100mA as required by the USB spec. This pin > > should be only toggled after enumerating in bootloader or > > by the kernel driver. I tink the USB PHY driver can also > > be wired to control this line. > > > > Probably best to set it up as just a GPIO that the bq24190 > > driver controls optionally. > > > > Then later on we should have some Linux generic way for > > USB gadget subsystem to tell the charger that we have > > enumerated, and then bq24190 driver can toggle this GPIO > > to enable higher charge rates. > > I discovered a few months ago that setting this pin high after USB > connect has NO effect on iinlim. It has to be high at connect to > auto-negotiate 500mA. There is no point in making the driver control > this pin; we already tried that. > > Here we are just documenting how the DT can enable this pin via gpio-hog. Or in bootloader. Yeah this is mostly for completely empty battery to start charging at 100mA until bootloader can start and enable higher rates. > I believe the only way to defer 500mA negotiation is to leave this pin > off and set iinlim via I2C msg to chip. We can do that in a gadget > script via sysfs input_current_limit. Hans does not have to enable > this pin to start OTG-host on his x86 device, perhaps because it is > wired high there. Our script can set the linked gpio high if nec for > OTG-host. Yeah once something is running? If the kernel does not need to do anything about it, how about just leave it out of the binding docs then? Regards, Tony -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html