Skip to content

Commit ec625a3

Browse files
Carlo Caionerafaeljw
authored andcommitted
ACPI / battery: Add quirk to avoid checking for PMIC with native driver
With commit dccfae6 (ACPI / battery: Add a blacklist with PMIC ACPI HIDs with a native battery driver) a blacklist was introduced to avoid using the ACPI drivers for the battery when a native PMIC driver was already present. While this is in general a good idea (because of broken DSDT or proprietary and undocumented ACPI opregions for the ACPI battery devices) there are some Cherry Trail devices which use a separate FG controller despite the AXP288 having a builtin FG. The net effect of blacklisting the ACPI drivers is that on these devices the battery reporting is broken since the AXP288 PMIC FG bits are not actually used on this hardware. This commit adds a battery_do_not_check_pmic quirk for this and sets this on the 2 devices currently known to use a separate FG controller, the ECS EF20EA and the Lenovo Ideapad Miix 320. [[email protected]: Merge the quirk handling and the adding of the DMI table entry into 1 commit, add a second DMI entry for the Miix 320.] Signed-off-by: Carlo Caione <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 1b799c5 commit ec625a3

File tree

1 file changed

+34
-8
lines changed

1 file changed

+34
-8
lines changed

drivers/acpi/battery.c

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ static bool battery_driver_registered;
7575
static int battery_bix_broken_package;
7676
static int battery_notification_delay_ms;
7777
static int battery_ac_is_broken;
78+
static int battery_check_pmic = 1;
7879
static unsigned int cache_time = 1000;
7980
module_param(cache_time, uint, 0644);
8081
MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
@@ -1354,6 +1355,13 @@ battery_ac_is_broken_quirk(const struct dmi_system_id *d)
13541355
return 0;
13551356
}
13561357

1358+
static int __init
1359+
battery_do_not_check_pmic_quirk(const struct dmi_system_id *d)
1360+
{
1361+
battery_check_pmic = 0;
1362+
return 0;
1363+
}
1364+
13571365
static const struct dmi_system_id bat_dmi_table[] __initconst = {
13581366
{
13591367
/* NEC LZ750/LS */
@@ -1382,6 +1390,22 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = {
13821390
DMI_MATCH(DMI_BIOS_DATE, "08/22/2014"),
13831391
},
13841392
},
1393+
{
1394+
/* ECS EF20EA */
1395+
.callback = battery_do_not_check_pmic_quirk,
1396+
.matches = {
1397+
DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
1398+
},
1399+
},
1400+
{
1401+
/* Lenovo Ideapad Miix 320 */
1402+
.callback = battery_do_not_check_pmic_quirk,
1403+
.matches = {
1404+
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
1405+
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "80XF"),
1406+
DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
1407+
},
1408+
},
13851409
{},
13861410
};
13871411

@@ -1521,16 +1545,18 @@ static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie)
15211545
unsigned int i;
15221546
int result;
15231547

1524-
for (i = 0; i < ARRAY_SIZE(acpi_battery_blacklist); i++)
1525-
if (acpi_dev_present(acpi_battery_blacklist[i], "1", -1)) {
1526-
pr_info(PREFIX ACPI_BATTERY_DEVICE_NAME
1527-
": found native %s PMIC, not loading\n",
1528-
acpi_battery_blacklist[i]);
1529-
return;
1530-
}
1531-
15321548
dmi_check_system(bat_dmi_table);
15331549

1550+
if (battery_check_pmic) {
1551+
for (i = 0; i < ARRAY_SIZE(acpi_battery_blacklist); i++)
1552+
if (acpi_dev_present(acpi_battery_blacklist[i], "1", -1)) {
1553+
pr_info(PREFIX ACPI_BATTERY_DEVICE_NAME
1554+
": found native %s PMIC, not loading\n",
1555+
acpi_battery_blacklist[i]);
1556+
return;
1557+
}
1558+
}
1559+
15341560
#ifdef CONFIG_ACPI_PROCFS_POWER
15351561
acpi_battery_dir = acpi_lock_battery_dir();
15361562
if (!acpi_battery_dir)

0 commit comments

Comments
 (0)