aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2015-04-13 17:43:34 -0400
committerJiri Kosina <jkosina@suse.cz>2015-04-13 17:43:34 -0400
commit2e455c27bddbf8cf6d1039daea40de8e6865c453 (patch)
tree3fd892aeae61b105e3c5c979550aabf54109a656 /drivers/iio
parent05f6d02521d4c7a656c5135d6d81c345ce531ac0 (diff)
parentb2eafd7282fdfd148fc09032540b0ff42bfedfbf (diff)
Merge branch 'for-4.1/sensor-hub' into for-linus
Conflicts: drivers/iio/common/hid-sensors/hid-sensor-trigger.c include/linux/hid-sensor-hub.h
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/accel/hid-sensor-accel-3d.c3
-rw-r--r--drivers/iio/common/hid-sensors/hid-sensor-attributes.c24
-rw-r--r--drivers/iio/common/hid-sensors/hid-sensor-trigger.c13
-rw-r--r--drivers/iio/gyro/hid-sensor-gyro-3d.c3
-rw-r--r--drivers/iio/light/hid-sensor-als.c3
-rw-r--r--drivers/iio/light/hid-sensor-prox.c3
-rw-r--r--drivers/iio/magnetometer/hid-sensor-magn-3d.c3
-rw-r--r--drivers/iio/orientation/hid-sensor-incl-3d.c3
-rw-r--r--drivers/iio/pressure/hid-sensor-press.c3
9 files changed, 33 insertions, 25 deletions
diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hid-sensor-accel-3d.c
index df6a593bd4bd..2b4fad6998c1 100644
--- a/drivers/iio/accel/hid-sensor-accel-3d.c
+++ b/drivers/iio/accel/hid-sensor-accel-3d.c
@@ -123,7 +123,8 @@ static int accel_3d_read_raw(struct iio_dev *indio_dev,
123 *val = sensor_hub_input_attr_get_raw_value( 123 *val = sensor_hub_input_attr_get_raw_value(
124 accel_state->common_attributes.hsdev, 124 accel_state->common_attributes.hsdev,
125 HID_USAGE_SENSOR_ACCEL_3D, address, 125 HID_USAGE_SENSOR_ACCEL_3D, address,
126 report_id); 126 report_id,
127 SENSOR_HUB_SYNC);
127 else { 128 else {
128 *val = 0; 129 *val = 0;
129 hid_sensor_power_state(&accel_state->common_attributes, 130 hid_sensor_power_state(&accel_state->common_attributes,
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
index 25b01e156d82..e81f434760f4 100644
--- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
+++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
@@ -153,8 +153,8 @@ s32 hid_sensor_read_poll_value(struct hid_sensor_common *st)
153 int ret; 153 int ret;
154 154
155 ret = sensor_hub_get_feature(st->hsdev, 155 ret = sensor_hub_get_feature(st->hsdev,
156 st->poll.report_id, 156 st->poll.report_id,
157 st->poll.index, &value); 157 st->poll.index, sizeof(value), &value);
158 158
159 if (ret < 0 || value < 0) { 159 if (ret < 0 || value < 0) {
160 return -EINVAL; 160 return -EINVAL;
@@ -174,8 +174,8 @@ int hid_sensor_read_samp_freq_value(struct hid_sensor_common *st,
174 int ret; 174 int ret;
175 175
176 ret = sensor_hub_get_feature(st->hsdev, 176 ret = sensor_hub_get_feature(st->hsdev,
177 st->poll.report_id, 177 st->poll.report_id,
178 st->poll.index, &value); 178 st->poll.index, sizeof(value), &value);
179 if (ret < 0 || value < 0) { 179 if (ret < 0 || value < 0) {
180 *val1 = *val2 = 0; 180 *val1 = *val2 = 0;
181 return -EINVAL; 181 return -EINVAL;
@@ -212,9 +212,8 @@ int hid_sensor_write_samp_freq_value(struct hid_sensor_common *st,
212 else 212 else
213 value = 0; 213 value = 0;
214 } 214 }
215 ret = sensor_hub_set_feature(st->hsdev, 215 ret = sensor_hub_set_feature(st->hsdev, st->poll.report_id,
216 st->poll.report_id, 216 st->poll.index, sizeof(value), &value);
217 st->poll.index, value);
218 if (ret < 0 || value < 0) 217 if (ret < 0 || value < 0)
219 ret = -EINVAL; 218 ret = -EINVAL;
220 219
@@ -229,8 +228,9 @@ int hid_sensor_read_raw_hyst_value(struct hid_sensor_common *st,
229 int ret; 228 int ret;
230 229
231 ret = sensor_hub_get_feature(st->hsdev, 230 ret = sensor_hub_get_feature(st->hsdev,
232 st->sensitivity.report_id, 231 st->sensitivity.report_id,
233 st->sensitivity.index, &value); 232 st->sensitivity.index, sizeof(value),
233 &value);
234 if (ret < 0 || value < 0) { 234 if (ret < 0 || value < 0) {
235 *val1 = *val2 = 0; 235 *val1 = *val2 = 0;
236 return -EINVAL; 236 return -EINVAL;
@@ -253,9 +253,9 @@ int hid_sensor_write_raw_hyst_value(struct hid_sensor_common *st,
253 value = convert_to_vtf_format(st->sensitivity.size, 253 value = convert_to_vtf_format(st->sensitivity.size,
254 st->sensitivity.unit_expo, 254 st->sensitivity.unit_expo,
255 val1, val2); 255 val1, val2);
256 ret = sensor_hub_set_feature(st->hsdev, 256 ret = sensor_hub_set_feature(st->hsdev, st->sensitivity.report_id,
257 st->sensitivity.report_id, 257 st->sensitivity.index, sizeof(value),
258 st->sensitivity.index, value); 258 &value);
259 if (ret < 0 || value < 0) 259 if (ret < 0 || value < 0)
260 ret = -EINVAL; 260 ret = -EINVAL;
261 261
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
index 2f1d535b94c4..610fc98f88ef 100644
--- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
+++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
@@ -68,20 +68,21 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state)
68 if (state_val >= 0) { 68 if (state_val >= 0) {
69 state_val += st->power_state.logical_minimum; 69 state_val += st->power_state.logical_minimum;
70 sensor_hub_set_feature(st->hsdev, st->power_state.report_id, 70 sensor_hub_set_feature(st->hsdev, st->power_state.report_id,
71 st->power_state.index, 71 st->power_state.index, sizeof(state_val),
72 (s32)state_val); 72 &state_val);
73 } 73 }
74 74
75 if (report_val >= 0) { 75 if (report_val >= 0) {
76 report_val += st->report_state.logical_minimum; 76 report_val += st->report_state.logical_minimum;
77 sensor_hub_set_feature(st->hsdev, st->report_state.report_id, 77 sensor_hub_set_feature(st->hsdev, st->report_state.report_id,
78 st->report_state.index, 78 st->report_state.index,
79 (s32)report_val); 79 sizeof(report_val),
80 &report_val);
80 } 81 }
81 82
82 sensor_hub_get_feature(st->hsdev, st->power_state.report_id, 83 sensor_hub_get_feature(st->hsdev, st->power_state.report_id,
83 st->power_state.index, 84 st->power_state.index,
84 &state_val); 85 sizeof(state_val), &state_val);
85 if (state && poll_value) 86 if (state && poll_value)
86 msleep_interruptible(poll_value * 2); 87 msleep_interruptible(poll_value * 2);
87 88
diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c
index a3c3e19de527..b5883b6f4e50 100644
--- a/drivers/iio/gyro/hid-sensor-gyro-3d.c
+++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c
@@ -123,7 +123,8 @@ static int gyro_3d_read_raw(struct iio_dev *indio_dev,
123 *val = sensor_hub_input_attr_get_raw_value( 123 *val = sensor_hub_input_attr_get_raw_value(
124 gyro_state->common_attributes.hsdev, 124 gyro_state->common_attributes.hsdev,
125 HID_USAGE_SENSOR_GYRO_3D, address, 125 HID_USAGE_SENSOR_GYRO_3D, address,
126 report_id); 126 report_id,
127 SENSOR_HUB_SYNC);
127 else { 128 else {
128 *val = 0; 129 *val = 0;
129 hid_sensor_power_state(&gyro_state->common_attributes, 130 hid_sensor_power_state(&gyro_state->common_attributes,
diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c
index 948acfc38b8c..1609ecdd01b0 100644
--- a/drivers/iio/light/hid-sensor-als.c
+++ b/drivers/iio/light/hid-sensor-als.c
@@ -101,7 +101,8 @@ static int als_read_raw(struct iio_dev *indio_dev,
101 *val = sensor_hub_input_attr_get_raw_value( 101 *val = sensor_hub_input_attr_get_raw_value(
102 als_state->common_attributes.hsdev, 102 als_state->common_attributes.hsdev,
103 HID_USAGE_SENSOR_ALS, address, 103 HID_USAGE_SENSOR_ALS, address,
104 report_id); 104 report_id,
105 SENSOR_HUB_SYNC);
105 hid_sensor_power_state(&als_state->common_attributes, 106 hid_sensor_power_state(&als_state->common_attributes,
106 false); 107 false);
107 } else { 108 } else {
diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c
index 3ecf79ed08ac..91ecc46ffeaa 100644
--- a/drivers/iio/light/hid-sensor-prox.c
+++ b/drivers/iio/light/hid-sensor-prox.c
@@ -96,7 +96,8 @@ static int prox_read_raw(struct iio_dev *indio_dev,
96 *val = sensor_hub_input_attr_get_raw_value( 96 *val = sensor_hub_input_attr_get_raw_value(
97 prox_state->common_attributes.hsdev, 97 prox_state->common_attributes.hsdev,
98 HID_USAGE_SENSOR_PROX, address, 98 HID_USAGE_SENSOR_PROX, address,
99 report_id); 99 report_id,
100 SENSOR_HUB_SYNC);
100 hid_sensor_power_state(&prox_state->common_attributes, 101 hid_sensor_power_state(&prox_state->common_attributes,
101 false); 102 false);
102 } else { 103 } else {
diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
index d22993b4066a..4f9c0be24451 100644
--- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c
+++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
@@ -170,7 +170,8 @@ static int magn_3d_read_raw(struct iio_dev *indio_dev,
170 *val = sensor_hub_input_attr_get_raw_value( 170 *val = sensor_hub_input_attr_get_raw_value(
171 magn_state->common_attributes.hsdev, 171 magn_state->common_attributes.hsdev,
172 HID_USAGE_SENSOR_COMPASS_3D, address, 172 HID_USAGE_SENSOR_COMPASS_3D, address,
173 report_id); 173 report_id,
174 SENSOR_HUB_SYNC);
174 else { 175 else {
175 *val = 0; 176 *val = 0;
176 hid_sensor_power_state(&magn_state->common_attributes, 177 hid_sensor_power_state(&magn_state->common_attributes,
diff --git a/drivers/iio/orientation/hid-sensor-incl-3d.c b/drivers/iio/orientation/hid-sensor-incl-3d.c
index 73854460bb2c..5930fa32a2ab 100644
--- a/drivers/iio/orientation/hid-sensor-incl-3d.c
+++ b/drivers/iio/orientation/hid-sensor-incl-3d.c
@@ -124,7 +124,8 @@ static int incl_3d_read_raw(struct iio_dev *indio_dev,
124 *val = sensor_hub_input_attr_get_raw_value( 124 *val = sensor_hub_input_attr_get_raw_value(
125 incl_state->common_attributes.hsdev, 125 incl_state->common_attributes.hsdev,
126 HID_USAGE_SENSOR_INCLINOMETER_3D, address, 126 HID_USAGE_SENSOR_INCLINOMETER_3D, address,
127 report_id); 127 report_id,
128 SENSOR_HUB_SYNC);
128 else { 129 else {
129 hid_sensor_power_state(&incl_state->common_attributes, 130 hid_sensor_power_state(&incl_state->common_attributes,
130 false); 131 false);
diff --git a/drivers/iio/pressure/hid-sensor-press.c b/drivers/iio/pressure/hid-sensor-press.c
index 1af314926ebd..7bb8d4c1f7df 100644
--- a/drivers/iio/pressure/hid-sensor-press.c
+++ b/drivers/iio/pressure/hid-sensor-press.c
@@ -100,7 +100,8 @@ static int press_read_raw(struct iio_dev *indio_dev,
100 *val = sensor_hub_input_attr_get_raw_value( 100 *val = sensor_hub_input_attr_get_raw_value(
101 press_state->common_attributes.hsdev, 101 press_state->common_attributes.hsdev,
102 HID_USAGE_SENSOR_PRESSURE, address, 102 HID_USAGE_SENSOR_PRESSURE, address,
103 report_id); 103 report_id,
104 SENSOR_HUB_SYNC);
104 hid_sensor_power_state(&press_state->common_attributes, 105 hid_sensor_power_state(&press_state->common_attributes,
105 false); 106 false);
106 } else { 107 } else {