diff options
Diffstat (limited to 'drivers/iio/common')
-rw-r--r-- | drivers/iio/common/hid-sensors/Kconfig | 9 | ||||
-rw-r--r-- | drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 20 |
2 files changed, 15 insertions, 14 deletions
diff --git a/drivers/iio/common/hid-sensors/Kconfig b/drivers/iio/common/hid-sensors/Kconfig index 1178121b55b0..39188b72cd3b 100644 --- a/drivers/iio/common/hid-sensors/Kconfig +++ b/drivers/iio/common/hid-sensors/Kconfig | |||
@@ -25,13 +25,4 @@ config HID_SENSOR_IIO_TRIGGER | |||
25 | If this driver is compiled as a module, it will be named | 25 | If this driver is compiled as a module, it will be named |
26 | hid-sensor-trigger. | 26 | hid-sensor-trigger. |
27 | 27 | ||
28 | config HID_SENSOR_ENUM_BASE_QUIRKS | ||
29 | bool "ENUM base quirks for HID Sensor IIO drivers" | ||
30 | depends on HID_SENSOR_IIO_COMMON | ||
31 | help | ||
32 | Say yes here to build support for sensor hub FW using | ||
33 | enumeration, which is using 1 as base instead of 0. | ||
34 | Since logical minimum is still set 0 instead of 1, | ||
35 | there is no easy way to differentiate. | ||
36 | |||
37 | endmenu | 28 | endmenu |
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c index bbd6426c9726..7dcf83998e6f 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c | |||
@@ -33,24 +33,34 @@ static int hid_sensor_data_rdy_trigger_set_state(struct iio_trigger *trig, | |||
33 | { | 33 | { |
34 | struct hid_sensor_common *st = iio_trigger_get_drvdata(trig); | 34 | struct hid_sensor_common *st = iio_trigger_get_drvdata(trig); |
35 | int state_val; | 35 | int state_val; |
36 | int report_val; | ||
36 | 37 | ||
37 | if (state) { | 38 | if (state) { |
38 | if (sensor_hub_device_open(st->hsdev)) | 39 | if (sensor_hub_device_open(st->hsdev)) |
39 | return -EIO; | 40 | return -EIO; |
40 | } else | 41 | state_val = |
42 | HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM; | ||
43 | report_val = | ||
44 | HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM; | ||
45 | |||
46 | } else { | ||
41 | sensor_hub_device_close(st->hsdev); | 47 | sensor_hub_device_close(st->hsdev); |
48 | state_val = | ||
49 | HID_USAGE_SENSOR_PROP_POWER_STATE_D4_POWER_OFF_ENUM; | ||
50 | report_val = | ||
51 | HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS_ENUM; | ||
52 | } | ||
42 | 53 | ||
43 | state_val = state ? 1 : 0; | ||
44 | if (IS_ENABLED(CONFIG_HID_SENSOR_ENUM_BASE_QUIRKS)) | ||
45 | ++state_val; | ||
46 | st->data_ready = state; | 54 | st->data_ready = state; |
55 | state_val += st->power_state.logical_minimum; | ||
56 | report_val += st->report_state.logical_minimum; | ||
47 | sensor_hub_set_feature(st->hsdev, st->power_state.report_id, | 57 | sensor_hub_set_feature(st->hsdev, st->power_state.report_id, |
48 | st->power_state.index, | 58 | st->power_state.index, |
49 | (s32)state_val); | 59 | (s32)state_val); |
50 | 60 | ||
51 | sensor_hub_set_feature(st->hsdev, st->report_state.report_id, | 61 | sensor_hub_set_feature(st->hsdev, st->report_state.report_id, |
52 | st->report_state.index, | 62 | st->report_state.index, |
53 | (s32)state_val); | 63 | (s32)report_val); |
54 | 64 | ||
55 | return 0; | 65 | return 0; |
56 | } | 66 | } |