diff options
author | Hans de Goede <hdegoede@redhat.com> | 2022-02-24 23:28:05 +0100 |
---|---|---|
committer | Sebastian Reichel <sebastian.reichel@collabora.com> | 2022-02-25 18:04:02 +0100 |
commit | da365db704d290fb4dc4cdbd41f60b0ecec1cc03 (patch) | |
tree | f8c82f8ba310463e55cd3bd172012d2c03dbd798 /drivers/power | |
parent | 00d0566614b7bb7b226cb5a6895b0180ffe6915a (diff) | |
download | linux-da365db704d290fb4dc4cdbd41f60b0ecec1cc03.tar.bz2 |
power: supply: axp288_fuel_gauge: Use acpi_quirk_skip_acpi_ac_and_battery()
Normally the native AXP288 fg/charger drivers are preferred but one some
devices the ACPI drivers should be used instead.
The ACPI battery/ac drivers use the acpi_quirk_skip_acpi_ac_and_battery()
helper to determine if they should skip loading because native fuel-gauge/
charger drivers like the AXP288 drivers will be used.
The new acpi_quirk_skip_acpi_ac_and_battery() helper includes a list of
exceptions for boards where the ACPI drivers should be used instead.
Use this new helper to avoid loading on such boards. Note this requires
adding a Kconfig dependency on ACPI, this is not a problem because ACPI
should be enabled on all boards with an AXP288 PMIC anyways.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/supply/Kconfig | 2 | ||||
-rw-r--r-- | drivers/power/supply/axp288_fuel_gauge.c | 14 |
2 files changed, 9 insertions, 7 deletions
diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig index ce7ecf2c821e..8f9033679f49 100644 --- a/drivers/power/supply/Kconfig +++ b/drivers/power/supply/Kconfig @@ -358,7 +358,7 @@ config AXP288_CHARGER config AXP288_FUEL_GAUGE tristate "X-Powers AXP288 Fuel Gauge" - depends on MFD_AXP20X && IIO && IOSF_MBI + depends on MFD_AXP20X && IIO && IOSF_MBI && ACPI help Say yes here to have support for X-Power power management IC (PMIC) Fuel Gauge. The device provides battery statistics and status diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c index 13be2c1d6528..e9f285dae489 100644 --- a/drivers/power/supply/axp288_fuel_gauge.c +++ b/drivers/power/supply/axp288_fuel_gauge.c @@ -9,6 +9,7 @@ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +#include <linux/acpi.h> #include <linux/dmi.h> #include <linux/module.h> #include <linux/kernel.h> @@ -545,12 +546,6 @@ static const struct dmi_system_id axp288_no_battery_list[] = { }, }, { - /* ECS EF20EA */ - .matches = { - DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"), - }, - }, - { /* Intel Cherry Trail Compute Stick, Windows version */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "Intel"), @@ -673,6 +668,13 @@ static int axp288_fuel_gauge_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int i, pirq, ret; + /* + * Normally the native AXP288 fg/charger drivers are preferred but + * on some devices the ACPI drivers should be used instead. + */ + if (!acpi_quirk_skip_acpi_ac_and_battery()) + return -ENODEV; + if (dmi_check_system(axp288_no_battery_list)) return -ENODEV; |