Linux Input/HID development
 help / color / mirror / Atom feed
From: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
To: <jikos@kernel.org>, <bentiss@kernel.org>, <dmitry.torokhov@gmail.com>
Cc: <linux-input@vger.kernel.org>,
	Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Subject: [PATCH v2 0/5] Add SW_TABLET_MODE support for AMD SFH convertibles
Date: Mon, 3 Aug 2026 20:27:56 +0530	[thread overview]
Message-ID: <20260803145801.3801862-1-Basavaraj.Natikar@amd.com> (raw)

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 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.

v1: https://lore.kernel.org/all/20260721174422.3109166-1-Basavaraj.Natikar@amd.com/

Basavaraj Natikar (5):
  HID: amd_sfh: Track MP2 version explicitly
  HID: amd_sfh: Serialize access to the shared emp2 pointer
  HID: amd_sfh: Add accessor to read the operating-mode sensor
  HID: amd_sfh: Register tablet-mode auxiliary device
  Input: misc: Add AMD SFH tablet-mode switch driver

 MAINTAINERS                                   |  1 +
 drivers/hid/amd-sfh-hid/Kconfig               |  1 +
 drivers/hid/amd-sfh-hid/amd_sfh_client.c      | 16 ++++
 drivers/hid/amd-sfh-hid/amd_sfh_common.h      | 13 +++
 drivers/hid/amd-sfh-hid/amd_sfh_pcie.c        | 61 +++++++++++++-
 .../amd-sfh-hid/sfh1_1/amd_sfh_interface.c    | 39 +++++++++
 .../amd-sfh-hid/sfh1_1/amd_sfh_interface.h    |  1 -
 drivers/input/misc/Kconfig                    | 15 ++++
 drivers/input/misc/Makefile                   |  1 +
 drivers/input/misc/amd_sfh_tabletmode.c       | 81 +++++++++++++++++++
 include/linux/amd-pmf-io.h                    | 14 ++++
 11 files changed, 238 insertions(+), 5 deletions(-)
 create mode 100644 drivers/input/misc/amd_sfh_tabletmode.c

-- 
2.34.1


             reply	other threads:[~2026-08-03 14:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03 14:57 Basavaraj Natikar [this message]
2026-08-03 14:57 ` [PATCH v2 1/5] HID: amd_sfh: Track MP2 version explicitly Basavaraj Natikar
2026-08-03 14:57 ` [PATCH v2 2/5] HID: amd_sfh: Serialize access to the shared emp2 pointer Basavaraj Natikar
2026-08-03 14:57 ` [PATCH v2 3/5] HID: amd_sfh: Add accessor to read the operating-mode sensor Basavaraj Natikar
2026-08-03 14:58 ` [PATCH v2 4/5] HID: amd_sfh: Register tablet-mode auxiliary device Basavaraj Natikar
2026-08-03 15:16   ` sashiko-bot
2026-08-03 14:58 ` [PATCH v2 5/5] Input: misc: Add AMD SFH tablet-mode switch driver Basavaraj Natikar
2026-08-03 16:18   ` Dmitry Torokhov
2026-08-03 17:42     ` Basavaraj Natikar

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=20260803145801.3801862-1-Basavaraj.Natikar@amd.com \
    --to=basavaraj.natikar@amd.com \
    --cc=bentiss@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@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