aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/iio/common/hid-sensors/hid-sensor-attributes.c')
-rw-r--r--drivers/iio/common/hid-sensors/hid-sensor-attributes.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
index 01e02b9926d4..ca742ac8f128 100644
--- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
+++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
@@ -221,7 +221,15 @@ int hid_sensor_write_samp_freq_value(struct hid_sensor_common *st,
221 if (ret < 0 || value < 0) 221 if (ret < 0 || value < 0)
222 ret = -EINVAL; 222 ret = -EINVAL;
223 223
224 return ret; 224 ret = sensor_hub_get_feature(st->hsdev,
225 st->poll.report_id,
226 st->poll.index, sizeof(value), &value);
227 if (ret < 0 || value < 0)
228 return -EINVAL;
229
230 st->poll_interval = value;
231
232 return 0;
225} 233}
226EXPORT_SYMBOL(hid_sensor_write_samp_freq_value); 234EXPORT_SYMBOL(hid_sensor_write_samp_freq_value);
227 235
@@ -266,7 +274,16 @@ int hid_sensor_write_raw_hyst_value(struct hid_sensor_common *st,
266 if (ret < 0 || value < 0) 274 if (ret < 0 || value < 0)
267 ret = -EINVAL; 275 ret = -EINVAL;
268 276
269 return ret; 277 ret = sensor_hub_get_feature(st->hsdev,
278 st->sensitivity.report_id,
279 st->sensitivity.index, sizeof(value),
280 &value);
281 if (ret < 0 || value < 0)
282 return -EINVAL;
283
284 st->raw_hystersis = value;
285
286 return 0;
270} 287}
271EXPORT_SYMBOL(hid_sensor_write_raw_hyst_value); 288EXPORT_SYMBOL(hid_sensor_write_raw_hyst_value);
272 289
@@ -369,6 +386,9 @@ int hid_sensor_get_reporting_interval(struct hid_sensor_hub_device *hsdev,
369 /* Default unit of measure is milliseconds */ 386 /* Default unit of measure is milliseconds */
370 if (st->poll.units == 0) 387 if (st->poll.units == 0)
371 st->poll.units = HID_USAGE_SENSOR_UNITS_MILLISECOND; 388 st->poll.units = HID_USAGE_SENSOR_UNITS_MILLISECOND;
389
390 st->poll_interval = -1;
391
372 return 0; 392 return 0;
373 393
374} 394}
@@ -399,6 +419,8 @@ int hid_sensor_parse_common_attributes(struct hid_sensor_hub_device *hsdev,
399 HID_USAGE_SENSOR_PROP_SENSITIVITY_ABS, 419 HID_USAGE_SENSOR_PROP_SENSITIVITY_ABS,
400 &st->sensitivity); 420 &st->sensitivity);
401 421
422 st->raw_hystersis = -1;
423
402 sensor_hub_input_get_attribute_info(hsdev, 424 sensor_hub_input_get_attribute_info(hsdev,
403 HID_INPUT_REPORT, usage_id, 425 HID_INPUT_REPORT, usage_id,
404 HID_USAGE_SENSOR_TIME_TIMESTAMP, 426 HID_USAGE_SENSOR_TIME_TIMESTAMP,