summaryrefslogtreecommitdiff
path: root/drivers/acpi/battery.c
diff options
context:
space:
mode:
authorCarlo Caione <carlo@endlessm.com>2018-04-18 14:04:39 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-05-10 16:59:48 +0200
commitec625a37c10c64681c00459912ce7318e133bf7a (patch)
tree5d7be3fbdbe3290a11bdf62cc79631e0b1af4f77 /drivers/acpi/battery.c
parent1b799c5cf031c2b615f4b21150eafde3ff227788 (diff)
downloadlwn-ec625a37c10c64681c00459912ce7318e133bf7a.tar.gz
lwn-ec625a37c10c64681c00459912ce7318e133bf7a.zip
ACPI / battery: Add quirk to avoid checking for PMIC with native driver
With commit dccfae6d4f4c (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. [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>
Diffstat (limited to 'drivers/acpi/battery.c')
-rw-r--r--drivers/acpi/battery.c42
1 files changed, 34 insertions, 8 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index c63b6a14ad95..572845fafb00 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -75,6 +75,7 @@ static bool battery_driver_registered;
static int battery_bix_broken_package;
static int battery_notification_delay_ms;
static int battery_ac_is_broken;
+static int battery_check_pmic = 1;
static unsigned int cache_time = 1000;
module_param(cache_time, uint, 0644);
MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
@@ -1354,6 +1355,13 @@ battery_ac_is_broken_quirk(const struct dmi_system_id *d)
return 0;
}
+static int __init
+battery_do_not_check_pmic_quirk(const struct dmi_system_id *d)
+{
+ battery_check_pmic = 0;
+ return 0;
+}
+
static const struct dmi_system_id bat_dmi_table[] __initconst = {
{
/* NEC LZ750/LS */
@@ -1382,6 +1390,22 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = {
DMI_MATCH(DMI_BIOS_DATE, "08/22/2014"),
},
},
+ {
+ /* ECS EF20EA */
+ .callback = battery_do_not_check_pmic_quirk,
+ .matches = {
+ DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
+ },
+ },
+ {
+ /* Lenovo Ideapad Miix 320 */
+ .callback = battery_do_not_check_pmic_quirk,
+ .matches = {
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "80XF"),
+ DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
+ },
+ },
{},
};
@@ -1521,16 +1545,18 @@ static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie)
unsigned int i;
int result;
- for (i = 0; i < ARRAY_SIZE(acpi_battery_blacklist); i++)
- if (acpi_dev_present(acpi_battery_blacklist[i], "1", -1)) {
- pr_info(PREFIX ACPI_BATTERY_DEVICE_NAME
- ": found native %s PMIC, not loading\n",
- acpi_battery_blacklist[i]);
- return;
- }
-
dmi_check_system(bat_dmi_table);
+ if (battery_check_pmic) {
+ for (i = 0; i < ARRAY_SIZE(acpi_battery_blacklist); i++)
+ if (acpi_dev_present(acpi_battery_blacklist[i], "1", -1)) {
+ pr_info(PREFIX ACPI_BATTERY_DEVICE_NAME
+ ": found native %s PMIC, not loading\n",
+ acpi_battery_blacklist[i]);
+ return;
+ }
+ }
+
#ifdef CONFIG_ACPI_PROCFS_POWER
acpi_battery_dir = acpi_lock_battery_dir();
if (!acpi_battery_dir)