diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2023-02-22 22:24:42 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2023-02-22 22:24:42 +0300 |
commit | 6c71297eaf713ece684a367ce9aff06069d715b9 (patch) | |
tree | da6f4768868ec6c9ba90a89c88fc78560577348f /drivers/iio | |
parent | d5176cdbf64ce7d4eebf339205f17c23118e9f72 (diff) | |
parent | 904e28c6de083fa4834cdbd0026470ddc30676fc (diff) | |
download | linux-6c71297eaf713ece684a367ce9aff06069d715b9.tar.xz |
Merge tag 'for-linus-2023022201' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID updates from Benjamin Tissoires:
- HID-BPF infrastructure: this allows to start using HID-BPF. Note that
the mechanism to ship HID-BPF program through the kernel tree is
still not implemented yet (but is planned).
This should be a no-op for 99% of users. Also we are gaining
kselftests for the HID tree (Benjamin Tissoires)
- Some UAF fixes in workers when using uhid (Pietro Borrello & Benjamin
Tissoires)
- Constify hid_ll_driver (Thomas Weißschuh)
- Allow more custom IIO sensors through HID (Philipp Jungkamp)
- Logitech HID++ fixes for scroll wheel, protocol and debug (Bastien
Nocera)
- Some new device support: Steam Deck (Vicki Pfau), UClogic (José
Expósito), Logitech G923 Xbox Edition steering wheel (Walt Holman),
EVision keyboards (Philippe Valembois)
- other assorted code cleanups and fixes
* tag 'for-linus-2023022201' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: (99 commits)
HID: mcp-2221: prevent UAF in delayed work
hid: bigben_probe(): validate report count
HID: asus: use spinlock to safely schedule workers
HID: asus: use spinlock to protect concurrent accesses
HID: bigben: use spinlock to safely schedule workers
HID: bigben_worker() remove unneeded check on report_field
HID: bigben: use spinlock to protect concurrent accesses
HID: logitech-hidpp: Add myself to authors
HID: logitech-hidpp: Retry commands when device is busy
HID: logitech-hidpp: Add more debug statements
HID: Add support for Logitech G923 Xbox Edition steering wheel
HID: logitech-hidpp: Add Signature M650
HID: logitech-hidpp: Remove HIDPP_QUIRK_NO_HIDINPUT quirk
HID: logitech-hidpp: Don't restart communication if not necessary
HID: logitech-hidpp: Add constants for HID++ 2.0 error codes
Revert "HID: logitech-hidpp: add a module parameter to keep firmware gestures"
HID: logitech-hidpp: Hard-code HID++ 1.0 fast scroll support
HID: i2c-hid: goodix: Add mainboard-vddio-supply
dt-bindings: HID: i2c-hid: goodix: Add mainboard-vddio-supply
HID: i2c-hid: goodix: Stop tying the reset line to the regulator
...
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/light/hid-sensor-als.c | 27 | ||||
-rw-r--r-- | drivers/iio/light/hid-sensor-prox.c | 37 |
2 files changed, 37 insertions, 27 deletions
diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c index 5a1a625d8d16..eb1aedad7edc 100644 --- a/drivers/iio/light/hid-sensor-als.c +++ b/drivers/iio/light/hid-sensor-als.c @@ -86,6 +86,7 @@ static int als_read_raw(struct iio_dev *indio_dev, long mask) { struct als_state *als_state = iio_priv(indio_dev); + struct hid_sensor_hub_device *hsdev = als_state->common_attributes.hsdev; int report_id = -1; u32 address; int ret_type; @@ -110,11 +111,8 @@ static int als_read_raw(struct iio_dev *indio_dev, hid_sensor_power_state(&als_state->common_attributes, true); *val = sensor_hub_input_attr_get_raw_value( - als_state->common_attributes.hsdev, - HID_USAGE_SENSOR_ALS, address, - report_id, - SENSOR_HUB_SYNC, - min < 0); + hsdev, hsdev->usage, address, report_id, + SENSOR_HUB_SYNC, min < 0); hid_sensor_power_state(&als_state->common_attributes, false); } else { @@ -259,9 +257,7 @@ static int als_parse_report(struct platform_device *pdev, dev_dbg(&pdev->dev, "als %x:%x\n", st->als_illum.index, st->als_illum.report_id); - st->scale_precision = hid_sensor_format_scale( - HID_USAGE_SENSOR_ALS, - &st->als_illum, + st->scale_precision = hid_sensor_format_scale(usage_id, &st->als_illum, &st->scale_pre_decml, &st->scale_post_decml); return ret; @@ -285,7 +281,8 @@ static int hid_als_probe(struct platform_device *pdev) als_state->common_attributes.hsdev = hsdev; als_state->common_attributes.pdev = pdev; - ret = hid_sensor_parse_common_attributes(hsdev, HID_USAGE_SENSOR_ALS, + ret = hid_sensor_parse_common_attributes(hsdev, + hsdev->usage, &als_state->common_attributes, als_sensitivity_addresses, ARRAY_SIZE(als_sensitivity_addresses)); @@ -303,7 +300,8 @@ static int hid_als_probe(struct platform_device *pdev) ret = als_parse_report(pdev, hsdev, (struct iio_chan_spec *)indio_dev->channels, - HID_USAGE_SENSOR_ALS, als_state); + hsdev->usage, + als_state); if (ret) { dev_err(&pdev->dev, "failed to setup attributes\n"); return ret; @@ -333,8 +331,7 @@ static int hid_als_probe(struct platform_device *pdev) als_state->callbacks.send_event = als_proc_event; als_state->callbacks.capture_sample = als_capture_sample; als_state->callbacks.pdev = pdev; - ret = sensor_hub_register_callback(hsdev, HID_USAGE_SENSOR_ALS, - &als_state->callbacks); + ret = sensor_hub_register_callback(hsdev, hsdev->usage, &als_state->callbacks); if (ret < 0) { dev_err(&pdev->dev, "callback reg failed\n"); goto error_iio_unreg; @@ -356,7 +353,7 @@ static int hid_als_remove(struct platform_device *pdev) struct iio_dev *indio_dev = platform_get_drvdata(pdev); struct als_state *als_state = iio_priv(indio_dev); - sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_ALS); + sensor_hub_remove_callback(hsdev, hsdev->usage); iio_device_unregister(indio_dev); hid_sensor_remove_trigger(indio_dev, &als_state->common_attributes); @@ -368,6 +365,10 @@ static const struct platform_device_id hid_als_ids[] = { /* Format: HID-SENSOR-usage_id_in_hex_lowercase */ .name = "HID-SENSOR-200041", }, + { + /* Format: HID-SENSOR-custom_sensor_tag-usage_id_in_hex_lowercase */ + .name = "HID-SENSOR-LISS-0041", + }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(platform, hid_als_ids); diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c index f10fa2abfe72..a47591e1bad9 100644 --- a/drivers/iio/light/hid-sensor-prox.c +++ b/drivers/iio/light/hid-sensor-prox.c @@ -61,6 +61,7 @@ static int prox_read_raw(struct iio_dev *indio_dev, long mask) { struct prox_state *prox_state = iio_priv(indio_dev); + struct hid_sensor_hub_device *hsdev; int report_id = -1; u32 address; int ret_type; @@ -75,6 +76,7 @@ static int prox_read_raw(struct iio_dev *indio_dev, report_id = prox_state->prox_attr.report_id; min = prox_state->prox_attr.logical_minimum; address = HID_USAGE_SENSOR_HUMAN_PRESENCE; + hsdev = prox_state->common_attributes.hsdev; break; default: report_id = -1; @@ -84,11 +86,8 @@ static int prox_read_raw(struct iio_dev *indio_dev, hid_sensor_power_state(&prox_state->common_attributes, true); *val = sensor_hub_input_attr_get_raw_value( - prox_state->common_attributes.hsdev, - HID_USAGE_SENSOR_PROX, address, - report_id, - SENSOR_HUB_SYNC, - min < 0); + hsdev, hsdev->usage, address, report_id, + SENSOR_HUB_SYNC, min < 0); hid_sensor_power_state(&prox_state->common_attributes, false); } else { @@ -191,10 +190,16 @@ static int prox_capture_sample(struct hid_sensor_hub_device *hsdev, switch (usage_id) { case HID_USAGE_SENSOR_HUMAN_PRESENCE: - prox_state->human_presence = *(u32 *)raw_data; - ret = 0; - break; - default: + switch (raw_len) { + case 1: + prox_state->human_presence = *(u8 *)raw_data; + return 0; + case 4: + prox_state->human_presence = *(u32 *)raw_data; + return 0; + default: + break; + } break; } @@ -244,7 +249,7 @@ static int hid_prox_probe(struct platform_device *pdev) prox_state->common_attributes.hsdev = hsdev; prox_state->common_attributes.pdev = pdev; - ret = hid_sensor_parse_common_attributes(hsdev, HID_USAGE_SENSOR_PROX, + ret = hid_sensor_parse_common_attributes(hsdev, hsdev->usage, &prox_state->common_attributes, prox_sensitivity_addresses, ARRAY_SIZE(prox_sensitivity_addresses)); @@ -262,7 +267,7 @@ static int hid_prox_probe(struct platform_device *pdev) ret = prox_parse_report(pdev, hsdev, (struct iio_chan_spec *)indio_dev->channels, - HID_USAGE_SENSOR_PROX, prox_state); + hsdev->usage, prox_state); if (ret) { dev_err(&pdev->dev, "failed to setup attributes\n"); return ret; @@ -291,8 +296,8 @@ static int hid_prox_probe(struct platform_device *pdev) prox_state->callbacks.send_event = prox_proc_event; prox_state->callbacks.capture_sample = prox_capture_sample; prox_state->callbacks.pdev = pdev; - ret = sensor_hub_register_callback(hsdev, HID_USAGE_SENSOR_PROX, - &prox_state->callbacks); + ret = sensor_hub_register_callback(hsdev, hsdev->usage, + &prox_state->callbacks); if (ret < 0) { dev_err(&pdev->dev, "callback reg failed\n"); goto error_iio_unreg; @@ -314,7 +319,7 @@ static int hid_prox_remove(struct platform_device *pdev) struct iio_dev *indio_dev = platform_get_drvdata(pdev); struct prox_state *prox_state = iio_priv(indio_dev); - sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_PROX); + sensor_hub_remove_callback(hsdev, hsdev->usage); iio_device_unregister(indio_dev); hid_sensor_remove_trigger(indio_dev, &prox_state->common_attributes); @@ -326,6 +331,10 @@ static const struct platform_device_id hid_prox_ids[] = { /* Format: HID-SENSOR-usage_id_in_hex_lowercase */ .name = "HID-SENSOR-200011", }, + { + /* Format: HID-SENSOR-tag-usage_id_in_hex_lowercase */ + .name = "HID-SENSOR-LISS-0226", + }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(platform, hid_prox_ids); |