summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Klausen <kristian@klausen.dk>2020-03-03 19:02:15 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-04-17 16:13:32 +0200
commit1fd821aee741fe2d1348ce52700efa3350325628 (patch)
tree48118ff96a55503f89920521f9df6ed56fc0ede4
parent332ce21eede69c09e673513c2b90f9bbdde2cfb5 (diff)
downloadlinux-rt-1fd821aee741fe2d1348ce52700efa3350325628.tar.gz
platform/x86: asus-wmi: Support laptops where the first battery is named BATT
commit 6b3586d45bba14f6912f37488090c37a3710e7b4 upstream. The WMI method to set the charge threshold does not provide a way to specific a battery, so we assume it is the first/primary battery (by checking if the name is BAT0). On some newer ASUS laptops (Zenbook UM431DA) though, the primary/first battery isn't named BAT0 but BATT, so we need to support that case. Fixes: 7973353e92ee ("platform/x86: asus-wmi: Refactor charge threshold to use the battery hooking API") Cc: stable@vger.kernel.org Signed-off-by: Kristian Klausen <kristian@klausen.dk> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/platform/x86/asus-wmi.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 612ef5526226..01becbe2a9a8 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -426,8 +426,11 @@ static int asus_wmi_battery_add(struct power_supply *battery)
{
/* The WMI method does not provide a way to specific a battery, so we
* just assume it is the first battery.
+ * Note: On some newer ASUS laptops (Zenbook UM431DA), the primary/first
+ * battery is named BATT.
*/
- if (strcmp(battery->desc->name, "BAT0") != 0)
+ if (strcmp(battery->desc->name, "BAT0") != 0 &&
+ strcmp(battery->desc->name, "BATT") != 0)
return -ENODEV;
if (device_create_file(&battery->dev,