From: Denis Benato <denis.benato@linux.dev>
To: linux-kernel@vger.kernel.org,
Basavaraj Natikar <basavaraj.natikar@amd.com>
Cc: linux-input@vger.kernel.org,
kernel@lists.opengamingcollective.org,
"Benjamin Tissoires" <bentiss@kernel.org>,
"Jiri Kosina" <jikos@kernel.org>,
"Luke D . Jones" <luke@ljones.dev>,
"Mateusz Schyboll" <dragonn@op.pl>,
"Denis Benato" <benato.denis96@gmail.com>,
"Mario Limonciello" <mario.limonciello@amd.com>,
"Akshata MukundShetty" <akshata.mukundshetty@amd.com>,
ratcashdev <developer@ratcash.net>,
Denis Benato <denis.benato@linux.dev>
Subject: [PATCH] HID: amd_sfh: accept op_idx acks with sensor_id 13 on ROG Flow X16 GV601R
Date: Wed, 2 Dec 2026 12:52:02 +0000 [thread overview]
Message-ID: <20261202125202.6797-1-denis.benato@linux.dev> (raw)
From: ratcashdev <developer@ratcash.net>
The MP2 v2 firmware of the ASUS ROG Flow X16 2022 (GV601R) acks
ENABLE/DISABLE of the operating-mode sensor (op_idx, 15) with
sensor_id 13 in P2C_MSG0:
start: P2C_MSG0=0x000d0248 status=0 response=4 sub_cmd=2 sensor_id=13
stop: P2C_MSG0=0x000d0258 status=0 response=5 sub_cmd=2 sensor_id=13
amd_sfh_wait_response_v2() requires sensor_id == sid, so sensor setup
at probe stalls for the 10 s ack timeout and op_idx stays
SENSOR_DISABLED. The "tabletmode" auxiliary device is then not created
and no SW_TABLET_MODE switch is reported.
Add a DMI quirk with the sensor_id this firmware uses in op_idx acks
and match op_idx acks against it.
Trees without the tabletmode auxiliary device (6.17, 6.18) only have
the stall; there the patch needs its context adjusted, as struct
amd_mp2_dev has no tm_auxdev and mp2_select_ops() does not set
mp2_ver.
Fixes: 3a807f3ff9ea ("HID: amd_sfh: Enable operating mode")
Signed-off-by: Denis Benato <denis.benato@linux.dev>
Signed-off-by: ratcashdev <developer@ratcash.net>
---
Notes:
Tested on a GV601RM (BIOS GV601RM.500.U4, 10/28/2022) with
next-20261201 and v7.3.4, each plus this patch: the 10 s stall in SFH
probe is gone, amd_sfh.tabletmode is created and SW_TABLET_MODE toggles
correctly when the screen is folded back (libinput disables the
keyboard/touchpad, the desktop shows the on-screen keyboard). The
switch keeps working across suspend/resume on both kernels. Not tested
on GV601RE/GV601RW; they are matched on the assumption that they share
the firmware.
The stall fix was not tested on 6.17/6.18 (no adjusted backport built).
Questions for Basavaraj:
- Is 13 the firmware's own id for the operating-mode sensor on this
MP2 generation? This machine's sensor mask (P2C_MSG3 >> 4 = 0x2a409)
also sets bit 13, which the driver does not decode. If 13 is the
native id, a mapping in the driver may be preferable to a DMI quirk.
- Is there a firmware update that fixes the ack instead?
On the same machine asus-nb-wmi logs "This device has
tablet-mode-switch quirk but got ENODEV checking it. This is a bug."
(Cc Denis); with this patch SW_TABLET_MODE comes from amd_sfh_tabletmode
instead.
Tool use: the root-cause analysis (a debug build logging P2C_MSG0 after
the op_idx commands), the patch and this changelog were drafted with an
AI coding assistant (Claude Code). I reviewed the code, ran the debug
build and tested the patch on the hardware above.
drivers/hid/amd-sfh-hid/amd_sfh_common.h | 2 ++
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 20 ++++++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_common.h b/drivers/hid/amd-sfh-hid/amd_sfh_common.h
index 4481a5035..eebe46149 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_common.h
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_common.h
@@ -77,6 +77,8 @@ struct amd_mp2_dev {
u8 init_done;
u8 rver;
u8 mp2_ver;
+ /* sensor_id the firmware puts in op_idx acks, 0 = op_idx */
+ u8 op_ack_sid;
struct auxiliary_device *tm_auxdev;
};
diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
index a0a7cfaa2..84191bb7e 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
@@ -48,6 +48,9 @@ static int amd_sfh_wait_response_v2(struct amd_mp2_dev *mp2, u8 sid, u32 sensor_
{
union cmd_response cmd_resp;
+ if (sid == op_idx && mp2->op_ack_sid)
+ sid = mp2->op_ack_sid;
+
/* Get response with status within a max of 10 seconds timeout */
if (!readl_poll_timeout(mp2->mmio + AMD_P2C_MSG(0), cmd_resp.resp,
(cmd_resp.response_v2.response == sensor_sts &&
@@ -278,8 +281,22 @@ static struct amd_mp2_ops amd_sfh_ops = {
.remove = amd_mp2_pci_remove,
};
+/* firmware that acks op_idx commands with a different sensor_id */
+static const struct dmi_system_id dmi_op_ack_sid_quirks[] = {
+ {
+ /* ROG Flow X16 2022: GV601RM, GV601RE, GV601RW */
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+ DMI_MATCH(DMI_BOARD_NAME, "GV601R"),
+ },
+ .driver_data = (void *)13,
+ },
+ { }
+};
+
static void mp2_select_ops(struct amd_mp2_dev *privdata)
{
+ const struct dmi_system_id *dmi_id;
u8 acs;
privdata->mp2_acs = readl(privdata->mmio + AMD_P2C_MSG3);
@@ -289,6 +306,9 @@ static void mp2_select_ops(struct amd_mp2_dev *privdata)
case V2_STATUS:
privdata->mp2_ops = &amd_sfh_ops_v2;
privdata->mp2_ver = MP2_VER_V2;
+ dmi_id = dmi_first_match(dmi_op_ack_sid_quirks);
+ if (dmi_id)
+ privdata->op_ack_sid = (uintptr_t)dmi_id->driver_data;
break;
default:
privdata->mp2_ops = &amd_sfh_ops;
base-commit: 47d0d5ce3cfca63a04eabcbeef7086d06240ff97
--
2.56.1
next reply other threads:[~2026-12-02 12:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 12:52 Denis Benato [this message]
2026-12-02 12:53 ` [PATCH] HID: amd_sfh: accept op_idx acks with sensor_id 13 on ROG Flow X16 GV601R 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=20261202125202.6797-1-denis.benato@linux.dev \
--to=denis.benato@linux.dev \
--cc=akshata.mukundshetty@amd.com \
--cc=basavaraj.natikar@amd.com \
--cc=benato.denis96@gmail.com \
--cc=bentiss@kernel.org \
--cc=developer@ratcash.net \
--cc=dragonn@op.pl \
--cc=jikos@kernel.org \
--cc=kernel@lists.opengamingcollective.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luke@ljones.dev \
--cc=mario.limonciello@amd.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