platform-driver-x86.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC v2 0/2] ACPI/power-suppy add fuel-gauge support on cht-wc PMIC without USB-PD support devs
@ 2021-11-02 22:39 Hans de Goede
  2021-11-02 22:39 ` [RFC v2 1/2] ACPI / x86: Add PWM2 on the Xiaomi Mi Pad 2 to the always_present list Hans de Goede
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Hans de Goede @ 2021-11-02 22:39 UTC (permalink / raw)
  To: Rafael J . Wysocki, Mika Westerberg, Mark Gross, Andy Shevchenko,
	Sebastian Reichel
  Cc: Hans de Goede, Len Brown, linux-acpi, Yauhen Kharuzhy,
	Tsuchiya Yuto, platform-driver-x86, linux-pm

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@redhat.com/

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


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

end of thread, other threads:[~2021-11-03 18:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-02 22:39 [RFC v2 0/2] ACPI/power-suppy add fuel-gauge support on cht-wc PMIC without USB-PD support devs Hans de Goede
2021-11-02 22:39 ` [RFC v2 1/2] ACPI / x86: Add PWM2 on the Xiaomi Mi Pad 2 to the always_present list Hans de Goede
2021-11-03 18:21   ` Rafael J. Wysocki
2021-11-02 22:39 ` [RFC v2 2/2] platform/x86: xiaomi-mipad2: New driver for Xiaomi Mi Pad 2 tablets Hans de Goede
2021-11-03  9:18 ` [RFC v2 0/2] ACPI/power-suppy add fuel-gauge support on cht-wc PMIC without USB-PD support devs Andy Shevchenko
2021-11-03 13:24   ` 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).