power: supply: axp288_charger: 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>
This commit is contained in:
Hans de Goede 2022-02-24 23:28:04 +01:00 committed by Sebastian Reichel
parent fdc9ce72cf
commit 00d0566614
2 changed files with 8 additions and 1 deletions

View File

@ -351,7 +351,7 @@ config AXP20X_POWER
config AXP288_CHARGER
tristate "X-Powers AXP288 Charger"
depends on MFD_AXP20X && EXTCON_AXP288 && IOSF_MBI
depends on MFD_AXP20X && EXTCON_AXP288 && IOSF_MBI && ACPI
help
Say yes here to have support X-Power AXP288 power management IC (PMIC)
integrated charger.

View File

@ -838,6 +838,13 @@ static int axp288_charger_probe(struct platform_device *pdev)
struct power_supply_config charger_cfg = {};
unsigned int val;
/*
* 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;
/*
* On some devices the fuelgauge and charger parts of the axp288 are
* not used, check that the fuelgauge is enabled (CC_CTRL != 0).