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

ACPI / AC: Add a blacklist with PMIC ACPI HIDs with a native charger driver

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

This leads for example to a ADP1 power_supply which reports
itself as always online even if no mains are connected.

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

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
af3ec837 dccfae6d

+20
+20
drivers/acpi/ac.c
··· 57 57 static int acpi_ac_remove(struct acpi_device *device); 58 58 static void acpi_ac_notify(struct acpi_device *device, u32 event); 59 59 60 + struct acpi_ac_bl { 61 + const char *hid; 62 + int hrv; 63 + }; 64 + 60 65 static const struct acpi_device_id ac_device_ids[] = { 61 66 {"ACPI0003", 0}, 62 67 {"", 0}, 63 68 }; 64 69 MODULE_DEVICE_TABLE(acpi, ac_device_ids); 70 + 71 + /* Lists of PMIC ACPI HIDs with an (often better) native charger driver */ 72 + static const struct acpi_ac_bl acpi_ac_blacklist[] = { 73 + { "INT33F4", -1 }, /* X-Powers AXP288 PMIC */ 74 + { "INT34D3", 3 }, /* Intel Cherrytrail Whiskey Cove PMIC */ 75 + }; 65 76 66 77 #ifdef CONFIG_PM_SLEEP 67 78 static int acpi_ac_resume(struct device *dev); ··· 435 424 436 425 static int __init acpi_ac_init(void) 437 426 { 427 + unsigned int i; 438 428 int result; 439 429 440 430 if (acpi_disabled) 441 431 return -ENODEV; 432 + 433 + for (i = 0; i < ARRAY_SIZE(acpi_ac_blacklist); i++) 434 + if (acpi_dev_present(acpi_ac_blacklist[i].hid, "1", 435 + acpi_ac_blacklist[i].hrv)) { 436 + pr_info(PREFIX "AC: found native %s PMIC, not loading\n", 437 + acpi_ac_blacklist[i].hid); 438 + return -ENODEV; 439 + } 442 440 443 441 #ifdef CONFIG_ACPI_PROCFS_POWER 444 442 acpi_ac_dir = acpi_lock_ac_dir();