[PATCH 00/13] power-suppy/i2c/extcon: Add support for cht-wc PMIC without USB-PD support

From: Hans de Goede
Date: Sat Oct 30 2021 - 14:28:48 EST


On many X86 devices with a Cherry Trail SoC the PMIC / battery charger
support is not fully handled by ACPI. Instead we need to load native
drivers for the PMIC and various chips surrounding the PMIC like the
charger IC. So far we mostly support the AXP288 PMIC this way, as well
as the Intel Whiskey Cove PMIC with a FUSB302 Type-C controller + other
ICs for a USB-PD, USB-3 (superspeed) and DP-altmode capable Type-C
connector, as found on the GPD win and GPD pocket mini laptops.

On the Xiaomi Mi Pad 2 tablet the Whiskey Cove PMIC is used in
a different setup then on the GPD devices, supporting only USB-2 with
BC1.2 spec charger detection on its USB connector.

This series adds support for the charger IC in this setup and for having
the extcon-intel-cht-wc code control the 5V Vbus boost converter and
the USB role-switch, which is done by the FUSB302 Type-C controller driver
in the GPD case.

This fixes the tablet not charging under Linux, host-mode only working
when booted in host-mode, as well as device-mode not working. Note
device-mode still does not work when plugged into a CDP port. I have
identified the cause for this and I plan to submit a fix later.

This series consists of the following parts:

Patch 1 + 2: Add a "intel,cht-wc-setup" device property to the Whiskey Cove
i2c-client so that various WC drivers can use this to identify which setup
they are dealing with.

Patch 3 + 4: bq25890 psy driver bug-fixes

Patch 5 - 8: bq25890 psy support for non-devicetree devices

Patch 9 + 10: bq25890 psy support for registering the builtin Vbus boost
converter as a regulator

Patch 11: Add support to the i2c-cht-wc I2C-controller driver to
instantiate an i2c-client for the attached bq25890 charger

Patch 12 + 13: extcon-intel-cht-wc add support for the USB-2 only with
BC1.2 charger detection setup

Assuming everybody is ok with this series, we need to talk about how
to merge this.

Patch 1 makes some very small changes (just a rename) to
drivers/firmware/efi code, I would like to merging this + patch 2 through
the pdx86 tree (where the real changes are). Ard, can I have your ack
for this please ?

Patch 11 depends on a header file added by patch 10, since the
i2c-cht-wc.c code otherwise sees very little changes I believe it makes
sense for patch 11 to be merged into linux-power-supply.git/for-next
together with patches 3-10. Wolfram can we have you ack for this?

Patch 12 + 13 can be merged through the extcon tree, these have no
(compile time) dependencies on the other patches.

This is all 5.17 material, and I will make sure the pdx86 patches
adding the new property will land in 5.17-rc1, hopefully the rest
will land then too, but if other bits land later that is fine too,
as long as the new property is there behavior won't change on the
GPD win/pocket and we won't get any regressions.

Regards,

Hans

p.s.

Patch 3 and 4 are pure bq25890 bugfixes and should probably be picked up
right away independent of the rest of the series.


Hans de Goede (13):
platform/x86: Rename touchscreen_dmi to dmi_device_properties
platform/x86: dmi_device_properties: Add setup info for boards with a
CHT Whiskey Cove PMIC
power: supply: bq25890: Fix race causing oops at boot
power: supply: bq25890: Fix initial setting of the F_CONV_RATE field
power: supply: bq25890: Add a bq25890_rw_init_data() helper
power: supply: bq25890: Add support for skipping initialization
power: supply: bq25890: Enable charging on boards where we skip reset
power: supply: bq25890: Drop dev->platform_data == NULL check
power: supply: bq25890: Add bq25890_set_otg_cfg() helper
power: supply: bq25890: Add support for registering the Vbus boost
converter as a regulator
i2c: cht-wc: Add support for devices using a bq25890 charger
extcon: intel-cht-wc: Check new "intel,cht-wc-setup" device-property
extcon: intel-cht-wc: Add support for devices with an USB-micro-B
connector

MAINTAINERS | 2 +-
drivers/extcon/extcon-intel-cht-wc.c | 119 ++++++++--
drivers/firmware/efi/embedded-firmware.c | 4 +-
drivers/i2c/busses/i2c-cht-wc.c | 77 ++++--
drivers/platform/x86/Kconfig | 20 +-
drivers/platform/x86/Makefile | 2 +-
...chscreen_dmi.c => dmi_device_properties.c} | 54 ++++-
drivers/power/supply/bq25890_charger.c | 223 ++++++++++++------
include/linux/efi_embedded_fw.h | 2 +-
include/linux/power/bq25890_charger.h | 15 ++
10 files changed, 400 insertions(+), 118 deletions(-)
rename drivers/platform/x86/{touchscreen_dmi.c => dmi_device_properties.c} (96%)
create mode 100644 include/linux/power/bq25890_charger.h

--
2.31.1