Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPI / battery: Add a blacklist with PMIC ACPI HIDs with a native battery driver

On some systems we have a native PMIC driver which provides battery
monitoring, while the ACPI battery driver is broken on these systems
due to bad DSDTs or because we do not support the proprietary and
undocumented ACPI opregions these ACPI battery devices rely on
(e.g. BMOP opregion).

This leads to there being 2 battery power_supply-s registed like this:

~$ acpi
Battery 0: Charging, 84%, 00:49:39 until charged
Battery 1: Unknown, 0%, rate information unavailable

Even if the ACPI battery where to function fine (which on systems
where we have a native PMIC driver it often doesn't) we still do not
want to export the same battery to userspace twice.

This commit adds a blacklist with PMIC ACPI HIDs for which we've a
native battery driver and makes the ACPI battery driver not register
itself when a PMIC on this list is present.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=194811
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Hans de Goede and committed by
Rafael J. Wysocki
dccfae6d bc39fbcf

+14
+14
drivers/acpi/battery.c
··· 94 94 95 95 MODULE_DEVICE_TABLE(acpi, battery_device_ids); 96 96 97 + /* Lists of PMIC ACPI HIDs with an (often better) native battery driver */ 98 + static const char * const acpi_battery_blacklist[] = { 99 + "INT33F4", /* X-Powers AXP288 PMIC */ 100 + }; 101 + 97 102 enum { 98 103 ACPI_BATTERY_ALARM_PRESENT, 99 104 ACPI_BATTERY_XINFO_PRESENT, ··· 1321 1316 1322 1317 static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie) 1323 1318 { 1319 + unsigned int i; 1324 1320 int result; 1321 + 1322 + for (i = 0; i < ARRAY_SIZE(acpi_battery_blacklist); i++) 1323 + if (acpi_dev_present(acpi_battery_blacklist[i], "1", -1)) { 1324 + pr_info(PREFIX ACPI_BATTERY_DEVICE_NAME 1325 + ": found native %s PMIC, not loading\n", 1326 + acpi_battery_blacklist[i]); 1327 + return; 1328 + } 1325 1329 1326 1330 dmi_check_system(bat_dmi_table); 1327 1331