From: Lee Kindness <lee@leekindness.com>
To: platform-driver-x86@vger.kernel.org
Cc: "Corentin Chary" <corentin.chary@gmail.com>,
"Luke D . Jones" <luke@ljones.dev>,
"Denis Benato" <denis.benato@linux.dev>,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
linux-kernel@vger.kernel.org,
"Lee Kindness" <lee@leekindness.com>
Subject: [PATCH] platform/x86: asus-wmi: Accept buffer result from DSTS
Date: Sun, 29 Nov 2026 17:42:13 +0000 [thread overview]
Message-ID: <20261129174213.26021-1-lee@leekindness.com> (raw)
On the ASUS Zenbook S14 UX5406AA (BIOS UX5406AA.310) the WMNB method
returns an 8-byte buffer instead of an integer when DSTS is called for
ASUS_WMI_DEVID_RSOC (0x00120057). The first dword holds the usual status
bits, including ASUS_WMI_DSTS_PRESENCE_BIT, and the second dword holds
the current charge limit:
If ((IIA0 == 0x00120057))
{
Name (BCMV, Buffer (0x08) { ... })
CreateDWordField (BCMV, Zero, BCML)
CreateDWordField (BCMV, 0x04, BCMH)
...
Local0 = 0x00010000
...
BCML = Local0
Return (BCMV)
}
asus_wmi_evaluate_method3() only handles ACPI_TYPE_INTEGER results and
treats anything else as 0. asus_wmi_dev_is_present() therefore reports
RSOC as absent, the battery hook is never registered and
charge_control_end_threshold is not exposed, even though setting the
limit through DEVS works on this machine.
Accept a buffer of at least four bytes and use its first dword as the
result. Integer results are handled as before.
Tested on a UX5406AA: charge_control_end_threshold is now present and
upower/GNOME can set an 80% charge limit.
The firmware analysis and this patch were prepared with the help of an
AI coding assistant (Claude Opus 5.5, Anthropic); see the notes below.
Signed-off-by: Lee Kindness <lee@leekindness.com>
---
drivers/platform/asus/asus-wmi.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/platform/asus/asus-wmi.c b/drivers/platform/asus/asus-wmi.c
index 1b75a2cbc372..257776373e83 100644
--- a/drivers/platform/asus/asus-wmi.c
+++ b/drivers/platform/asus/asus-wmi.c
@@ -41,6 +41,7 @@
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/types.h>
+#include <linux/unaligned.h>
#include <linux/units.h>
#include <acpi/battery.h>
@@ -395,6 +396,14 @@ static int asus_wmi_evaluate_method3(u32 method_id,
obj = (union acpi_object *)output.pointer;
if (obj && obj->type == ACPI_TYPE_INTEGER)
tmp = (u32) obj->integer.value;
+ /*
+ * Some firmware returns a buffer from DSTS instead of an integer, with
+ * the status bits in the first dword, e.g. for ASUS_WMI_DEVID_RSOC on
+ * the Zenbook S14 UX5406AA.
+ */
+ else if (obj && obj->type == ACPI_TYPE_BUFFER &&
+ obj->buffer.length >= sizeof(u32))
+ tmp = get_unaligned_le32(obj->buffer.pointer);
pr_debug("Result: 0x%08x\n", tmp);
if (retval)
base-commit: 61c0dac952b9308884936d05cce97565a5c89af4
--
2.55.0
reply other threads:[~2026-11-29 17:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261129174213.26021-1-lee@leekindness.com \
--to=lee@leekindness.com \
--cc=corentin.chary@gmail.com \
--cc=denis.benato@linux.dev \
--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 \
/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
all inboxes | Powered by JetHome®