]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
d2aee784689fe1c872f045d02424873ef3d7191c
[thirdparty/kernel/stable-queue.git] /
1 From 3bec247474469f769af41e8c80d3a100dd97dd76 Mon Sep 17 00:00:00 2001
2 From: Song Hongyan <hongyan.song@intel.com>
3 Date: Wed, 22 Feb 2017 17:17:38 +0800
4 Subject: iio: hid-sensor-trigger: Change get poll value function order to avoid sensor properties losing after resume from S3
5
6 From: Song Hongyan <hongyan.song@intel.com>
7
8 commit 3bec247474469f769af41e8c80d3a100dd97dd76 upstream.
9
10 In function _hid_sensor_power_state(), when hid_sensor_read_poll_value()
11 is called, sensor's all properties will be updated by the value from
12 sensor hardware/firmware.
13 In some implementation, sensor hardware/firmware will do a power cycle
14 during S3. In this case, after resume, once hid_sensor_read_poll_value()
15 is called, sensor's all properties which are kept by driver during S3
16 will be changed to default value.
17 But instead, if a set feature function is called first, sensor
18 hardware/firmware will be recovered to the last status. So change the
19 sensor_hub_set_feature() calling order to behind of set feature function
20 to avoid sensor properties lose.
21
22 Signed-off-by: Song Hongyan <hongyan.song@intel.com>
23 Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
24 Signed-off-by: Jonathan Cameron <jic23@kernel.org>
25 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
26
27 ---
28 drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 6 +++---
29 1 file changed, 3 insertions(+), 3 deletions(-)
30
31 --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
32 +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
33 @@ -51,8 +51,6 @@ static int _hid_sensor_power_state(struc
34 st->report_state.report_id,
35 st->report_state.index,
36 HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM);
37 -
38 - poll_value = hid_sensor_read_poll_value(st);
39 } else {
40 int val;
41
42 @@ -89,7 +87,9 @@ static int _hid_sensor_power_state(struc
43 sensor_hub_get_feature(st->hsdev, st->power_state.report_id,
44 st->power_state.index,
45 sizeof(state_val), &state_val);
46 - if (state && poll_value)
47 + if (state)
48 + poll_value = hid_sensor_read_poll_value(st);
49 + if (poll_value > 0)
50 msleep_interruptible(poll_value * 2);
51
52 return 0;