aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/gyro
diff options
context:
space:
mode:
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>2015-01-07 13:55:55 -0500
committerJonathan Cameron <jic23@kernel.org>2015-01-25 17:55:45 -0500
commit27ce4239367793f1f008d2f3dac10e3987b9ecd4 (patch)
tree21738625645aa1a4bbf9f8b4c000f6429ae5f1ff /drivers/iio/gyro
parentcbbcc937090b0d3137eac58759480b13d73f159d (diff)
iio: hid-sensor-gyro-3d: Introduce PM
Use common hid sensor iio pm functions. Also the poll time read and wait is part of power up function of hid sensor iio pm function, so remove from the client drivers. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/gyro')
-rw-r--r--drivers/iio/gyro/hid-sensor-gyro-3d.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c
index a3ea1e8785d7..a3c3e19de527 100644
--- a/drivers/iio/gyro/hid-sensor-gyro-3d.c
+++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c
@@ -111,19 +111,12 @@ static int gyro_3d_read_raw(struct iio_dev *indio_dev,
111 int report_id = -1; 111 int report_id = -1;
112 u32 address; 112 u32 address;
113 int ret_type; 113 int ret_type;
114 s32 poll_value;
115 114
116 *val = 0; 115 *val = 0;
117 *val2 = 0; 116 *val2 = 0;
118 switch (mask) { 117 switch (mask) {
119 case 0: 118 case 0:
120 poll_value = hid_sensor_read_poll_value(
121 &gyro_state->common_attributes);
122 if (poll_value < 0)
123 return -EINVAL;
124
125 hid_sensor_power_state(&gyro_state->common_attributes, true); 119 hid_sensor_power_state(&gyro_state->common_attributes, true);
126 msleep_interruptible(poll_value * 2);
127 report_id = gyro_state->gyro[chan->scan_index].report_id; 120 report_id = gyro_state->gyro[chan->scan_index].report_id;
128 address = gyro_3d_addresses[chan->scan_index]; 121 address = gyro_3d_addresses[chan->scan_index];
129 if (report_id >= 0) 122 if (report_id >= 0)
@@ -416,6 +409,7 @@ static struct platform_driver hid_gyro_3d_platform_driver = {
416 .id_table = hid_gyro_3d_ids, 409 .id_table = hid_gyro_3d_ids,
417 .driver = { 410 .driver = {
418 .name = KBUILD_MODNAME, 411 .name = KBUILD_MODNAME,
412 .pm = &hid_sensor_pm_ops,
419 }, 413 },
420 .probe = hid_gyro_3d_probe, 414 .probe = hid_gyro_3d_probe,
421 .remove = hid_gyro_3d_remove, 415 .remove = hid_gyro_3d_remove,