Re: [PATCH v3 0/5] Add SW_TABLET_MODE support for AMD SFH convertibles
From: Basavaraj Natikar <hidden>
Date: 2026-08-14 16:37:59
On 8/14/2026 6:14 PM, Jiri Kosina wrote:
On Mon, 3 Aug 2026, Basavaraj Natikar wrote:quoted
Add SW_TABLET_MODE support for AMD convertibles whose operating mode (laptop or tablet) is reported by the Sensor Fusion Hub. Patches 1 and 2 are preparation: the first tracks the MP2 version explicitly and the second serializes access to the shared emp2 pointer. The third adds a way to read the operating mode. The fourth registers an auxiliary device when the sensor is present, and the fifth is a small input driver that binds to it and reports the posture to userspace. Keeping the input handling in its own driver avoids pulling input/evdev into the sensor transport driver. Changes in v3: - Destroy the tablet-mode auxiliary device before the hardware teardown in .remove(), instead of from a devres action that runs afterwards, closing a use-after-teardown window (Sashiko review). - Move the Makefile entry to its correct alphabetical position (Dmitry Torokhov). Changes in v2 (address the Sashiko review of v1): - Read the operating-mode register only on confirmed MP2 v2, by tracking the MP2 version explicitly. On v1.0 that register overlaps the 64-bit DMA address programmed through C2P, so the earlier unconditional read could return DMA bits instead of the operating mode. - Serialize the shared emp2 pointer and all exported readers under a mutex, so a concurrent unbind can no longer free the device while a reader is still dereferencing it. - Publish emp2 only after initialization has populated the client data, and clear it early on the MP2 v2 remove path instead of from a prematurely registered devres action; this removes both the publish-before-init data race and the unconditional global clear on a probe failure. - Destroy the tablet-mode auxiliary device and release its id on removal, and allocate the id dynamically so multiple instances cannot collide. - Report the initial tablet-mode state before registering the input device, so userspace never observes a stale default posture. - Rename the error variable from 'rc' to 'error' to follow the input-subsystem convention. v2: https://lore.kernel.org/all/20260803145801.3801862-1-Basavaraj.Natikar@amd.com/ (local) v1: https://lore.kernel.org/all/20260721174422.3109166-1-Basavaraj.Natikar@amd.com/ (local)Now queued in hid.git#for-7.3/amd-sfh, sorry for the delay. Myself and Benjamin have been on a few weeks on leave in parallel, and then didn't really help with the throughput ... still recovering :)
Thanks a lot, Jiri, and no worries at all about the delay. I really appreciate you and Benjamin taking the time to review it. Hope you're both back to full strength soon. Thanks again for queuing it up. Thanks, -- Basavaraj