diff options
Diffstat (limited to 'drivers/iio/common/hid-sensors/hid-sensor-trigger.c')
-rw-r--r-- | drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c index ecf592d69043..60829340a82e 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c | |||
@@ -51,6 +51,8 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state) | |||
51 | st->report_state.report_id, | 51 | st->report_state.report_id, |
52 | st->report_state.index, | 52 | st->report_state.index, |
53 | HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM); | 53 | HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM); |
54 | |||
55 | poll_value = hid_sensor_read_poll_value(st); | ||
54 | } else { | 56 | } else { |
55 | int val; | 57 | int val; |
56 | 58 | ||
@@ -87,9 +89,7 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state) | |||
87 | sensor_hub_get_feature(st->hsdev, st->power_state.report_id, | 89 | sensor_hub_get_feature(st->hsdev, st->power_state.report_id, |
88 | st->power_state.index, | 90 | st->power_state.index, |
89 | sizeof(state_val), &state_val); | 91 | sizeof(state_val), &state_val); |
90 | if (state) | 92 | if (state && poll_value) |
91 | poll_value = hid_sensor_read_poll_value(st); | ||
92 | if (poll_value > 0) | ||
93 | msleep_interruptible(poll_value * 2); | 93 | msleep_interruptible(poll_value * 2); |
94 | 94 | ||
95 | return 0; | 95 | return 0; |
@@ -127,6 +127,20 @@ static void hid_sensor_set_power_work(struct work_struct *work) | |||
127 | struct hid_sensor_common *attrb = container_of(work, | 127 | struct hid_sensor_common *attrb = container_of(work, |
128 | struct hid_sensor_common, | 128 | struct hid_sensor_common, |
129 | work); | 129 | work); |
130 | |||
131 | if (attrb->poll_interval >= 0) | ||
132 | sensor_hub_set_feature(attrb->hsdev, attrb->poll.report_id, | ||
133 | attrb->poll.index, | ||
134 | sizeof(attrb->poll_interval), | ||
135 | &attrb->poll_interval); | ||
136 | |||
137 | if (attrb->raw_hystersis >= 0) | ||
138 | sensor_hub_set_feature(attrb->hsdev, | ||
139 | attrb->sensitivity.report_id, | ||
140 | attrb->sensitivity.index, | ||
141 | sizeof(attrb->raw_hystersis), | ||
142 | &attrb->raw_hystersis); | ||
143 | |||
130 | _hid_sensor_power_state(attrb, true); | 144 | _hid_sensor_power_state(attrb, true); |
131 | } | 145 | } |
132 | 146 | ||