linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: hid-sensor-prox: Add support for 16-bit report size
@ 2025-03-17  1:36 Zhang Lixu
  2025-03-17 12:20 ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang Lixu @ 2025-03-17  1:36 UTC (permalink / raw)
  To: jic23, jikos, srinivas.pandruvada, lars, linux-input, linux-iio,
	linux-kernel
  Cc: lixu.zhang

On Intel platforms, the HID_USAGE_SENSOR_HUMAN_PROXIMITY report size is 16
bits. This patch adds support for handling 16-bit report sizes for the
HID_USAGE_SENSOR_HUMAN_PROXIMITY usage in the HID sensor proximity driver.

Previously, the driver only supported 8-bit and 32-bit report sizes. With
this change, the driver can now correctly process 16-bit proximity data,
ensuring accurate human presence detection on platforms where this report
size is used.

Signed-off-by: Zhang Lixu <lixu.zhang@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
 drivers/iio/light/hid-sensor-prox.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c
index 76b76d12b388..3a7b48803d50 100644
--- a/drivers/iio/light/hid-sensor-prox.c
+++ b/drivers/iio/light/hid-sensor-prox.c
@@ -213,6 +213,9 @@ static int prox_capture_sample(struct hid_sensor_hub_device *hsdev,
 	case 1:
 		prox_state->human_presence[chan] = *(u8 *)raw_data * multiplier;
 		return 0;
+	case 2:
+		prox_state->human_presence[chan] = *(u16 *)raw_data * multiplier;
+		return 0;
 	case 4:
 		prox_state->human_presence[chan] = *(u32 *)raw_data * multiplier;
 		return 0;

base-commit: eea255893718268e1ab852fb52f70c613d109b99
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-03-18  0:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-17  1:36 [PATCH] iio: hid-sensor-prox: Add support for 16-bit report size Zhang Lixu
2025-03-17 12:20 ` Jonathan Cameron
2025-03-18  0:56   ` Zhang, Lixu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).