From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.147 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796215930; b=VRK02GOe1mQ1ofAXWpKS0+JYZ3V0Pl/WOQK/4BEuQpZIover4IO8HhPT7WfZXbqyCaUu 6lGYO3Qagj+M9TNzEbzsjjZ7CJ0LQ+TbGHvEARZH1Axtx10XNBb9+AMaUu0TsxBBufM+q 2AnxsyM7XaQWO49Ill05rQjmtMcutJfDaWDtYsoa3i7bkL/U3i3B37sCbXLIgvnakwZVa G8EfDBht02Crd/1MTp2jNYP0FYRwzCEEmXW3BD1oslVvrT8krQ9gf5eIxv+LLZautn8KZ rYVCGyZM6klO157KDJZ+kRoQjMNXJspwrdvltBwSUokh9ClLmV2clcB5sLmcIhWhTrA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796215930; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:From:To:Cc:Subject:Date:Message-ID: X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=VvfKB0HvUDp6+UAmcbcDVTrr7i2R47g6VWTZc7sKvGk=; b=k57jstEGHbTNn1KWzaHYht0Ed89ug+MQMGma2iANc8lfdbF8G+8ZumU9ad8pvbdVCj3i PXFqPKIxeFoygjZx6scMP9R8PiFe/TBZH++vE85vcv/YV4Ezxn9OMq3WgHjPOcWwZbTBl TBdS4SN8HtEjHLn7vtQgClcPpg6rtDs903T4ru4vSjzzKq046zRoC6TxmBs3Uz8oGgnOU XBhIdvcgPrVXGJEBGXBhHaIF3NX2zs2l5aihXcz8iAXmwkRssYBkGQdnY22M24PUBzr14 xorhR10aoI0FZKetJl/MxT8rbw12XqgR5Wr2UbKCvrwpXBGskoTkyy1wsD3V2MUnT7Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=jJ3vYQw1; arc=none smtp.remote-ip=91.218.175.147 Received: from mta0.migadu.com (out-147.mta0.migadu.com [91.218.175.147]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3AC9C606A31A for ; Wed, 2 Dec 2026 12:52:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3AC9C606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=jJ3vYQw1 X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=DrHbbCQYS07luFtRTq0yTL9TaCGve8vr7+e08np25x0=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796215926; v=1; x=1796820726; b=jJ3vYQw1HpPdcdfWnq6A9nWNaKxjbyxIV9RP0h5OkIqaAODT6CyDKUcjYoNoaFLZ20k5EpPZ wjp9Aw5wu/I82KmTbgkbODiv1Ih9wxdt0HyHCiE1l25JZW2XbidtOBoCGN8q+SRgXN/s1uHIRLE xDevybHkYNjl7V/NpcDKGl9c= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id fa844c54ad351df8; Wed, 02 Dec 2026 12:52:06 +0000 X-Mizu-Trace-ID: fa844c54ad351df8 X-Migadu-Flow: FLOW_OUT From: Denis Benato To: linux-kernel@vger.kernel.org, Basavaraj Natikar Cc: linux-input@vger.kernel.org, kernel@lists.opengamingcollective.org, "Benjamin Tissoires" , "Jiri Kosina" , "Luke D . Jones" , "Mateusz Schyboll" , "Denis Benato" , "Mario Limonciello" , "Akshata MukundShetty" , ratcashdev , Denis Benato 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 Message-ID: <20261202125202.6797-1-denis.benato@linux.dev> X-Mailer: git-send-email 2.47.3 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: ratcashdev 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 Signed-off-by: ratcashdev --- 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