summaryrefslogtreecommitdiff
path: root/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2014-01-23 08:10:44 -0800
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2014-01-23 08:10:44 -0800
commit55df811f2066fcaec2548248f0a1a6a0c12dc6b8 (patch)
tree0850f490489e5b941692f3fe36dff5d2c1c35c3c /drivers/iio/common/hid-sensors/hid-sensor-trigger.c
parent8e2f2325b73f3e5e46ecffd291556f33b8e3f8c9 (diff)
parent497ab1f290a26fa9414c5c316515f1e2ddba0803 (diff)
Merge branch 'next' into for-linus
First round of input updates for 3.14.
Diffstat (limited to 'drivers/iio/common/hid-sensors/hid-sensor-trigger.c')
-rw-r--r--drivers/iio/common/hid-sensors/hid-sensor-trigger.c20
1 files changed, 15 insertions, 5 deletions
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,
{
struct hid_sensor_common *st = iio_trigger_get_drvdata(trig);
int state_val;
+ int report_val;
if (state) {
if (sensor_hub_device_open(st->hsdev))
return -EIO;
- } else
+ state_val =
+ HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM;
+ report_val =
+ HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM;
+
+ } else {
sensor_hub_device_close(st->hsdev);
+ state_val =
+ HID_USAGE_SENSOR_PROP_POWER_STATE_D4_POWER_OFF_ENUM;
+ report_val =
+ HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS_ENUM;
+ }
- state_val = state ? 1 : 0;
- if (IS_ENABLED(CONFIG_HID_SENSOR_ENUM_BASE_QUIRKS))
- ++state_val;
st->data_ready = state;
+ state_val += st->power_state.logical_minimum;
+ report_val += st->report_state.logical_minimum;
sensor_hub_set_feature(st->hsdev, st->power_state.report_id,
st->power_state.index,
(s32)state_val);
sensor_hub_set_feature(st->hsdev, st->report_state.report_id,
st->report_state.index,
- (s32)state_val);
+ (s32)report_val);
return 0;
}