Skip to contentSkip to conversation

platform/x86: asus-wmi: restore battery charge limit support

PATCH In review Luis Miguel Arias 2 participants 2 messages Aug 18 – Sep 17

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: asus-wmi: restore battery charge limit support

On ASUS systems where the charge threshold is supported through ASUS_WMI_DEVID_RSOC, initializing charge_end_threshold to -1 causes the sysfs attribute to return -ENODATA. This makes TLP consider charge threshold support unavailable.

Initialize the cached threshold to 100 instead, allowing userspace to set the desired threshold normally.

Tested on ASUS with TLP 1.8.0:

Before this change:
* charge_end_threshold = -1
* TLP reported no charge threshold support

After this change:
* TLP reports "charge threshold" as supported
* natacpi (asus_wmi) is active
* charge_control_end_threshold can be set to 80%

---
 drivers/platform/x86/asus-wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/asus-wmi.c +1 -1
index 80144c412..87363b198 100644
@@ -1586,7 +1586,7 @@ static int asus_wmi_battery_add(struct power_supply *battery, struct acpi_batter
 	 * platforms retains it, therefore signal the threshold as unknown
 	 * until user explicitly sets it to a new value.
 	 */
-	charge_end_threshold = -1;
+	charge_end_threshold = 100;
 
 	return 0;
 }
Signature · 1 line
2.47.3
maintainer
#1 lore raw
Quoted 29 lines · Luis Miguel Arias

On ASUS systems where the charge threshold is supported through ASUS_WMI_DEVID_RSOC, initializing charge_end_threshold to -1 causes the sysfs attribute to return -ENODATA. This makes TLP consider charge threshold support unavailable.

Initialize the cached threshold to 100 instead, allowing userspace to set the desired threshold normally.

Tested on ASUS with TLP 1.8.0:

Before this change:
* charge_end_threshold = -1
* TLP reported no charge threshold support

After this change:
* TLP reports "charge threshold" as supported
* natacpi (asus_wmi) is active
* charge_control_end_threshold can be set to 80%

---
 drivers/platform/x86/asus-wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/asus-wmi.c +0 -0
index 80144c412..87363b198 100644

drivers/platform/x86/asus-wmi.c static int asus_wmi_battery_add(struct power_supply *battery, struct acpi_batter · line 1589

Quoted 5 lines
drivers/platform/x86/asus-wmi.c +1 -1
@@ -1586,7 +1586,7 @@ static int asus_wmi_battery_add(struct power_supply *battery, struct acpi_batter
 	 * platforms retains it, therefore signal the threshold as unknown
 	 * until user explicitly sets it to a new value.
 	 */
-	charge_end_threshold = -1;
+	charge_end_threshold = 100;

Thank you for the submission but is is already covered by the commit 78bf392ba77d ("platform/x86: asus-wmi: temporarily revert to setting a charge limit").

Signature · 1 line
 i.