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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/20211031162428.22368-1-hdegoede@xxxxxxxxxx/

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

-- 
2.31.1




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux