aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlo Caione <carlo@endlessm.com>2018-04-18 08:04:40 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-05-10 11:12:39 -0400
commit91ea5b1dd3aedd8bbf710956f219109bbe0c26e0 (patch)
treef12935596243e28cf3d6b434502009bef2065556
parent75bc37fefc4471e718ba8e651aa74673d4e0a9eb (diff)
ACPI / AC: Add quirk to avoid checking for PMIC with native driver
With commit af3ec837b84b (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. [hdegoede@redhat.com: 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 <carlo@endlessm.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/ac.c46
1 files changed, 36 insertions, 10 deletions
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 2d8de2f8c1ed..e3101b1a86a3 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -87,6 +87,7 @@ static int acpi_ac_open_fs(struct inode *inode, struct file *file);
87 87
88 88
89static int ac_sleep_before_get_state_ms; 89static int ac_sleep_before_get_state_ms;
90static int ac_check_pmic = 1;
90 91
91static struct acpi_driver acpi_ac_driver = { 92static struct acpi_driver acpi_ac_driver = {
92 .name = "ac", 93 .name = "ac",
@@ -310,13 +311,19 @@ static int acpi_ac_battery_notify(struct notifier_block *nb,
310 return NOTIFY_OK; 311 return NOTIFY_OK;
311} 312}
312 313
313static int thinkpad_e530_quirk(const struct dmi_system_id *d) 314static int __init thinkpad_e530_quirk(const struct dmi_system_id *d)
314{ 315{
315 ac_sleep_before_get_state_ms = 1000; 316 ac_sleep_before_get_state_ms = 1000;
316 return 0; 317 return 0;
317} 318}
318 319
319static const struct dmi_system_id ac_dmi_table[] = { 320static 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
326static const struct dmi_system_id ac_dmi_table[] __initconst = {
320 { 327 {
321 .callback = thinkpad_e530_quirk, 328 .callback = thinkpad_e530_quirk,
322 .ident = "thinkpad e530", 329 .ident = "thinkpad e530",
@@ -325,6 +332,22 @@ static const struct dmi_system_id ac_dmi_table[] = {
325 DMI_MATCH(DMI_PRODUCT_NAME, "32597CG"), 332 DMI_MATCH(DMI_PRODUCT_NAME, "32597CG"),
326 }, 333 },
327 }, 334 },
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 },
328 {}, 351 {},
329}; 352};
330 353
@@ -384,7 +407,6 @@ end:
384 kfree(ac); 407 kfree(ac);
385 } 408 }
386 409
387 dmi_check_system(ac_dmi_table);
388 return result; 410 return result;
389} 411}
390 412
@@ -442,13 +464,17 @@ static int __init acpi_ac_init(void)
442 if (acpi_disabled) 464 if (acpi_disabled)
443 return -ENODEV; 465 return -ENODEV;
444 466
445 for (i = 0; i < ARRAY_SIZE(acpi_ac_blacklist); i++) 467 dmi_check_system(ac_dmi_table);
446 if (acpi_dev_present(acpi_ac_blacklist[i].hid, "1", 468
447 acpi_ac_blacklist[i].hrv)) { 469 if (ac_check_pmic) {
448 pr_info(PREFIX "AC: found native %s PMIC, not loading\n", 470 for (i = 0; i < ARRAY_SIZE(acpi_ac_blacklist); i++)
449 acpi_ac_blacklist[i].hid); 471 if (acpi_dev_present(acpi_ac_blacklist[i].hid, "1",
450 return -ENODEV; 472 acpi_ac_blacklist[i].hrv)) {
451 } 473 pr_info(PREFIX "AC: found native %s PMIC, not loading\n",
474 acpi_ac_blacklist[i].hid);
475 return -ENODEV;
476 }
477 }
452 478
453#ifdef CONFIG_ACPI_PROCFS_POWER 479#ifdef CONFIG_ACPI_PROCFS_POWER
454 acpi_ac_dir = acpi_lock_ac_dir(); 480 acpi_ac_dir = acpi_lock_ac_dir();