From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.149 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796216042; b=gKx/eLSfQgTaAwmOgI9CZPp5MwGF0xjF//+drY8YLSFhY25anud3UD7A90Z1h36mlyc3 2KhTaTPowoVdpJ2oVGXQ2iRmzjyroJfT+KyZjbAfmufLKsZRFjAbFsqaTzOmY7XmXk78j 9LItZiQa3dfIZmZdhmash/w2jvLrRo6lZ/7wahGBf+5vg9pTl0B30uAnju27o0l8BZkOm 4kBNpq6lzwOG2gQ9vAanF9uK2Kz7LkpkJxVopHlXj7qbFvnmEkTn/A54gYMtS+kdBqq1L gQcQmSgLyTy4EG/lTO5M5TJFjsHXM5KcGI+qhET6fVYM7ZQ+O7mmxUGeGsJPQ/nCNBg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796216042; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=TK4nxcCkamBaUvlZPJ788nlY6wPObJdqTLzzXPjiBpk=; b=JmwNYBZd8ZsfXUYBEjWaQgV1cV2z2SEH73lA3X1tm4sklRN3EN1iz/FOBTLxuZ02NRQE K5pA+jkqqV4+gNLILIlfgayDZyPHUqD3ubBUWyv1JK6rrzOpsmcSITumoSl5Zi+g2m136 5EStU/07Ll/tRd9jmSaBuQ5hxaeKl/3Hl1XxeVZi+qsMc7XOYsf7hBnbbIPAuKrC7j7lq L5gjHo7rg7dgcqt+RgAWegFSP5xOmk/NjAcmoOwgelmP08i7rD5///UBShcf9cXAwHMG9 faX83c6rIpeo7e4gt9cXZEI48YMp0tmg7nHyAx/4O/52tn4Z0PnnygRDsO4o4ExQFvA== 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=d1eq1O3Y; arc=none smtp.remote-ip=95.215.58.149 Received: from mta1.migadu.com (out-149.mta1.migadu.com [95.215.58.149]) (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 DA7A5606A322 for ; Wed, 2 Dec 2026 12:54:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DA7A5606A322 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=d1eq1O3Y X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=9BT4tHR4M5P00OchmJu2/qhVJmj3Cwr4SDyNXoHiPak=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796216039; v=1; x=1796820839; b=d1eq1O3YUpbmfcEzAKOvG2ayr0MrOdtL6fodu+hyV+js6mgCx89S8CXG4DopCDJKVMBqb8FV TGGexOG6Nq+igo5RmESyvsTKbu4wjTjGyIyWytA8VubH34Q40QWWO49+OsVs3CRC2rU4qEljxn4 6vQPwGpZ4p1GE6xRZe1OCrh0= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id f35b5dee014a2852; Wed, 02 Dec 2026 12:53:59 +0000 X-Mizu-Trace-ID: f35b5dee014a2852 X-Migadu-Flow: FLOW_OUT Message-ID: Date: Wed, 2 Dec 2026 13:53:56 +0100 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 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] HID: amd_sfh: accept op_idx acks with sensor_id 13 on ROG Flow X16 GV601R 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 References: <20261202125202.6797-1-denis.benato@linux.dev> Content-Language: en-US From: Denis Benato In-Reply-To: <20261202125202.6797-1-denis.benato@linux.dev> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 12/2/26 13:52, Denis Benato wrote: > 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: Hi all, I am sending this patch on behalf of the user that has created and tested it. Best regards, Denis Benato > 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