diff options
author | Song Hongyan <hongyan.song@intel.com> | 2017-02-22 04:17:38 -0500 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2017-03-05 05:26:47 -0500 |
commit | 3bec247474469f769af41e8c80d3a100dd97dd76 (patch) | |
tree | 46aa75b1a3470ece108e23a51b77f95ce9fea9af /drivers | |
parent | 2d62e0768d3c28536d4cfe4c40ba1e5e8e442a93 (diff) |
iio: hid-sensor-trigger: Change get poll value function order to avoid sensor properties losing after resume from S3
In function _hid_sensor_power_state(), when hid_sensor_read_poll_value()
is called, sensor's all properties will be updated by the value from
sensor hardware/firmware.
In some implementation, sensor hardware/firmware will do a power cycle
during S3. In this case, after resume, once hid_sensor_read_poll_value()
is called, sensor's all properties which are kept by driver during S3
will be changed to default value.
But instead, if a set feature function is called first, sensor
hardware/firmware will be recovered to the last status. So change the
sensor_hub_set_feature() calling order to behind of set feature function
to avoid sensor properties lose.
Signed-off-by: Song Hongyan <hongyan.song@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 6 |
1 files changed, 3 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 a3cce3a38300..ecf592d69043 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c | |||
@@ -51,8 +51,6 @@ 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); | ||
56 | } else { | 54 | } else { |
57 | int val; | 55 | int val; |
58 | 56 | ||
@@ -89,7 +87,9 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state) | |||
89 | sensor_hub_get_feature(st->hsdev, st->power_state.report_id, | 87 | sensor_hub_get_feature(st->hsdev, st->power_state.report_id, |
90 | st->power_state.index, | 88 | st->power_state.index, |
91 | sizeof(state_val), &state_val); | 89 | sizeof(state_val), &state_val); |
92 | if (state && poll_value) | 90 | if (state) |
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; |