[RFC PATCH v2 6/6] HID: spi-hid: expose readiness for reset diagnostics

From
Jizhou Tong <hidden>
Date
2026-10-13 03:28:46
Also in
linux-devicetree, linux-spi, lkml
Reply to
Jizhou Tong, 2026-10-13
Retain the read-only readiness status used to correlate descriptor
refresh and hidraw reconnection with iptsd logs. Document it alongside
the existing bus, regulator and device-reset counters.

Limit the Romulus maintenance entry to its binding and ABI documentation.

Signed-off-by: Jizhou Tong <redacted>
---
 .../ABI/testing/sysfs-bus-spi-devices-spi-hid | 30 +++++++++++++++++++
 MAINTAINERS                                   |  7 +++++
 drivers/hid/spi-hid/spi-hid-core.c            | 11 +++++++
 3 files changed, 48 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-spi-devices-spi-hid
diff --git a/Documentation/ABI/testing/sysfs-bus-spi-devices-spi-hid b/Documentation/ABI/testing/sysfs-bus-spi-devices-spi-hid
new file mode 100644
index 0000000000000000000000000000000000000000..5c55748a082e028a2fb7a0aadbde5d92eed50950
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-bus-spi-devices-spi-hid
@@ -0,0 +1,30 @@
+What:		/sys/bus/spi/devices/.../ready
+Date:		October 2026
+Contact:	Jizhou Tong <fqwqf@fqwqf.xyz>
+Description:
+		Read-only generic HID SPI readiness: "ready" or "not ready".
+		The device must be ready and opened before input is delivered.
+
+What:		/sys/bus/spi/devices/.../bus_error_count
+Date:		October 2026
+Contact:	Jizhou Tong <fqwqf@fqwqf.xyz>
+Description:
+		Read-only pair "COUNT (ERROR)". COUNT accumulates transport
+		failures and invalid input headers since bind and may wrap.
+		ERROR is the last such negative errno. The two fields are
+		sampled independently. Unlike the previous downstream SL7
+		driver, a successful transfer does not clear this counter.
+
+What:		/sys/bus/spi/devices/.../regulator_error_count
+Date:		October 2026
+Contact:	Jizhou Tong <fqwqf@fqwqf.xyz>
+Description:
+		Read-only pair "COUNT (ERROR)" of accumulated regulator
+		failures and the last errno. Fields are sampled independently.
+
+What:		/sys/bus/spi/devices/.../device_initiated_reset_count
+Date:		October 2026
+Contact:	Jizhou Tong <fqwqf@fqwqf.xyz>
+Description:
+		Read-only unsigned count of reset responses processed while
+		the generic HID ready flag was set. Starts at zero on bind.
diff --git a/MAINTAINERS b/MAINTAINERS
index c52ec2d7d3c12ace1f6e2f6012a32844bd8f364e..858ec47345400b0cf751e7c8cc13140b462c701a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11626,6 +11626,13 @@ L:	linux-input@vger.kernel.org
 S:	Maintained
 F:	drivers/hid/hid-nvidia-shield.c
 
+HID OVER SPI ROMULUS13 INTEGRATION
+M:	Jizhou Tong <fqwqf@fqwqf.xyz>
+L:	linux-input@vger.kernel.org
+S:	Maintained
+F:	Documentation/ABI/testing/sysfs-bus-spi-devices-spi-hid
+F:	Documentation/devicetree/bindings/input/microsoft,romulus13-touchpad.yaml
+
 HID PHOENIX RC FLIGHT CONTROLLER
 M:	Marcus Folkesson <marcus.folkesson@gmail.com>
 L:	linux-input@vger.kernel.org
diff --git a/drivers/hid/spi-hid/spi-hid-core.c b/drivers/hid/spi-hid/spi-hid-core.c
index bd27bc3ea34c5fa65a903dd204800dbdafe3a7bc..167ee347588fd6248c647e8d970324e96d99d8a8 100644
--- a/drivers/hid/spi-hid/spi-hid-core.c
+++ b/drivers/hid/spi-hid/spi-hid-core.c
@@ -1568,6 +1568,16 @@ static struct hid_ll_driver spi_hid_ll_driver = {
 	.raw_request = spi_hid_ll_raw_request,
 };
 
+static ssize_t ready_show(struct device *dev,
+			  struct device_attribute *attr, char *buf)
+{
+	struct spi_hid *shid = spi_mem_get_drvdata(dev_get_drvdata(dev));
+
+	return sysfs_emit(buf, "%s\n", test_bit(SPI_HID_READY, &shid->flags) ?
+			  "ready" : "not ready");
+}
+static DEVICE_ATTR_RO(ready);
+
 static ssize_t bus_error_count_show(struct device *dev,
 				    struct device_attribute *attr, char *buf)
 {
@@ -1601,6 +1611,7 @@ static ssize_t device_initiated_reset_count_show(struct device *dev,
 static DEVICE_ATTR_RO(device_initiated_reset_count);
 
 static struct attribute *spi_hid_attrs[] = {
+	&dev_attr_ready.attr,
 	&dev_attr_bus_error_count.attr,
 	&dev_attr_regulator_error_count.attr,
 	&dev_attr_device_initiated_reset_count.attr,
-- 
2.53.0
Thread (56 messages) 56 messages, 6 authors, last reply 18h ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help