* [PATCH -next v2 1/4] HID: amd_sfh: Move sysfs attributes to a separate file
2026-10-06 10:37 [PATCH -next v2 0/4] HID: amd_sfh: operating-mode telemetry sysfs and report fixes Basavaraj Natikar
@ 2026-10-06 10:37 ` Basavaraj Natikar
2026-10-06 10:37 ` [PATCH -next v2 2/4] HID: amd_sfh: Add operating-mode telemetry sysfs attributes Basavaraj Natikar
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Basavaraj Natikar @ 2026-10-06 10:37 UTC (permalink / raw)
To: jikos, bentiss; +Cc: linux-input, Basavaraj Natikar
The sysfs attribute handling is defined in amd_sfh_pcie.c along with the
PCIe transport code. More attributes will be added and the same handling
is useful across SFH versions.
Therefore, move the attribute definitions, the visibility callback and
the group update helper into a dedicated amd_sfh_sysfs.c file.
No functional change intended.
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
---
drivers/hid/amd-sfh-hid/Makefile | 1 +
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 55 +------------------
drivers/hid/amd-sfh-hid/amd_sfh_sysfs.c | 73 +++++++++++++++++++++++++
drivers/hid/amd-sfh-hid/amd_sfh_sysfs.h | 19 +++++++
4 files changed, 95 insertions(+), 53 deletions(-)
create mode 100644 drivers/hid/amd-sfh-hid/amd_sfh_sysfs.c
create mode 100644 drivers/hid/amd-sfh-hid/amd_sfh_sysfs.h
diff --git a/drivers/hid/amd-sfh-hid/Makefile b/drivers/hid/amd-sfh-hid/Makefile
index 106514b54d16..a0e4113c94cb 100644
--- a/drivers/hid/amd-sfh-hid/Makefile
+++ b/drivers/hid/amd-sfh-hid/Makefile
@@ -8,6 +8,7 @@ obj-$(CONFIG_AMD_SFH_HID) += amd_sfh.o
amd_sfh-objs := amd_sfh_hid.o
amd_sfh-objs += amd_sfh_client.o
amd_sfh-objs += amd_sfh_pcie.o
+amd_sfh-objs += amd_sfh_sysfs.o
amd_sfh-objs += hid_descriptor/amd_sfh_hid_desc.o
amd_sfh-objs += sfh1_1/amd_sfh_init.o
amd_sfh-objs += sfh1_1/amd_sfh_interface.o
diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
index aa09a9538f4f..b3cb13b8c5e8 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
@@ -20,9 +20,9 @@
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/slab.h>
-#include <linux/string_choices.h>
#include "amd_sfh_pcie.h"
+#include "amd_sfh_sysfs.h"
#include "sfh1_1/amd_sfh_init.h"
#define DRIVER_NAME "pcie_mp2_amd"
@@ -340,57 +340,6 @@ static const struct dmi_system_id dmi_nodevs[] = {
{ }
};
-static ssize_t hpd_show(struct device *dev, struct device_attribute *attr, char *buf)
-{
- struct amd_mp2_dev *mp2 = dev_get_drvdata(dev);
-
- return sysfs_emit(buf, "%s\n", str_enabled_disabled(mp2->dev_en.is_hpd_enabled));
-}
-
-static ssize_t hpd_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
- struct amd_mp2_dev *mp2 = dev_get_drvdata(dev);
- bool enabled;
- int ret;
-
- ret = kstrtobool(buf, &enabled);
- if (ret)
- return ret;
-
- mp2->sfh1_1_ops->toggle_hpd(mp2, enabled);
-
- return count;
-}
-static DEVICE_ATTR_RW(hpd);
-
-static umode_t sfh_attr_is_visible(struct kobject *kobj, struct attribute *attr, int idx)
-{
- struct device *dev = kobj_to_dev(kobj);
- struct amd_mp2_dev *mp2 = dev_get_drvdata(dev);
-
- if (!mp2->sfh1_1_ops || !mp2->dev_en.is_hpd_present)
- return 0;
-
- return attr->mode;
-}
-
-static struct attribute *sfh_attrs[] = {
- &dev_attr_hpd.attr,
- NULL,
-};
-
-static struct attribute_group sfh_attr_group = {
- .attrs = sfh_attrs,
- .is_visible = sfh_attr_is_visible,
-};
-
-static const struct attribute_group *amd_sfh_groups[] = {
- &sfh_attr_group,
- NULL,
-};
-
static DEFINE_IDA(sfh_tm_ida);
static void amd_sfh_maybe_register_tm(struct amd_mp2_dev *mp2)
@@ -448,7 +397,7 @@ static void sfh1_1_init_work(struct work_struct *work)
amd_sfh_clear_intr(mp2);
mp2->init_done = 1;
- rc = sysfs_update_group(&mp2->pdev->dev.kobj, &sfh_attr_group);
+ rc = amd_sfh_update_sysfs(mp2);
if (rc)
dev_warn(&mp2->pdev->dev, "failed to update sysfs group\n");
diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_sysfs.c b/drivers/hid/amd-sfh-hid/amd_sfh_sysfs.c
new file mode 100644
index 000000000000..db1cc205d25b
--- /dev/null
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_sysfs.c
@@ -0,0 +1,73 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * AMD SFH sysfs attributes
+ *
+ * Copyright (c) 2026, Advanced Micro Devices, Inc.
+ * All Rights Reserved.
+ *
+ * Author: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
+ */
+#include <linux/device.h>
+#include <linux/kernel.h>
+#include <linux/string_choices.h>
+#include <linux/sysfs.h>
+
+#include "amd_sfh_common.h"
+#include "amd_sfh_sysfs.h"
+#include "sfh1_1/amd_sfh_init.h"
+
+static ssize_t hpd_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ struct amd_mp2_dev *mp2 = dev_get_drvdata(dev);
+
+ return sysfs_emit(buf, "%s\n", str_enabled_disabled(mp2->dev_en.is_hpd_enabled));
+}
+
+static ssize_t hpd_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct amd_mp2_dev *mp2 = dev_get_drvdata(dev);
+ bool enabled;
+ int ret;
+
+ ret = kstrtobool(buf, &enabled);
+ if (ret)
+ return ret;
+
+ mp2->sfh1_1_ops->toggle_hpd(mp2, enabled);
+
+ return count;
+}
+static DEVICE_ATTR_RW(hpd);
+
+static umode_t sfh_attr_is_visible(struct kobject *kobj, struct attribute *attr, int idx)
+{
+ struct device *dev = kobj_to_dev(kobj);
+ struct amd_mp2_dev *mp2 = dev_get_drvdata(dev);
+
+ if (!mp2->sfh1_1_ops || !mp2->dev_en.is_hpd_present)
+ return 0;
+
+ return attr->mode;
+}
+
+static struct attribute *sfh_attrs[] = {
+ &dev_attr_hpd.attr,
+ NULL,
+};
+
+static struct attribute_group sfh_attr_group = {
+ .attrs = sfh_attrs,
+ .is_visible = sfh_attr_is_visible,
+};
+
+const struct attribute_group *amd_sfh_groups[] = {
+ &sfh_attr_group,
+ NULL,
+};
+
+int amd_sfh_update_sysfs(struct amd_mp2_dev *mp2)
+{
+ return sysfs_update_group(&mp2->pdev->dev.kobj, &sfh_attr_group);
+}
diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_sysfs.h b/drivers/hid/amd-sfh-hid/amd_sfh_sysfs.h
new file mode 100644
index 000000000000..941b995e2c8f
--- /dev/null
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_sysfs.h
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * AMD SFH sysfs attributes
+ *
+ * Copyright (c) 2026, Advanced Micro Devices, Inc.
+ * All Rights Reserved.
+ *
+ * Author: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
+ */
+#ifndef AMD_SFH_SYSFS_H
+#define AMD_SFH_SYSFS_H
+
+#include "amd_sfh_common.h"
+
+extern const struct attribute_group *amd_sfh_groups[];
+
+int amd_sfh_update_sysfs(struct amd_mp2_dev *mp2);
+
+#endif
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH -next v2 2/4] HID: amd_sfh: Add operating-mode telemetry sysfs attributes
2026-10-06 10:37 [PATCH -next v2 0/4] HID: amd_sfh: operating-mode telemetry sysfs and report fixes Basavaraj Natikar
2026-10-06 10:37 ` [PATCH -next v2 1/4] HID: amd_sfh: Move sysfs attributes to a separate file Basavaraj Natikar
@ 2026-10-06 10:37 ` Basavaraj Natikar
2026-10-06 10:50 ` sashiko-bot
2026-10-06 10:37 ` [PATCH -next v2 3/4] HID: amd_sfh: Remove unsupported motion-state field from accelerometer report Basavaraj Natikar
2026-10-06 10:37 ` [PATCH -next v2 4/4] HID: amd_sfh: Use report type from request node Basavaraj Natikar
3 siblings, 1 reply; 7+ messages in thread
From: Basavaraj Natikar @ 2026-10-06 10:37 UTC (permalink / raw)
To: jikos, bentiss; +Cc: linux-input, Basavaraj Natikar
The Sensor Fusion Hub reports additional operating-mode telemetry
through the SRA sensor, such as in-bag and out-of-bag detection,
on-table or on-lap placement, hinge angle, lid status and the platform
device mode.
Expose these states read-only through sysfs so that userspace can
consume them. The attributes are visible only on SFH 1.1 or greater when
the SRA sensor is present.
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
---
.../ABI/testing/sysfs-driver-amd-sfh | 60 ++++++++++++++++++
MAINTAINERS | 1 +
drivers/hid/amd-sfh-hid/amd_sfh_sysfs.c | 63 ++++++++++++++++++-
3 files changed, 123 insertions(+), 1 deletion(-)
diff --git a/Documentation/ABI/testing/sysfs-driver-amd-sfh b/Documentation/ABI/testing/sysfs-driver-amd-sfh
index c053126a83bb..15abd994e9ee 100644
--- a/Documentation/ABI/testing/sysfs-driver-amd-sfh
+++ b/Documentation/ABI/testing/sysfs-driver-amd-sfh
@@ -11,3 +11,63 @@ Description:
Access: Read/Write
Valid values: enabled/disabled
+
+What: /sys/bus/pci/drivers/pcie_mp2_amd/*/in_bag_state
+Date: August 2026
+Contact: Basavaraj.Natikar@amd.com
+Description:
+ Operating-mode telemetry reported by the SRA sensor that
+ indicates whether the device is detected inside a bag.
+
+ Access: Read only
+ Valid values: unsigned integer
+
+What: /sys/bus/pci/drivers/pcie_mp2_amd/*/out_bag_state
+Date: August 2026
+Contact: Basavaraj.Natikar@amd.com
+Description:
+ Operating-mode telemetry reported by the SRA sensor that
+ indicates whether the device is detected outside a bag.
+
+ Access: Read only
+ Valid values: unsigned integer
+
+What: /sys/bus/pci/drivers/pcie_mp2_amd/*/on_table_state
+Date: August 2026
+Contact: Basavaraj.Natikar@amd.com
+Description:
+ Operating-mode telemetry reported by the SRA sensor that
+ indicates whether the device is placed on a table or on a lap.
+
+ Access: Read only
+ Valid values: unsigned integer
+
+What: /sys/bus/pci/drivers/pcie_mp2_amd/*/hinge_angle
+Date: August 2026
+Contact: Basavaraj.Natikar@amd.com
+Description:
+ Operating-mode telemetry reported by the SRA sensor that
+ reports the hinge angle of the device in degrees.
+
+ Access: Read only
+ Valid values: unsigned integer (degrees)
+
+What: /sys/bus/pci/drivers/pcie_mp2_amd/*/lid_status
+Date: August 2026
+Contact: Basavaraj.Natikar@amd.com
+Description:
+ Operating-mode telemetry reported by the SRA sensor that
+ indicates whether the device lid is open or closed.
+
+ Access: Read only
+ Valid values: unsigned integer
+
+What: /sys/bus/pci/drivers/pcie_mp2_amd/*/device_mode
+Date: August 2026
+Contact: Basavaraj.Natikar@amd.com
+Description:
+ Operating-mode telemetry reported by the SRA sensor that
+ reports the platform/device mode.
+
+ Access: Read only
+ Valid values: unsigned integer
diff --git a/MAINTAINERS b/MAINTAINERS
index 5c57cbb68060..ad3477693db5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1331,6 +1331,7 @@ AMD SENSOR FUSION HUB DRIVER
M: Basavaraj Natikar <basavaraj.natikar@amd.com>
L: linux-input@vger.kernel.org
S: Maintained
+F: Documentation/ABI/testing/sysfs-driver-amd-sfh
F: Documentation/hid/amd-sfh*
F: drivers/hid/amd-sfh-hid/
F: drivers/input/misc/amd_sfh_tabletmode.c
diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_sysfs.c b/drivers/hid/amd-sfh-hid/amd_sfh_sysfs.c
index db1cc205d25b..8af4df09760f 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_sysfs.c
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_sysfs.c
@@ -8,6 +8,7 @@
* Author: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
*/
#include <linux/device.h>
+#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/string_choices.h>
#include <linux/sysfs.h>
@@ -15,6 +16,7 @@
#include "amd_sfh_common.h"
#include "amd_sfh_sysfs.h"
#include "sfh1_1/amd_sfh_init.h"
+#include "sfh1_1/amd_sfh_interface.h"
static ssize_t hpd_show(struct device *dev, struct device_attribute *attr, char *buf)
{
@@ -41,19 +43,78 @@ static ssize_t hpd_store(struct device *dev,
}
static DEVICE_ATTR_RW(hpd);
+/* Operating-mode telemetry reported by the SRA sensor, exposed read-only. */
+static int amd_sfh_read_op_mode(struct amd_mp2_dev *mp2, struct sfh_op_mode *mode)
+{
+ struct sfh_accel_data accel_data;
+ void __iomem *sensoraddr;
+
+ if (!mp2->sfh1_1_ops || !mp2->dev_en.is_sra_present)
+ return -ENODEV;
+
+ if (mp2->mp2_ver >= MP2_VER_1_2) {
+ sensoraddr = mp2->vsbase +
+ (SRA_IDX * SENSOR_DATA_MEM_SIZE_DEFAULT) +
+ OFFSET_SENSOR_DATA_DEFAULT;
+ memcpy_fromio(&accel_data, sensoraddr, sizeof(struct sfh_accel_data));
+ mode->val = accel_data.c2p3_data;
+ } else {
+ mode->val = readl(mp2->mmio + amd_get_c2p_val(mp2, 3));
+ }
+
+ return 0;
+}
+
+#define SFH_OP_MODE_ATTR(_name, _field) \
+static ssize_t _name##_show(struct device *dev, \
+ struct device_attribute *attr, char *buf) \
+{ \
+ struct amd_mp2_dev *mp2 = dev_get_drvdata(dev); \
+ struct sfh_op_mode mode; \
+ int ret; \
+ \
+ ret = amd_sfh_read_op_mode(mp2, &mode); \
+ if (ret) \
+ return ret; \
+ \
+ return sysfs_emit(buf, "%u\n", mode.op_mode._field); \
+} \
+static DEVICE_ATTR_RO(_name)
+
+SFH_OP_MODE_ATTR(in_bag_state, inbagstate);
+SFH_OP_MODE_ATTR(out_bag_state, outbagstate);
+SFH_OP_MODE_ATTR(on_table_state, ontablestate);
+SFH_OP_MODE_ATTR(hinge_angle, angle);
+SFH_OP_MODE_ATTR(lid_status, lidstatus);
+SFH_OP_MODE_ATTR(device_mode, devicemode);
+
static umode_t sfh_attr_is_visible(struct kobject *kobj, struct attribute *attr, int idx)
{
struct device *dev = kobj_to_dev(kobj);
struct amd_mp2_dev *mp2 = dev_get_drvdata(dev);
- if (!mp2->sfh1_1_ops || !mp2->dev_en.is_hpd_present)
+ if (!mp2->sfh1_1_ops)
+ return 0;
+
+ if (attr == &dev_attr_hpd.attr) {
+ if (!mp2->dev_en.is_hpd_present)
+ return 0;
+ } else if (!mp2->dev_en.is_sra_present) {
+ /* operating-mode telemetry requires the SRA sensor */
return 0;
+ }
return attr->mode;
}
static struct attribute *sfh_attrs[] = {
&dev_attr_hpd.attr,
+ &dev_attr_in_bag_state.attr,
+ &dev_attr_out_bag_state.attr,
+ &dev_attr_on_table_state.attr,
+ &dev_attr_hinge_angle.attr,
+ &dev_attr_lid_status.attr,
+ &dev_attr_device_mode.attr,
NULL,
};
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH -next v2 2/4] HID: amd_sfh: Add operating-mode telemetry sysfs attributes
2026-10-06 10:37 ` [PATCH -next v2 2/4] HID: amd_sfh: Add operating-mode telemetry sysfs attributes Basavaraj Natikar
@ 2026-10-06 10:50 ` sashiko-bot
0 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-10-06 10:50 UTC (permalink / raw)
To: Basavaraj Natikar; +Cc: dmitry.torokhov, linux-input
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] hid: non-atomic copy into mismatched struct for SRA data
- [Low] hid: build failure due to non-existent c2p3_data member
--
commit ee7fce24f1e5a01f6f7e6e6cd19e09582b434ae4
Author: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
HID: amd_sfh: Add operating-mode telemetry sysfs attributes
The Sensor Fusion Hub reports additional operating-mode telemetry through
the SRA sensor. This commit exposes these states read-only through sysfs
so that userspace can consume them.
> diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_sysfs.c b/drivers/hid/amd-sfh-hid/amd_sfh_sysfs.c
> index db1cc205d25b9..8af4df09760f0 100644
> --- a/drivers/hid/amd-sfh-hid/amd_sfh_sysfs.c
> +++ b/drivers/hid/amd-sfh-hid/amd_sfh_sysfs.c
[ ... ]
> @@ -41,19 +43,78 @@ static ssize_t hpd_store(struct device *dev,
> }
> static DEVICE_ATTR_RW(hpd);
>
> +/* Operating-mode telemetry reported by the SRA sensor, exposed read-only. */
> +static int amd_sfh_read_op_mode(struct amd_mp2_dev *mp2, struct sfh_op_mode *mode)
> +{
> + struct sfh_accel_data accel_data;
> + void __iomem *sensoraddr;
> +
> + if (!mp2->sfh1_1_ops || !mp2->dev_en.is_sra_present)
> + return -ENODEV;
> +
> + if (mp2->mp2_ver >= MP2_VER_1_2) {
> + sensoraddr = mp2->vsbase +
> + (SRA_IDX * SENSOR_DATA_MEM_SIZE_DEFAULT) +
> + OFFSET_SENSOR_DATA_DEFAULT;
> + memcpy_fromio(&accel_data, sensoraddr, sizeof(struct sfh_accel_data));
[Severity: Medium]
Does amd_sfh_read_op_mode() perform a multi-byte, non-atomic bulk I/O copy
from shared hardware memory using the wrong struct type (accelerometer instead
of SRA)?
Reading any of the new SRA telemetry sysfs attributes on a device with MP2
version >= 1.2 could risk torn reads from concurrent hardware updates.
Could a targeted, atomic readl() be used instead to read the single 32-bit
register value?
> + mode->val = accel_data.c2p3_data;
[Severity: Low]
Does struct sfh_accel_data have a c2p3_data member?
It appears this member does not exist, which causes an immediate compilation
failure when compiling the amd_sfh module.
> + } else {
> + mode->val = readl(mp2->mmio + amd_get_c2p_val(mp2, 3));
> + }
> +
> + return 0;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261006103754.3614316-1-Basavaraj.Natikar@amd.com?part=2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH -next v2 3/4] HID: amd_sfh: Remove unsupported motion-state field from accelerometer report
2026-10-06 10:37 [PATCH -next v2 0/4] HID: amd_sfh: operating-mode telemetry sysfs and report fixes Basavaraj Natikar
2026-10-06 10:37 ` [PATCH -next v2 1/4] HID: amd_sfh: Move sysfs attributes to a separate file Basavaraj Natikar
2026-10-06 10:37 ` [PATCH -next v2 2/4] HID: amd_sfh: Add operating-mode telemetry sysfs attributes Basavaraj Natikar
@ 2026-10-06 10:37 ` Basavaraj Natikar
2026-10-06 10:37 ` [PATCH -next v2 4/4] HID: amd_sfh: Use report type from request node Basavaraj Natikar
3 siblings, 0 replies; 7+ messages in thread
From: Basavaraj Natikar @ 2026-10-06 10:37 UTC (permalink / raw)
To: jikos, bentiss; +Cc: linux-input, Basavaraj Natikar, Andrej Scek, stable
The accelerometer HID report descriptor declares a trailing motion-state
field (usage 0x0451), but the Sensor Fusion Hub never reports this data,
so each accelerometer input report is one byte shorter than the descriptor
advertises.
This was previously harmless because hid-core zero-padded short reports.
Since commit 0a3fe972a7cb ("HID: core: Mitigate potential OOB by removing
bogus memset()") such reports are rejected instead:
hid-sensor-hub 0020:1022:0001.0003: Event data for report 1 was too short (15 vs 14)
As a result the accelerometer input events are dropped and screen
auto-rotation stops working on AMD SFH systems.
Remove the motion-state field from the accelerometer report descriptor and
drop the unused in_accel_shake_detection member, so the descriptor matches
the report actually provided by the hardware.
Fixes: 1434f9fc0e47 ("SFH: Create HID report to Enable support of AMD sensor fusion Hub (SFH)")
Reported-by: Andrej Scek <scek.andrej@gmail.com>
Closes: https://lore.kernel.org/linux-input/CADrS85612m-Hh-G4BJmOhy-y6r3Ni3kD8_GM-2QRBeWWEEZWuA@mail.gmail.com/
Cc: stable@vger.kernel.org
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
---
drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h | 2 --
.../amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h | 7 -------
2 files changed, 9 deletions(-)
diff --git a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h
index 882434b1501f..230fb69cacfd 100644
--- a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h
+++ b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h
@@ -48,8 +48,6 @@ struct accel3_input_report {
int in_accel_x_value;
int in_accel_y_value;
int in_accel_z_value;
- /* include if required to support the "shake" event */
- u8 in_accel_shake_detection;
} __packed;
struct gyro_feature_report {
diff --git a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h
index 67ec2d6a417d..64cff842e5f2 100644
--- a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h
+++ b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h
@@ -169,13 +169,6 @@ static const u8 accel3_report_descriptor[] = {
0x95, 1, /* HID report count (1) */
0x55, 0x0E, /* HID unit exponent(0x0E) */
0X81, 0x02, /* HID Input (Data_Arr_Abs) */
-
-0x0A, 0x51, 0x04, /* HID usage sensor data motion state */
-0x15, 0, /* HID logical Min_8(0) False = Still*/
-0x25, 1, /* HID logical Min_8(1) True = In motion */
-0x75, 8, /* HID report size(8) */
-0x95, 1, /* HID report count (1) */
-0X81, 0x02, /* HID Input (Data_Arr_Abs) */
0xC0 /* HID end collection */
};
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH -next v2 4/4] HID: amd_sfh: Use report type from request node
2026-10-06 10:37 [PATCH -next v2 0/4] HID: amd_sfh: operating-mode telemetry sysfs and report fixes Basavaraj Natikar
` (2 preceding siblings ...)
2026-10-06 10:37 ` [PATCH -next v2 3/4] HID: amd_sfh: Remove unsupported motion-state field from accelerometer report Basavaraj Natikar
@ 2026-10-06 10:37 ` Basavaraj Natikar
2026-10-06 10:51 ` sashiko-bot
3 siblings, 1 reply; 7+ messages in thread
From: Basavaraj Natikar @ 2026-10-06 10:37 UTC (permalink / raw)
To: jikos, bentiss; +Cc: linux-input, Basavaraj Natikar, stable
Use report type from request node while sending feature and input reports
to HID core. The cli_data report type array is never assigned and
feature reports are sent as input reports.
Fixes: 1434f9fc0e47 ("SFH: Create HID report to Enable support of AMD sensor fusion Hub (SFH)")
Closes: https://github.com/ublue-os/bazzite/issues/5796
Cc: stable@vger.kernel.org
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
---
drivers/hid/amd-sfh-hid/amd_sfh_client.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_client.c b/drivers/hid/amd-sfh-hid/amd_sfh_client.c
index ae6add0b9ce3..a68b275f0456 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_client.c
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_client.c
@@ -95,7 +95,7 @@ void amd_sfh_work(struct work_struct *work)
cli_data->feature_report[current_index]);
if (report_size)
hid_input_report(cli_data->hid_sensor_hubs[current_index],
- cli_data->report_type[current_index],
+ node_type,
cli_data->feature_report[current_index], report_size, 0);
else
pr_err("AMDSFH: Invalid report size\n");
@@ -104,7 +104,7 @@ void amd_sfh_work(struct work_struct *work)
report_size = mp2_ops->get_in_rep(current_index, sensor_index, report_id, in_data);
if (report_size)
hid_input_report(cli_data->hid_sensor_hubs[current_index],
- cli_data->report_type[current_index],
+ node_type,
in_data->input_report[current_index], report_size, 0);
else
pr_err("AMDSFH: Invalid report size\n");
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH -next v2 4/4] HID: amd_sfh: Use report type from request node
2026-10-06 10:37 ` [PATCH -next v2 4/4] HID: amd_sfh: Use report type from request node Basavaraj Natikar
@ 2026-10-06 10:51 ` sashiko-bot
0 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-10-06 10:51 UTC (permalink / raw)
To: Basavaraj Natikar; +Cc: dmitry.torokhov, linux-input
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] amd_sfh: incomplete cleanup of report_type array in amdtp_cl_data
--
commit 8029dfd0564b3015a23fe39f335b6a6e8b4706ba
Author: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
HID: amd_sfh: Use report type from request node
Use report type from request node while sending feature and input reports
to HID core. The cli_data report type array is never assigned and
feature reports are sent as input reports.
Closes: https://github.com/ublue-os/bazzite/issues/5796
> diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_client.c b/drivers/hid/amd-sfh-hid/amd_sfh_client.c
> index ae6add0b9ce3f..a68b275f0456b 100644
> --- a/drivers/hid/amd-sfh-hid/amd_sfh_client.c
> +++ b/drivers/hid/amd-sfh-hid/amd_sfh_client.c
> @@ -95,7 +95,7 @@ void amd_sfh_work(struct work_struct *work)
> cli_data->feature_report[current_index]);
> if (report_size)
> hid_input_report(cli_data->hid_sensor_hubs[current_index],
> - cli_data->report_type[current_index],
> + node_type,
[Severity: Low]
This isn't a bug, but since this patch removes the usage of the report_type
array, should its declaration also be removed from struct amdtp_cl_data?
drivers/hid/amd-sfh-hid/amd_sfh_hid.h:amdtp_cl_data {
...
u32 sensor_requested_cnt[MAX_HID_DEVICES];
u8 report_type[MAX_HID_DEVICES];
u8 report_id[MAX_HID_DEVICES];
...
};
Leaving the declaration wastes a small amount of memory and adds clutter as
dead code.
> cli_data->feature_report[current_index], report_size, 0);
> else
> pr_err("AMDSFH: Invalid report size\n");
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261006103754.3614316-1-Basavaraj.Natikar@amd.com?part=4
^ permalink raw reply [flat|nested] 7+ messages in thread