power: supply: bq25890: Add support for having a secondary charger IC
authorHans de Goede <hdegoede@redhat.com>
Wed, 25 Jan 2023 10:58:49 +0000 (11:58 +0100)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Sat, 28 Jan 2023 17:07:21 +0000 (18:07 +0100)
commitd54bf877fd878ee45cbc88d399fb98b0b1c4484d
tree2447e32a9ebece980942b1debdcf1d5ba37addce
parent4e9498b835ab31b83fc32fae4f77426f668010ac
power: supply: bq25890: Add support for having a secondary charger IC

Some devices, such as the Lenovo Yoga Tab 3 Pro (YT3-X90F) have multiple
batteries with a separate bq25890 charger for each battery.

This requires some coordination between the chargers specifically
the main charger needs to put the secondary charger in Hi-Z mode when:

1. Enabling its 5V boost (OTG) output to power an external USB device,
   to avoid the secondary charger IC seeing this as external Vbus and
   then trying to charge the secondary battery from this.

2. Talking the Pump Express protocol to increase the external Vbus voltage.
   Having the secondary charger drawing current when the main charger is
   trying to talk the Pump Express protocol results in the external Vbus
   voltage not being raised.

Add a new "linux,secondary-charger-name" string device-property, which
can be set to the power_supply class device's name of the secondary
charger when there is a secondary charger; and make the Vbus regulator and
Pump Express code put the secondary charger in Hi-Z mode when necessary.

So far this new property is only used on x86/ACPI (non devicetree) devs,
IOW it is not used in actual devicetree files. The devicetree-bindings
maintainers have requested properties like these to not be added to the
devicetree-bindings, so the new property is deliberately not added
to the existing devicetree-bindings.

Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/bq25890_charger.c