Skip to content

Commit 91ea5b1

Browse files
Carlo Caionerafaeljw
authored andcommitted
ACPI / AC: Add quirk to avoid checking for PMIC with native driver
With commit af3ec83 (ACPI / AC: Add a blacklist with PMIC ACPI HIDs with a native charger driver) a blacklist was introduced to avoid using the ACPI drivers for AC 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 AC devices) there are some Cherry Trail devices which use a separate charger controller despite the AXP288 having a builtin charger. The net effect of blacklisting the ACPI drivers is that on these devices the AC reporting is broken since the AXP288 PMIC charger bits are not actually used on this hardware. This commit adds an ac_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 75bc37f commit 91ea5b1

File tree

1 file changed

+36
-10
lines changed

1 file changed

+36
-10
lines changed

drivers/acpi/ac.c

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ static int acpi_ac_open_fs(struct inode *inode, struct file *file);
8787

8888

8989
static int ac_sleep_before_get_state_ms;
90+
static int ac_check_pmic = 1;
9091

9192
static struct acpi_driver acpi_ac_driver = {
9293
.name = "ac",
@@ -310,13 +311,19 @@ static int acpi_ac_battery_notify(struct notifier_block *nb,
310311
return NOTIFY_OK;
311312
}
312313

313-
static int thinkpad_e530_quirk(const struct dmi_system_id *d)
314+
static int __init thinkpad_e530_quirk(const struct dmi_system_id *d)
314315
{
315316
ac_sleep_before_get_state_ms = 1000;
316317
return 0;
317318
}
318319

319-
static const struct dmi_system_id ac_dmi_table[] = {
320+
static int __init ac_do_not_check_pmic_quirk(const struct dmi_system_id *d)
321+
{
322+
ac_check_pmic = 0;
323+
return 0;
324+
}
325+
326+
static const struct dmi_system_id ac_dmi_table[] __initconst = {
320327
{
321328
.callback = thinkpad_e530_quirk,
322329
.ident = "thinkpad e530",
@@ -325,6 +332,22 @@ static const struct dmi_system_id ac_dmi_table[] = {
325332
DMI_MATCH(DMI_PRODUCT_NAME, "32597CG"),
326333
},
327334
},
335+
{
336+
/* ECS EF20EA */
337+
.callback = ac_do_not_check_pmic_quirk,
338+
.matches = {
339+
DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
340+
},
341+
},
342+
{
343+
/* Lenovo Ideapad Miix 320 */
344+
.callback = ac_do_not_check_pmic_quirk,
345+
.matches = {
346+
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
347+
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "80XF"),
348+
DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
349+
},
350+
},
328351
{},
329352
};
330353

@@ -384,7 +407,6 @@ static int acpi_ac_add(struct acpi_device *device)
384407
kfree(ac);
385408
}
386409

387-
dmi_check_system(ac_dmi_table);
388410
return result;
389411
}
390412

@@ -442,13 +464,17 @@ static int __init acpi_ac_init(void)
442464
if (acpi_disabled)
443465
return -ENODEV;
444466

445-
for (i = 0; i < ARRAY_SIZE(acpi_ac_blacklist); i++)
446-
if (acpi_dev_present(acpi_ac_blacklist[i].hid, "1",
447-
acpi_ac_blacklist[i].hrv)) {
448-
pr_info(PREFIX "AC: found native %s PMIC, not loading\n",
449-
acpi_ac_blacklist[i].hid);
450-
return -ENODEV;
451-
}
467+
dmi_check_system(ac_dmi_table);
468+
469+
if (ac_check_pmic) {
470+
for (i = 0; i < ARRAY_SIZE(acpi_ac_blacklist); i++)
471+
if (acpi_dev_present(acpi_ac_blacklist[i].hid, "1",
472+
acpi_ac_blacklist[i].hrv)) {
473+
pr_info(PREFIX "AC: found native %s PMIC, not loading\n",
474+
acpi_ac_blacklist[i].hid);
475+
return -ENODEV;
476+
}
477+
}
452478

453479
#ifdef CONFIG_ACPI_PROCFS_POWER
454480
acpi_ac_dir = acpi_lock_ac_dir();

0 commit comments

Comments
 (0)