Commit 7d3c192d authored by Srinivas Pandruvada's avatar Srinivas Pandruvada Committed by Jonathan Cameron

IIO: call sensor hub open close function

Call hid_sensor_hub_device_open when user space opens device and call
hid_sensor_hub_device_close when device is closed. This helps in
saving power.
Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 1df3a401
...@@ -34,6 +34,12 @@ static int hid_sensor_data_rdy_trigger_set_state(struct iio_trigger *trig, ...@@ -34,6 +34,12 @@ static int hid_sensor_data_rdy_trigger_set_state(struct iio_trigger *trig,
struct hid_sensor_common *st = iio_trigger_get_drvdata(trig); struct hid_sensor_common *st = iio_trigger_get_drvdata(trig);
int state_val; int state_val;
if (state) {
if (sensor_hub_device_open(st->hsdev))
return -EIO;
} else
sensor_hub_device_close(st->hsdev);
state_val = state ? 1 : 0; state_val = state ? 1 : 0;
if (IS_ENABLED(CONFIG_HID_SENSOR_ENUM_BASE_QUIRKS)) if (IS_ENABLED(CONFIG_HID_SENSOR_ENUM_BASE_QUIRKS))
++state_val; ++state_val;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment