Skip to content

RFC ACPI/power-suppy add fuel-gauge support on cht-wc PMIC without USB-PD support devs

Hans de Goede linux-acpi linux-pm platform-driver-x86 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 RFC Latest2 patches 3 repliesIn review
  2. v1 RFC5 patches 5 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2ACPI / x86: Add PWM2 on the Xiaomi Mi Pad 2 to the always_present listdrivers/acpi/x86/utils.c+5 -01 reply
2/2platform/x86: xiaomi-mipad2: New driver for Xiaomi Mi Pad 2 tabletsdrivers/platform/x86/Kconfig drivers/platform/x86/Makefile drivers/platform/x86/xiaomi-mipad2.c+140 -00 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchRafael J. Wysocki
1/2A-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [RFC v2 0/2] ACPI/power-suppy add fuel-gauge support on cht-wc PMIC without USB-PD support devs

Hi All,

Here is a new RFC to add battery monitoring support on the Xiaomi Mi Pad 2 this implements option 2 of the different options which I gave in v1:
https://lore.kernel.org/platform-driver-x86/[email protected]/

To solve the challenges of getting this to work on this device, as you can see compared to option 1, the first patch has gone from adding 3 separate quirks to adding only one; and the 2 gpiolib-acpi and 2 bq27xxx_battery driver patches are now no longer necessary.

These are now all 4 replaced by a new special xiaomi-mipad2 module under drivers/platform/x86 which uses a DMI modalias to autoload and thus will only be auto-loaded on the actual Mi Pad 2.

I like this option much better then the previous option, but this still a RFC for now, since I would like to also see what is necessary to get everything PMIC / micro-USB connector related to work on the Yoga Book YB1-X91L which is on its way to me.

Regards,

Hans

p.s.

While working on this I realized that there also is a 4th option, which is basically option 1 from the v1 RFC minus the 2 gpiolib-acpi patches.

With the 2nd option (as implemented by this RFC) we leave the _AEI handler in place and run the fuel-gauge without interrupt, we can do the same when marking the fuel-gauge as always present by treating IRQs on ACPI devices the same way as in the max17042_battery code, which has already solved the IRQ problem without disabling the _AEI handler:

		/*
		 * On ACPI systems the IRQ may be handled by ACPI-event code,
		 * so we need to share (if the ACPI code is willing to share).
		 */
		if (acpi_id)
			flags |= IRQF_SHARED | IRQF_PROBE_SHARED;

This is a pretty decent option too, it requires:

1. 2 more always_present quirks in the ACPI scan code which is part of the main kernel image.

2. Patches to the bq27xxx_battery code to support ACPI enumeration.

Hans de Goede (2):
ACPI / x86: Add PWM2 on the Xiaomi Mi Pad 2 to the always_present list platform/x86: xiaomi-mipad2: New driver for Xiaomi Mi Pad 2 tablets

 drivers/acpi/x86/utils.c             |   5 ++
 drivers/platform/x86/Kconfig         |  13 +++
 drivers/platform/x86/Makefile        |   1 +
 drivers/platform/x86/xiaomi-mipad2.c | 126 +++++++++++++++++++++++++++
 4 files changed, 145 insertions(+)
 create mode 100644 drivers/platform/x86/xiaomi-mipad2.c
Signature · 1 line
2.31.1