linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 00/20] power-suppy/i2c/extcon: Fix charger setup on Xiaomi Mi Pad 2 and Lenovo Yogabook
@ 2021-12-06  9:32 Hans de Goede
  2021-12-06  9:32 ` [PATCH v4 01/20] power: supply: core: Refactor power_supply_set_input_current_limit_from_supplier() Hans de Goede
                   ` (19 more replies)
  0 siblings, 20 replies; 31+ messages in thread
From: Hans de Goede @ 2021-12-06  9:32 UTC (permalink / raw)
  To: Rafael J . Wysocki, Mika Westerberg, Mark Gross, Andy Shevchenko,
	Wolfram Sang, Lee Jones, Sebastian Reichel, MyungJoo Ham,
	Chanwoo Choi, Ard Biesheuvel
  Cc: Hans de Goede, Len Brown, linux-acpi, Yauhen Kharuzhy,
	Tsuchiya Yuto, platform-driver-x86, linux-pm, linux-kernel,
	linux-efi

Hi All,

Here is v4 of my patch series to fix the charger setup on Xiaomi Mi Pad 2
and Lenovo Yogabook devices, as well as fix host/device mode switching.

Changes in v4:
 - Rebased on top of "power: bq25890: add POWER_SUPPLY_PROP_TEMP"
 - Add Lee to the "To" address-list for this series
 - Addressed a few small comments from Lee on the
   "mfd: intel_soc_pmic_chtwc: Add cht_wc_model data to struct intel_soc_pmic" patch

I believe that this is ready for merging now.

Since some of the later patches depend on some of the power_supply changes;
and since the Whiskey Cove MFD and cell drivers generally do not see much
changes I believe that it would be best to merge the entire series through
Sebastian's linux-power-supply tree. Wolfram has already given his ack
for merging the i2c-cht-wc patch through another tree.

Lee and Chanwoo, may we please have your Ack for merging this
entire series through Sebastian's linux-power-supply tree?

###

For more details on this series, here is some info from the v2
cover-letter:

So far almost all the kernel code surrounding the Cherry Trail Whiskey Cove
PMIC has been developed on the GPD win / pocket devices and it has various
assumption based on that. In the mean time I've learned (and gotten access
to) about 2 more designs and none of the 3 now known designs use a single
standard setup for the charger, fuel-gauge and other chips surrounding the
PMIC / charging+data USB port:

1. The GPD Win and GPD Pocket mini-laptops, these are really 2 models
but the Pocket re-uses the GPD Win's design in a different housing:

The WC PMIC is connected to a TI BQ24292i charger, paired with
a Maxim MAX17047 fuelgauge + a FUSB302 USB Type-C Controller +
a PI3USB30532 USB switch, for a fully functional Type-C port.

2. The Xiaomi Mi Pad 2:

The WC PMIC is connected to a TI BQ25890 charger, paired with
a TI BQ27520 fuelgauge, using the TI BQ25890 for BC1.2 charger type
detection, for a USB-2 only Type-C port without PD.

3. The Lenovo Yoga Book YB1-X90 / Lenovo Yoga Book YB1-X91 series:

The WC PMIC is connected to a TI BQ25892 charger, paired with
a TI BQ27542 fuelgauge, using the WC PMIC for BC1.2 charger type
detection and using the BQ25892's Mediatek Pump Express+ (1.0)


Unlike what is normal on X86 this diversity in designs is not handled /
abstracted away by the ACPI tables.

This series takes care of making sure that charging and device/host mode
switching also works on the Xiaomi Mi Pad 2 and the Lenovo Yogabook.

Patches  1-13: Prepare the bq25890 power_supply driver to fully support
               the Mi Pad 2 and the Yogabook. Note this includes a new
               version of 2 bq25890 patches send earlier by Yauhen Kharuzhy
Patch 14:      Adds the intel_cht_wc_get_model() helper
Patch 15:      Uses this intel_cht_wc_get_model() value to instantiate an
               i2c-client with the right type and properties for the charger
               IC used on the board (instead of harcoding the GPD values)
Patches 16-20: Modify the extcon code to provide charger-detection results
               to the charger driver and to take care of the Vbus boost
               regulator control (for host-mode) and device/host mode
               switching

I've tried to keep the power_supply patches as generic as possible while
focussing some of the special handling these boards need in the
WC PMIC MFD and cell drivers, which will only get loaded on these boards.

Regards,

Hans


Hans de Goede (17):
  power: supply: core: Refactor
    power_supply_set_input_current_limit_from_supplier()
  power: supply: bq25890: Add a bq25890_rw_init_data() helper
  power: supply: bq25890: Add support to skip reset at probe() /
    remove()
  power: supply: bq25890: Add support to read back the settings from the
    chip
  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
  power: supply: bq25890: On the bq25892 set the IINLIM based on
    external charger detection
  power: supply: bq25890: Use the devm_regmap_field_bulk_alloc() helper
  mfd: intel_soc_pmic_chtwc: Add cht_wc_model data to struct
    intel_soc_pmic
  i2c: cht-wc: Make charger i2c-client instantiation board/device-model
    specific
  extcon: intel-cht-wc: Use new cht_wc_model intel_soc_pmic field
  extcon: intel-cht-wc: Support devs with Micro-B / USB-2 only Type-C
    connectors
  extcon: intel-cht-wc: Refactor cht_wc_extcon_get_charger()
  extcon: intel-cht-wc: Add support for registering a power_supply
    class-device
  extcon: intel-cht-wc: Report RID_A for ACA adapters

Yauhen Kharuzhy (3):
  power: supply: bq25890: Rename IILIM field to IINLIM
  power: supply: bq25890: Reduce reported CONSTANT_CHARGE_CURRENT_MAX
    for low temperatures
  power: supply: bq25890: Support higher charging voltages through Pump
    Express+ protocol

 drivers/extcon/Kconfig                   |   2 +
 drivers/extcon/extcon-intel-cht-wc.c     | 240 ++++++++++++--
 drivers/i2c/busses/i2c-cht-wc.c          | 120 +++++--
 drivers/mfd/intel_soc_pmic_chtwc.c       |  40 +++
 drivers/power/supply/bq24190_charger.c   |  10 +-
 drivers/power/supply/bq25890_charger.c   | 396 ++++++++++++++++++-----
 drivers/power/supply/power_supply_core.c |  57 ++--
 include/linux/mfd/intel_soc_pmic.h       |   8 +
 include/linux/power/bq25890_charger.h    |  15 +
 include/linux/power_supply.h             |   5 +-
 10 files changed, 742 insertions(+), 151 deletions(-)
 create mode 100644 include/linux/power/bq25890_charger.h

-- 
2.33.1


^ permalink raw reply	[flat|nested] 31+ messages in thread
* [PATCH v4 resend 00/20] power-suppy/i2c/extcon: Fix charger setup on Xiaomi Mi Pad 2 and Lenovo Yogabook
@ 2022-01-30 20:45 Hans de Goede
  2022-01-30 20:45 ` [PATCH v4 08/20] power: supply: bq25890: Drop dev->platform_data == NULL check Hans de Goede
  0 siblings, 1 reply; 31+ messages in thread
From: Hans de Goede @ 2022-01-30 20:45 UTC (permalink / raw)
  To: Rafael J . Wysocki, Mika Westerberg, Mark Gross, Andy Shevchenko,
	Wolfram Sang, Lee Jones, Sebastian Reichel, MyungJoo Ham,
	Chanwoo Choi, Ard Biesheuvel
  Cc: Hans de Goede, Len Brown, linux-acpi, Yauhen Kharuzhy,
	Tsuchiya Yuto, Fabio Aiuto, platform-driver-x86, linux-pm,
	linux-kernel, linux-efi

Hi Sebastian,

Here is a resend of v4 of my patch series to fix the charger setup on
Xiaomi Mi Pad 2 and Lenovo Yogabook devices, as well as fix host/device
mode switching.

I'm resending this because this has not made it into 5.17, this resend has
been rebased on top of 5.17-rc1.

Since patches 14-20 rely on the power-supply changes from patch 1-13 and
since they all touch files which generally do not see much changes, the
intention is for this entire series to be merged through your (Sebastian's)
linux-power-supply tree. Patches 14-20 all have ackes from the relevant
subsystem maintainers for merging them through the linux-power-supply tree.

###

For more details on this series, here is some info from the v2
cover-letter:

So far almost all the kernel code surrounding the Cherry Trail Whiskey Cove
PMIC has been developed on the GPD win / pocket devices and it has various
assumption based on that. In the mean time I've learned (and gotten access
to) about 2 more designs and none of the 3 now known designs use a single
standard setup for the charger, fuel-gauge and other chips surrounding the
PMIC / charging+data USB port:

1. The GPD Win and GPD Pocket mini-laptops, these are really 2 models
but the Pocket re-uses the GPD Win's design in a different housing:

The WC PMIC is connected to a TI BQ24292i charger, paired with
a Maxim MAX17047 fuelgauge + a FUSB302 USB Type-C Controller +
a PI3USB30532 USB switch, for a fully functional Type-C port.

2. The Xiaomi Mi Pad 2:

The WC PMIC is connected to a TI BQ25890 charger, paired with
a TI BQ27520 fuelgauge, using the TI BQ25890 for BC1.2 charger type
detection, for a USB-2 only Type-C port without PD.

3. The Lenovo Yoga Book YB1-X90 / Lenovo Yoga Book YB1-X91 series:

The WC PMIC is connected to a TI BQ25892 charger, paired with
a TI BQ27542 fuelgauge, using the WC PMIC for BC1.2 charger type
detection and using the BQ25892's Mediatek Pump Express+ (1.0)


Unlike what is normal on X86 this diversity in designs is not handled /
abstracted away by the ACPI tables.

This series takes care of making sure that charging and device/host mode
switching also works on the Xiaomi Mi Pad 2 and the Lenovo Yogabook.

Patches  1-13: Prepare the bq25890 power_supply driver to fully support
               the Mi Pad 2 and the Yogabook. Note this includes a new
               version of 2 bq25890 patches send earlier by Yauhen Kharuzhy
Patch 14:      Adds the intel_cht_wc_get_model() helper
Patch 15:      Uses this intel_cht_wc_get_model() value to instantiate an
               i2c-client with the right type and properties for the charger
               IC used on the board (instead of harcoding the GPD values)
Patches 16-20: Modify the extcon code to provide charger-detection results
               to the charger driver and to take care of the Vbus boost
               regulator control (for host-mode) and device/host mode
               switching

I've tried to keep the power_supply patches as generic as possible while
focussing some of the special handling these boards need in the
WC PMIC MFD and cell drivers, which will only get loaded on these boards.

Regards,

Hans

p.s.

Sebastian, I also have another power-supply series pending
for merging into -next:
https://lore.kernel.org/linux-pm/20220106110608.66231-1-hdegoede@redhat.com/


Hans de Goede (17):
  power: supply: core: Refactor
    power_supply_set_input_current_limit_from_supplier()
  power: supply: bq25890: Add a bq25890_rw_init_data() helper
  power: supply: bq25890: Add support to skip reset at probe() /
    remove()
  power: supply: bq25890: Add support to read back the settings from the
    chip
  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
  power: supply: bq25890: On the bq25892 set the IINLIM based on
    external charger detection
  power: supply: bq25890: Use the devm_regmap_field_bulk_alloc() helper
  mfd: intel_soc_pmic_chtwc: Add cht_wc_model data to struct
    intel_soc_pmic
  i2c: cht-wc: Make charger i2c-client instantiation board/device-model
    specific
  extcon: intel-cht-wc: Use new cht_wc_model intel_soc_pmic field
  extcon: intel-cht-wc: Support devs with Micro-B / USB-2 only Type-C
    connectors
  extcon: intel-cht-wc: Refactor cht_wc_extcon_get_charger()
  extcon: intel-cht-wc: Add support for registering a power_supply
    class-device
  extcon: intel-cht-wc: Report RID_A for ACA adapters

Yauhen Kharuzhy (3):
  power: supply: bq25890: Rename IILIM field to IINLIM
  power: supply: bq25890: Reduce reported CONSTANT_CHARGE_CURRENT_MAX
    for low temperatures
  power: supply: bq25890: Support higher charging voltages through Pump
    Express+ protocol

 drivers/extcon/Kconfig                   |   2 +
 drivers/extcon/extcon-intel-cht-wc.c     | 240 ++++++++++++--
 drivers/i2c/busses/i2c-cht-wc.c          | 120 +++++--
 drivers/mfd/intel_soc_pmic_chtwc.c       |  40 +++
 drivers/power/supply/bq24190_charger.c   |  10 +-
 drivers/power/supply/bq25890_charger.c   | 396 ++++++++++++++++++-----
 drivers/power/supply/power_supply_core.c |  57 ++--
 include/linux/mfd/intel_soc_pmic.h       |   8 +
 include/linux/power/bq25890_charger.h    |  15 +
 include/linux/power_supply.h             |   5 +-
 10 files changed, 742 insertions(+), 151 deletions(-)
 create mode 100644 include/linux/power/bq25890_charger.h

-- 
2.33.1


^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2022-01-30 20:47 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-06  9:32 [PATCH v4 00/20] power-suppy/i2c/extcon: Fix charger setup on Xiaomi Mi Pad 2 and Lenovo Yogabook Hans de Goede
2021-12-06  9:32 ` [PATCH v4 01/20] power: supply: core: Refactor power_supply_set_input_current_limit_from_supplier() Hans de Goede
2021-12-06  9:33 ` [PATCH v4 02/20] power: supply: bq25890: Rename IILIM field to IINLIM Hans de Goede
2021-12-06  9:33 ` [PATCH v4 03/20] power: supply: bq25890: Reduce reported CONSTANT_CHARGE_CURRENT_MAX for low temperatures Hans de Goede
2021-12-06  9:33 ` [PATCH v4 04/20] power: supply: bq25890: Add a bq25890_rw_init_data() helper Hans de Goede
2021-12-06  9:33 ` [PATCH v4 05/20] power: supply: bq25890: Add support to skip reset at probe() / remove() Hans de Goede
2021-12-06  9:33 ` [PATCH v4 06/20] power: supply: bq25890: Add support to read back the settings from the chip Hans de Goede
2021-12-06  9:33 ` [PATCH v4 07/20] power: supply: bq25890: Enable charging on boards where we skip reset Hans de Goede
2021-12-06  9:33 ` [PATCH v4 08/20] power: supply: bq25890: Drop dev->platform_data == NULL check Hans de Goede
2021-12-06  9:33 ` [PATCH v4 09/20] power: supply: bq25890: Add bq25890_set_otg_cfg() helper Hans de Goede
2021-12-06  9:33 ` [PATCH v4 10/20] power: supply: bq25890: Add support for registering the Vbus boost converter as a regulator Hans de Goede
2021-12-06  9:33 ` [PATCH v4 11/20] power: supply: bq25890: On the bq25892 set the IINLIM based on external charger detection Hans de Goede
2021-12-06  9:33 ` [PATCH v4 12/20] power: supply: bq25890: Support higher charging voltages through Pump Express+ protocol Hans de Goede
2021-12-06  9:33 ` [PATCH v4 13/20] power: supply: bq25890: Use the devm_regmap_field_bulk_alloc() helper Hans de Goede
2021-12-06  9:33 ` [PATCH v4 14/20] mfd: intel_soc_pmic_chtwc: Add cht_wc_model data to struct intel_soc_pmic Hans de Goede
2021-12-06 19:55   ` Andy Shevchenko
2021-12-06 21:46     ` Hans de Goede
2021-12-06 22:04       ` Andy Shevchenko
2021-12-17 10:09   ` Lee Jones
2021-12-06  9:33 ` [PATCH v4 15/20] i2c: cht-wc: Make charger i2c-client instantiation board/device-model specific Hans de Goede
2021-12-06  9:33 ` [PATCH v4 16/20] extcon: intel-cht-wc: Use new cht_wc_model intel_soc_pmic field Hans de Goede
2021-12-16  2:54   ` Chanwoo Choi
2021-12-06  9:33 ` [PATCH v4 17/20] extcon: intel-cht-wc: Support devs with Micro-B / USB-2 only Type-C connectors Hans de Goede
2021-12-16  2:54   ` Chanwoo Choi
2021-12-06  9:33 ` [PATCH v4 18/20] extcon: intel-cht-wc: Refactor cht_wc_extcon_get_charger() Hans de Goede
2021-12-16  2:54   ` Chanwoo Choi
2021-12-06  9:33 ` [PATCH v4 19/20] extcon: intel-cht-wc: Add support for registering a power_supply class-device Hans de Goede
2021-12-16  2:55   ` Chanwoo Choi
2021-12-06  9:33 ` [PATCH v4 20/20] extcon: intel-cht-wc: Report RID_A for ACA adapters Hans de Goede
2021-12-16  2:55   ` Chanwoo Choi
2022-01-30 20:45 [PATCH v4 resend 00/20] power-suppy/i2c/extcon: Fix charger setup on Xiaomi Mi Pad 2 and Lenovo Yogabook Hans de Goede
2022-01-30 20:45 ` [PATCH v4 08/20] power: supply: bq25890: Drop dev->platform_data == NULL check Hans de Goede

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).