From: Denis Benato <denis.benato@linux.dev>
To: linux-kernel@vger.kernel.org
Cc: platform-driver-x86@vger.kernel.org,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Luke D . Jones" <luke@ljones.dev>,
"Denis Benato" <benato.denis96@gmail.com>,
"Travers Biddle" <traversbiddle@gmail.com>,
"Denis Benato" <denis.benato@linux.dev>
Subject: [PATCH] platform/x86: asus-wmi: temporarily revert to setting a charge limit
Date: Fri, 10 Jul 2026 16:58:41 +0000 [thread overview]
Message-ID: <20260710165841.59957-1-denis.benato@linux.dev> (raw)
A userspace regression has been observed leaving the battery charging
threshold unconfigured, so while the fix is being shipped revert
the change keeping the infrastructure in place to return to the
preferred behaviour as soon as it's appropriate to do.
Link: https://lore.kernel.org/all/5db117b7-aad1-437f-a3d4-ba7b29fc68b3@redhat.com/
Link: https://gitlab.freedesktop.org/upower/upower/-/work_items/347
Closes: https://lore.kernel.org/all/CABsFS_g+V_Owum6knLhenhM15EXJRrsF0FcLiw30WZxarsTpUA@mail.gmail.com/
Fixes: 186bf9031666 ("platform/x86: asus-wmi: do not enforce a battery charge threshold")
Reported-by: Travers Biddle <traversbiddle@gmail.com>
Signed-off-by: Denis Benato <denis.benato@linux.dev>
---
drivers/platform/x86/asus-wmi.c | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index c7c8fcfc1d72..0adb5cebf523 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -1618,6 +1618,8 @@ static DEVICE_ATTR_RW(charge_control_end_threshold);
static int asus_wmi_battery_add(struct power_supply *battery, struct acpi_battery_hook *hook)
{
+ int ret, rv;
+
/* 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
@@ -1635,12 +1637,30 @@ static int asus_wmi_battery_add(struct power_supply *battery, struct acpi_batter
/* The charge threshold is only reset when the system is power cycled,
* and we can't read the current threshold, however the majority of
- * platforms retains it, therefore signal the threshold as unknown
- * until user explicitly sets it to a new value.
+ * platforms retains it.
+ *
+ * Setting a negative value would signal the threshold as unknown
+ * until user explicitly sets it to a new value, however to avoid
+ * regressing userspace, we initialize it to a value of 100.
*/
- charge_end_threshold = -1;
+ charge_end_threshold = 100;
+ ret = asus_wmi_set_devstate(ASUS_WMI_DEVID_RSOC, charge_end_threshold, &rv);
+ if (ret) {
+ pr_err("Failed to reset battery charge threshold\n");
+ goto asus_wmi_battery_add_err;
+ }
+
+ if (rv != 1) {
+ pr_err("Error in battery charge threshold reset\n");
+ ret = -EIO;
+ goto asus_wmi_battery_add_err;
+ }
return 0;
+asus_wmi_battery_add_err:
+ device_remove_file(&battery->dev,
+ &dev_attr_charge_control_end_threshold);
+ return ret;
}
static int asus_wmi_battery_remove(struct power_supply *battery, struct acpi_battery_hook *hook)
--
2.47.3
next reply other threads:[~2026-07-10 16:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 16:58 Denis Benato [this message]
2026-07-10 17:54 ` [PATCH] platform/x86: asus-wmi: temporarily revert to setting a charge limit Ilpo Järvinen
-- strict thread matches above, loose matches on Subject: below --
2026-06-30 23:09 Denis Benato
2026-07-03 13:30 ` Ilpo Järvinen
2026-07-09 3:52 ` Kate Hsuan
2026-07-10 12:54 ` Denis Benato
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260710165841.59957-1-denis.benato@linux.dev \
--to=denis.benato@linux.dev \
--cc=benato.denis96@gmail.com \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luke@ljones.dev \
--cc=platform-driver-x86@vger.kernel.org \
--cc=traversbiddle@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox