Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

platform/x86: asus-wmi: do not enforce a battery charge threshold

Users are complaining for the battery limit being reset at 100% during
the boot process while the general consensus appears to not apply
unsolicited hardware changes, therefore stop resetting the battery
charge limit at boot and return -ENODATA on charge_end_threshold to
signal for an unknown limit.

Suggested-by: Antheas Kapenekakis <lkml@antheas.dev>
Suggested-by: Derek J. Clark <derekjohn.clark@gmail.com>
Signed-off-by: Denis Benato <denis.benato@linux.dev>
Reviewed-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Antheas Kapenekakis <lkml@antheas.dev>
Link: https://patch.msgid.link/20260304132608.33815-1-denis.benato@linux.dev
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

authored by

Denis Benato and committed by
Ilpo Järvinen
186bf903 dc1ec4fa

+8 -5
+8 -5
drivers/platform/x86/asus-wmi.c
··· 1557 1557 struct device_attribute *attr, 1558 1558 char *buf) 1559 1559 { 1560 - return sysfs_emit(buf, "%d\n", charge_end_threshold); 1560 + if ((charge_end_threshold >= 0) && (charge_end_threshold <= 100)) 1561 + return sysfs_emit(buf, "%d\n", charge_end_threshold); 1562 + 1563 + return -ENODATA; 1561 1564 } 1562 1565 1563 1566 static DEVICE_ATTR_RW(charge_control_end_threshold); ··· 1583 1580 return -ENODEV; 1584 1581 1585 1582 /* The charge threshold is only reset when the system is power cycled, 1586 - * and we can't get the current threshold so let set it to 100% when 1587 - * a battery is added. 1583 + * and we can't read the current threshold, however the majority of 1584 + * platforms retains it, therefore signal the threshold as unknown 1585 + * until user explicitly sets it to a new value. 1588 1586 */ 1589 - asus_wmi_set_devstate(ASUS_WMI_DEVID_RSOC, 100, NULL); 1590 - charge_end_threshold = 100; 1587 + charge_end_threshold = -1; 1591 1588 1592 1589 return 0; 1593 1590 }