aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorArchana Patni <archana.patni@linux.intel.com>2014-08-05 09:36:00 -0400
committerJonathan Cameron <jic23@kernel.org>2014-05-10 06:45:02 -0400
commit3e729974d67608be773167677478781bc874d369 (patch)
treeb40308e10d4819f65b50a25d1a71ba801ea9e220 /drivers/iio
parent758ee467d37b6de6b3ca412d0cc90d2b9966b1af (diff)
iio: hid-sensors: Set default unit of measure for report interval
For PROP_REPORT_INTERVAL, the spec does not mandate the presence of the report interval unit in the feature report and expects the default unit of measure to be used as milliseconds. Currently, when the unit is not present, it gets set as zero leading to issues in sampling frequency. This patch sets the unit of measure to the default unit if it is not defined by firmware. Signed-off-by: Archana Patni <archana.patni@intel.com> Signed-off-by: Subramony Sesha <subramony.sesha@intel.com> Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/common/hid-sensors/hid-sensor-attributes.c17
1 files changed, 15 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 3052eb150099..403dd3d8986e 100644
--- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
+++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
@@ -343,15 +343,28 @@ int hid_sensor_format_scale(u32 usage_id,
343} 343}
344EXPORT_SYMBOL(hid_sensor_format_scale); 344EXPORT_SYMBOL(hid_sensor_format_scale);
345 345
346int hid_sensor_parse_common_attributes(struct hid_sensor_hub_device *hsdev, 346int hid_sensor_get_reporting_interval(struct hid_sensor_hub_device *hsdev,
347 u32 usage_id, 347 u32 usage_id,
348 struct hid_sensor_common *st) 348 struct hid_sensor_common *st)
349{ 349{
350
351 sensor_hub_input_get_attribute_info(hsdev, 350 sensor_hub_input_get_attribute_info(hsdev,
352 HID_FEATURE_REPORT, usage_id, 351 HID_FEATURE_REPORT, usage_id,
353 HID_USAGE_SENSOR_PROP_REPORT_INTERVAL, 352 HID_USAGE_SENSOR_PROP_REPORT_INTERVAL,
354 &st->poll); 353 &st->poll);
354 /* Default unit of measure is milliseconds */
355 if (st->poll.units == 0)
356 st->poll.units = HID_USAGE_SENSOR_UNITS_MILLISECOND;
357 return 0;
358
359}
360
361int hid_sensor_parse_common_attributes(struct hid_sensor_hub_device *hsdev,
362 u32 usage_id,
363 struct hid_sensor_common *st)
364{
365
366
367 hid_sensor_get_reporting_interval(hsdev, usage_id, st);
355 368
356 sensor_hub_input_get_attribute_info(hsdev, 369 sensor_hub_input_get_attribute_info(hsdev,
357 HID_FEATURE_REPORT, usage_id, 370 HID_FEATURE_REPORT, usage_id,