* [PATCH v2 2/5] devicetree: power: Add docs for TI BQ24190 battery charger [not found] <20170807195420.20767-1-liam@networkimprov.net> @ 2017-08-07 19:54 ` Liam Breck [not found] ` <20170807195420.20767-3-liam-RYWXG+zxWwBdeoIcmNTgJF6hYfS7NtTn@public.gmane.org> 0 siblings, 1 reply; 11+ messages in thread From: Liam Breck @ 2017-08-07 19:54 UTC (permalink / raw) To: Sebastian Reichel, linux-pm Cc: Tony Lindgren, Hans de Goede, Rob Herring, devicetree, Liam Breck From: Liam Breck <kernel@networkimprov.net> Document monitored-battery and ti,system-minimum-microvolt properties. Cc: Rob Herring <robh@kernel.org> Cc: devicetree@vger.kernel.org Signed-off-by: Liam Breck <kernel@networkimprov.net> --- .../devicetree/bindings/power/supply/bq24190.txt | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/supply/bq24190.txt diff --git a/Documentation/devicetree/bindings/power/supply/bq24190.txt b/Documentation/devicetree/bindings/power/supply/bq24190.txt new file mode 100644 index 00000000..82a1c842 --- /dev/null +++ b/Documentation/devicetree/bindings/power/supply/bq24190.txt @@ -0,0 +1,49 @@ +TI BQ24190 Li-Ion Battery Charger + +Required properties: +- compatible: contains one of the following: + * "ti,bq24190" + * "ti,bq24192i" +- reg: integer, I2C address of the charger. +- interrupts[-extended]: configuration for charger INT pin. + +Optional properties: +- monitored-battery: phandle of battery characteristics devicetree node + The charger uses the following battery properties: + + precharge-current-microamp: maximum charge current during precharge + phase (typically 20% of battery capacity). + + charge-term-current-microamp: a charge cycle terminates when the + battery voltage is above recharge threshold, and the current is below + this setting (typically 10% of battery capacity). + See Documentation/devicetree/bindings/power/supply/battery.txt +- ti,system-minimum-microvolt: when power is connected and the battery is below + minimum system voltage, the system will be regulated above this setting. + +Other features: +- Use gpio-hog to set the OTG pin high to enable 500mA charge current on USB SDP port. + +Example: + + bat: battery { + compatible = "simple-battery"; + precharge-current-microamp = <256000>; + charge-term-current-microamp = <128000>; + // etc. + }; + + bq24190: charger@6a { + compatible = "ti,bq24190"; + reg = <0x6a>; + interrupts-extended = <&gpiochip 10 IRQ_TYPE_EDGE_FALLING>; + monitored-battery = <&bat>; + ti,system-minimum-microvolt = <3200000>; + }; + + &twl_gpio { + otg { + gpio-hog; + gpios = <6 0>; + output-high; + line-name = "otg-gpio"; + }; + }; -- 2.13.2 ^ permalink raw reply related [flat|nested] 11+ messages in thread
[parent not found: <20170807195420.20767-3-liam-RYWXG+zxWwBdeoIcmNTgJF6hYfS7NtTn@public.gmane.org>]
* Re: [PATCH v2 2/5] devicetree: power: Add docs for TI BQ24190 battery charger [not found] ` <20170807195420.20767-3-liam-RYWXG+zxWwBdeoIcmNTgJF6hYfS7NtTn@public.gmane.org> @ 2017-08-11 2:50 ` Rob Herring 2017-08-11 21:57 ` Liam Breck 0 siblings, 1 reply; 11+ messages in thread From: Rob Herring @ 2017-08-11 2:50 UTC (permalink / raw) To: Liam Breck Cc: Sebastian Reichel, linux-pm-u79uwXL29TY76Z2rM5mHXA, Tony Lindgren, Hans de Goede, devicetree-u79uwXL29TY76Z2rM5mHXA, Liam Breck On Mon, Aug 07, 2017 at 12:54:17PM -0700, Liam Breck wrote: > From: Liam Breck <kernel-RYWXG+zxWwBdeoIcmNTgJF6hYfS7NtTn@public.gmane.org> > > Document monitored-battery and ti,system-minimum-microvolt properties. > > Cc: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> > Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > Signed-off-by: Liam Breck <kernel-RYWXG+zxWwBdeoIcmNTgJF6hYfS7NtTn@public.gmane.org> > --- > .../devicetree/bindings/power/supply/bq24190.txt | 49 ++++++++++++++++++++++ > 1 file changed, 49 insertions(+) > create mode 100644 Documentation/devicetree/bindings/power/supply/bq24190.txt > > diff --git a/Documentation/devicetree/bindings/power/supply/bq24190.txt b/Documentation/devicetree/bindings/power/supply/bq24190.txt > new file mode 100644 > index 00000000..82a1c842 > --- /dev/null > +++ b/Documentation/devicetree/bindings/power/supply/bq24190.txt > @@ -0,0 +1,49 @@ > +TI BQ24190 Li-Ion Battery Charger > + > +Required properties: > +- compatible: contains one of the following: > + * "ti,bq24190" > + * "ti,bq24192i" > +- reg: integer, I2C address of the charger. > +- interrupts[-extended]: configuration for charger INT pin. > + > +Optional properties: > +- monitored-battery: phandle of battery characteristics devicetree node > + The charger uses the following battery properties: > + + precharge-current-microamp: maximum charge current during precharge > + phase (typically 20% of battery capacity). > + + charge-term-current-microamp: a charge cycle terminates when the > + battery voltage is above recharge threshold, and the current is below > + this setting (typically 10% of battery capacity). > + See Documentation/devicetree/bindings/power/supply/battery.txt > +- ti,system-minimum-microvolt: when power is connected and the battery is below > + minimum system voltage, the system will be regulated above this setting. > + > +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? > + > +Example: > + > + bat: battery { > + compatible = "simple-battery"; > + precharge-current-microamp = <256000>; > + charge-term-current-microamp = <128000>; > + // etc. > + }; > + > + bq24190: charger@6a { > + compatible = "ti,bq24190"; > + reg = <0x6a>; > + interrupts-extended = <&gpiochip 10 IRQ_TYPE_EDGE_FALLING>; > + monitored-battery = <&bat>; > + ti,system-minimum-microvolt = <3200000>; > + }; > + > + &twl_gpio { > + otg { > + gpio-hog; > + gpios = <6 0>; > + output-high; > + line-name = "otg-gpio"; > + }; > + }; > -- > 2.13.2 > -- 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/5] devicetree: power: Add docs for TI BQ24190 battery charger 2017-08-11 2:50 ` Rob Herring @ 2017-08-11 21:57 ` Liam Breck 2017-08-12 16:42 ` Sebastian Reichel 0 siblings, 1 reply; 11+ messages in thread From: Liam Breck @ 2017-08-11 21:57 UTC (permalink / raw) To: Rob Herring Cc: Sebastian Reichel, linux-pm, Tony Lindgren, Hans de Goede, devicetree, Liam Breck Hi Rob, On Thu, Aug 10, 2017 at 7:50 PM, Rob Herring <robh@kernel.org> wrote: > On Mon, Aug 07, 2017 at 12:54:17PM -0700, Liam Breck wrote: >> From: Liam Breck <kernel@networkimprov.net> >> >> Document monitored-battery and ti,system-minimum-microvolt properties. >> >> Cc: Rob Herring <robh@kernel.org> >> Cc: devicetree@vger.kernel.org >> Signed-off-by: Liam Breck <kernel@networkimprov.net> >> --- >> .../devicetree/bindings/power/supply/bq24190.txt | 49 ++++++++++++++++++++++ >> 1 file changed, 49 insertions(+) >> create mode 100644 Documentation/devicetree/bindings/power/supply/bq24190.txt >> >> diff --git a/Documentation/devicetree/bindings/power/supply/bq24190.txt b/Documentation/devicetree/bindings/power/supply/bq24190.txt >> new file mode 100644 >> index 00000000..82a1c842 >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/power/supply/bq24190.txt >> @@ -0,0 +1,49 @@ >> +TI BQ24190 Li-Ion Battery Charger >> + >> +Required properties: >> +- compatible: contains one of the following: >> + * "ti,bq24190" >> + * "ti,bq24192i" >> +- reg: integer, I2C address of the charger. >> +- interrupts[-extended]: configuration for charger INT pin. >> + >> +Optional properties: >> +- monitored-battery: phandle of battery characteristics devicetree node >> + The charger uses the following battery properties: >> + + precharge-current-microamp: maximum charge current during precharge >> + phase (typically 20% of battery capacity). >> + + charge-term-current-microamp: a charge cycle terminates when the >> + battery voltage is above recharge threshold, and the current is below >> + this setting (typically 10% of battery capacity). >> + See Documentation/devicetree/bindings/power/supply/battery.txt >> +- ti,system-minimum-microvolt: when power is connected and the battery is below >> + minimum system voltage, the system will be regulated above this setting. >> + >> +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. >> + >> +Example: >> + >> + bat: battery { >> + compatible = "simple-battery"; >> + precharge-current-microamp = <256000>; >> + charge-term-current-microamp = <128000>; >> + // etc. >> + }; >> + >> + bq24190: charger@6a { >> + compatible = "ti,bq24190"; >> + reg = <0x6a>; >> + interrupts-extended = <&gpiochip 10 IRQ_TYPE_EDGE_FALLING>; >> + monitored-battery = <&bat>; >> + ti,system-minimum-microvolt = <3200000>; >> + }; >> + >> + &twl_gpio { >> + otg { >> + gpio-hog; >> + gpios = <6 0>; >> + output-high; >> + line-name = "otg-gpio"; >> + }; >> + }; >> -- >> 2.13.2 >> ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/5] devicetree: power: Add docs for TI BQ24190 battery charger 2017-08-11 21:57 ` Liam Breck @ 2017-08-12 16:42 ` Sebastian Reichel 2017-08-12 19:00 ` Liam Breck 0 siblings, 1 reply; 11+ messages in thread From: Sebastian Reichel @ 2017-08-12 16:42 UTC (permalink / raw) To: Liam Breck Cc: Rob Herring, linux-pm, Tony Lindgren, Hans de Goede, devicetree, Liam Breck [-- Attachment #1: Type: text/plain, Size: 2816 bytes --] Hi, On Fri, Aug 11, 2017 at 02:57:10PM -0700, Liam Breck wrote: > On Thu, Aug 10, 2017 at 7:50 PM, Rob Herring <robh@kernel.org> wrote: > > On Mon, Aug 07, 2017 at 12:54:17PM -0700, Liam Breck wrote: > >> From: Liam Breck <kernel@networkimprov.net> > >> > >> Document monitored-battery and ti,system-minimum-microvolt properties. > >> > >> Cc: Rob Herring <robh@kernel.org> > >> Cc: devicetree@vger.kernel.org > >> Signed-off-by: Liam Breck <kernel@networkimprov.net> > >> --- > >> .../devicetree/bindings/power/supply/bq24190.txt | 49 ++++++++++++++++++++++ > >> 1 file changed, 49 insertions(+) > >> create mode 100644 Documentation/devicetree/bindings/power/supply/bq24190.txt > >> > >> diff --git a/Documentation/devicetree/bindings/power/supply/bq24190.txt b/Documentation/devicetree/bindings/power/supply/bq24190.txt > >> new file mode 100644 > >> index 00000000..82a1c842 > >> --- /dev/null > >> +++ b/Documentation/devicetree/bindings/power/supply/bq24190.txt > >> @@ -0,0 +1,49 @@ > >> +TI BQ24190 Li-Ion Battery Charger > >> + > >> +Required properties: > >> +- compatible: contains one of the following: > >> + * "ti,bq24190" > >> + * "ti,bq24192i" > >> +- reg: integer, I2C address of the charger. > >> +- interrupts[-extended]: configuration for charger INT pin. > >> + > >> +Optional properties: > >> +- monitored-battery: phandle of battery characteristics devicetree node > >> + The charger uses the following battery properties: > >> + + precharge-current-microamp: maximum charge current during precharge > >> + phase (typically 20% of battery capacity). > >> + + charge-term-current-microamp: a charge cycle terminates when the > >> + battery voltage is above recharge threshold, and the current is below > >> + this setting (typically 10% of battery capacity). > >> + See Documentation/devicetree/bindings/power/supply/battery.txt > >> +- ti,system-minimum-microvolt: when power is connected and the battery is below > >> + minimum system voltage, the system will be regulated above this setting. > >> + > >> +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. -- Sebastian [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/5] devicetree: power: Add docs for TI BQ24190 battery charger 2017-08-12 16:42 ` Sebastian Reichel @ 2017-08-12 19:00 ` Liam Breck [not found] ` <CAKvHMgR+GxSqhy+iwdYmku2600HzoF__oXV7_w72ZJg-aK7O-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 11+ messages in thread From: Liam Breck @ 2017-08-12 19:00 UTC (permalink / raw) To: Sebastian Reichel Cc: Rob Herring, linux-pm-u79uwXL29TY76Z2rM5mHXA, Tony Lindgren, Hans de Goede, devicetree-u79uwXL29TY76Z2rM5mHXA, Liam Breck Hi Sebastian, On Sat, Aug 12, 2017 at 9:42 AM, Sebastian Reichel <sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote: > Hi, > > On Fri, Aug 11, 2017 at 02:57:10PM -0700, Liam Breck wrote: >> On Thu, Aug 10, 2017 at 7:50 PM, Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote: >> > On Mon, Aug 07, 2017 at 12:54:17PM -0700, Liam Breck wrote: >> >> From: Liam Breck <kernel-RYWXG+zxWwBdeoIcmNTgJF6hYfS7NtTn@public.gmane.org> >> >> >> >> Document monitored-battery and ti,system-minimum-microvolt properties. >> >> >> >> Cc: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> >> >> Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org >> >> Signed-off-by: Liam Breck <kernel-RYWXG+zxWwBdeoIcmNTgJF6hYfS7NtTn@public.gmane.org> >> >> --- >> >> .../devicetree/bindings/power/supply/bq24190.txt | 49 ++++++++++++++++++++++ >> >> 1 file changed, 49 insertions(+) >> >> create mode 100644 Documentation/devicetree/bindings/power/supply/bq24190.txt >> >> >> >> diff --git a/Documentation/devicetree/bindings/power/supply/bq24190.txt b/Documentation/devicetree/bindings/power/supply/bq24190.txt >> >> new file mode 100644 >> >> index 00000000..82a1c842 >> >> --- /dev/null >> >> +++ b/Documentation/devicetree/bindings/power/supply/bq24190.txt >> >> @@ -0,0 +1,49 @@ >> >> +TI BQ24190 Li-Ion Battery Charger >> >> + >> >> +Required properties: >> >> +- compatible: contains one of the following: >> >> + * "ti,bq24190" >> >> + * "ti,bq24192i" >> >> +- reg: integer, I2C address of the charger. >> >> +- interrupts[-extended]: configuration for charger INT pin. >> >> + >> >> +Optional properties: >> >> +- monitored-battery: phandle of battery characteristics devicetree node >> >> + The charger uses the following battery properties: >> >> + + precharge-current-microamp: maximum charge current during precharge >> >> + phase (typically 20% of battery capacity). >> >> + + charge-term-current-microamp: a charge cycle terminates when the >> >> + battery voltage is above recharge threshold, and the current is below >> >> + this setting (typically 10% of battery capacity). >> >> + See Documentation/devicetree/bindings/power/supply/battery.txt >> >> +- ti,system-minimum-microvolt: when power is connected and the battery is below >> >> + minimum system voltage, the system will be regulated above this setting. >> >> + >> >> +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. Tony & Matt & I discussed this at some length off-list. -- 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <CAKvHMgR+GxSqhy+iwdYmku2600HzoF__oXV7_w72ZJg-aK7O-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH v2 2/5] devicetree: power: Add docs for TI BQ24190 battery charger [not found] ` <CAKvHMgR+GxSqhy+iwdYmku2600HzoF__oXV7_w72ZJg-aK7O-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2017-08-16 15:47 ` Tony Lindgren 2017-08-16 20:11 ` Liam Breck 0 siblings, 1 reply; 11+ messages in thread From: Tony Lindgren @ 2017-08-16 15:47 UTC (permalink / raw) To: Liam Breck Cc: Sebastian Reichel, Rob Herring, linux-pm-u79uwXL29TY76Z2rM5mHXA, Hans de Goede, devicetree-u79uwXL29TY76Z2rM5mHXA, Liam Breck * Liam Breck <liam-RYWXG+zxWwBdeoIcmNTgJF6hYfS7NtTn@public.gmane.org> [170812 12:00]: > On Sat, Aug 12, 2017 at 9:42 AM, Sebastian Reichel <sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> 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. 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/5] devicetree: power: Add docs for TI BQ24190 battery charger 2017-08-16 15:47 ` Tony Lindgren @ 2017-08-16 20:11 ` Liam Breck [not found] ` <CAKvHMgTvVMsvmyi0o89m1SfS9A4U1GbNuU05Tkt6C0ARR9NyWw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 11+ messages in thread From: Liam Breck @ 2017-08-16 20:11 UTC (permalink / raw) To: Tony Lindgren Cc: Sebastian Reichel, Rob Herring, linux-pm, Hans de Goede, devicetree, Liam Breck On Wed, Aug 16, 2017 at 8:47 AM, Tony Lindgren <tony@atomide.com> wrote: > * Liam Breck <liam@networkimprov.net> [170812 12:00]: >> On Sat, Aug 12, 2017 at 9:42 AM, Sebastian Reichel <sre@kernel.org> 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. 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. ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <CAKvHMgTvVMsvmyi0o89m1SfS9A4U1GbNuU05Tkt6C0ARR9NyWw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH v2 2/5] devicetree: power: Add docs for TI BQ24190 battery charger [not found] ` <CAKvHMgTvVMsvmyi0o89m1SfS9A4U1GbNuU05Tkt6C0ARR9NyWw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2017-08-16 21:06 ` Tony Lindgren 2017-08-16 21:16 ` Liam Breck 0 siblings, 1 reply; 11+ messages in thread From: Tony Lindgren @ 2017-08-16 21:06 UTC (permalink / raw) To: Liam Breck Cc: Sebastian Reichel, Rob Herring, linux-pm-u79uwXL29TY76Z2rM5mHXA, Hans de Goede, devicetree-u79uwXL29TY76Z2rM5mHXA, Liam Breck * Liam Breck <liam-RYWXG+zxWwBdeoIcmNTgJF6hYfS7NtTn@public.gmane.org> [170816 13:11]: > On Wed, Aug 16, 2017 at 8:47 AM, Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> wrote: > > * Liam Breck <liam-RYWXG+zxWwBdeoIcmNTgJF6hYfS7NtTn@public.gmane.org> [170812 12:00]: > >> On Sat, Aug 12, 2017 at 9:42 AM, Sebastian Reichel <sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/5] devicetree: power: Add docs for TI BQ24190 battery charger 2017-08-16 21:06 ` Tony Lindgren @ 2017-08-16 21:16 ` Liam Breck [not found] ` <CAKvHMgTJjTxffoP4Kt=KzGvCQ-BihLeQn3i4TaF4OBSXV7i6TA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 11+ messages in thread From: Liam Breck @ 2017-08-16 21:16 UTC (permalink / raw) To: Tony Lindgren Cc: Sebastian Reichel, Rob Herring, linux-pm, Hans de Goede, devicetree, Liam Breck On Wed, Aug 16, 2017 at 2:06 PM, Tony Lindgren <tony@atomide.com> wrote: > * Liam Breck <liam@networkimprov.net> [170816 13:11]: >> On Wed, Aug 16, 2017 at 8:47 AM, Tony Lindgren <tony@atomide.com> wrote: >> > * Liam Breck <liam@networkimprov.net> [170812 12:00]: >> >> On Sat, Aug 12, 2017 at 9:42 AM, Sebastian Reichel <sre@kernel.org> 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? I haven't tried OTG-host on the anvl yet since it requires a special cable. > If the kernel does not need to do anything about it, how about > just leave it out of the binding docs then? It seemed useful to document the OTG pin DT config for boards that have it wired to a gpio... Is that not wise? ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <CAKvHMgTJjTxffoP4Kt=KzGvCQ-BihLeQn3i4TaF4OBSXV7i6TA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH v2 2/5] devicetree: power: Add docs for TI BQ24190 battery charger [not found] ` <CAKvHMgTJjTxffoP4Kt=KzGvCQ-BihLeQn3i4TaF4OBSXV7i6TA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2017-08-18 0:16 ` Tony Lindgren 2017-08-25 20:29 ` Tony Lindgren 1 sibling, 0 replies; 11+ messages in thread From: Tony Lindgren @ 2017-08-18 0:16 UTC (permalink / raw) To: Liam Breck Cc: Sebastian Reichel, Rob Herring, linux-pm-u79uwXL29TY76Z2rM5mHXA, Hans de Goede, devicetree-u79uwXL29TY76Z2rM5mHXA, Liam Breck * Liam Breck <liam-RYWXG+zxWwBdeoIcmNTgJF6hYfS7NtTn@public.gmane.org> [170816 14:16]: > On Wed, Aug 16, 2017 at 2:06 PM, Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> wrote: > > > If the kernel does not need to do anything about it, how about > > just leave it out of the binding docs then? > > It seemed useful to document the OTG pin DT config for boards that > have it wired to a gpio... Is that not wise? Well maybe just add a comment to the driver about it until we know how we want to handle it? 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/5] devicetree: power: Add docs for TI BQ24190 battery charger [not found] ` <CAKvHMgTJjTxffoP4Kt=KzGvCQ-BihLeQn3i4TaF4OBSXV7i6TA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2017-08-18 0:16 ` Tony Lindgren @ 2017-08-25 20:29 ` Tony Lindgren 1 sibling, 0 replies; 11+ messages in thread From: Tony Lindgren @ 2017-08-25 20:29 UTC (permalink / raw) To: Liam Breck Cc: Sebastian Reichel, Rob Herring, linux-pm-u79uwXL29TY76Z2rM5mHXA, Hans de Goede, devicetree-u79uwXL29TY76Z2rM5mHXA, Liam Breck * Liam Breck <liam-RYWXG+zxWwBdeoIcmNTgJF6hYfS7NtTn@public.gmane.org> [170816 14:16]: > On Wed, Aug 16, 2017 at 2:06 PM, Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> wrote: > > If the kernel does not need to do anything about it, how about > > just leave it out of the binding docs then? > > It seemed useful to document the OTG pin DT config for boards that > have it wired to a gpio... Is that not wise? Well maybe add it as a note to the description rather than a binding. It might be actually best to document it in both places. 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2017-08-25 20:29 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <20170807195420.20767-1-liam@networkimprov.net> 2017-08-07 19:54 ` [PATCH v2 2/5] devicetree: power: Add docs for TI BQ24190 battery charger Liam Breck [not found] ` <20170807195420.20767-3-liam-RYWXG+zxWwBdeoIcmNTgJF6hYfS7NtTn@public.gmane.org> 2017-08-11 2:50 ` Rob Herring 2017-08-11 21:57 ` Liam Breck 2017-08-12 16:42 ` Sebastian Reichel 2017-08-12 19:00 ` Liam Breck [not found] ` <CAKvHMgR+GxSqhy+iwdYmku2600HzoF__oXV7_w72ZJg-aK7O-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2017-08-16 15:47 ` Tony Lindgren 2017-08-16 20:11 ` Liam Breck [not found] ` <CAKvHMgTvVMsvmyi0o89m1SfS9A4U1GbNuU05Tkt6C0ARR9NyWw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2017-08-16 21:06 ` Tony Lindgren 2017-08-16 21:16 ` Liam Breck [not found] ` <CAKvHMgTJjTxffoP4Kt=KzGvCQ-BihLeQn3i4TaF4OBSXV7i6TA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2017-08-18 0:16 ` Tony Lindgren 2017-08-25 20:29 ` Tony Lindgren
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).