From: Hans de Goede <hdegoede@redhat.com>
To: "Rafael J . Wysocki" <rjw@rjwysocki.net>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Mark Gross <markgross@kernel.org>,
Andy Shevchenko <andy@infradead.org>,
Sebastian Reichel <sre@kernel.org>
Cc: Hans de Goede <hdegoede@redhat.com>, Len Brown <lenb@kernel.org>,
linux-acpi@vger.kernel.org, Yauhen Kharuzhy <jekhor@gmail.com>,
Tsuchiya Yuto <kitakar@gmail.com>,
platform-driver-x86@vger.kernel.org, linux-pm@vger.kernel.org
Subject: [RFC v2 0/2] ACPI/power-suppy add fuel-gauge support on cht-wc PMIC without USB-PD support devs
Date: Tue, 2 Nov 2021 23:39:57 +0100 [thread overview]
Message-ID: <20211102223959.3873-1-hdegoede@redhat.com> (raw)
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
next reply other threads:[~2021-11-02 22:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-02 22:39 Hans de Goede [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211102223959.3873-1-hdegoede@redhat.com \
--to=hdegoede@redhat.com \
--cc=andy@infradead.org \
--cc=jekhor@gmail.com \
--cc=kitakar@gmail.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=markgross@kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=sre@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox