]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
iio: hid-sensors: Set default unit of measure for report interval
authorArchana Patni <archana.patni@linux.intel.com>
Tue, 5 Aug 2014 13:36:00 +0000 (14:36 +0100)
committerJonathan Cameron <jic23@kernel.org>
Sat, 10 May 2014 10:45:02 +0000 (11:45 +0100)
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>
drivers/iio/common/hid-sensors/hid-sensor-attributes.c

index 3052eb1500997a007c3dc4d20398d859483350e3..403dd3d8986e3f721d453159c4077aaf203a8ef7 100644 (file)
@@ -343,15 +343,28 @@ int hid_sensor_format_scale(u32 usage_id,
 }
 EXPORT_SYMBOL(hid_sensor_format_scale);
 
-int hid_sensor_parse_common_attributes(struct hid_sensor_hub_device *hsdev,
+int hid_sensor_get_reporting_interval(struct hid_sensor_hub_device *hsdev,
                                        u32 usage_id,
                                        struct hid_sensor_common *st)
 {
-
        sensor_hub_input_get_attribute_info(hsdev,
                                        HID_FEATURE_REPORT, usage_id,
                                        HID_USAGE_SENSOR_PROP_REPORT_INTERVAL,
                                        &st->poll);
+       /* Default unit of measure is milliseconds */
+       if (st->poll.units == 0)
+               st->poll.units = HID_USAGE_SENSOR_UNITS_MILLISECOND;
+       return 0;
+
+}
+
+int hid_sensor_parse_common_attributes(struct hid_sensor_hub_device *hsdev,
+                                       u32 usage_id,
+                                       struct hid_sensor_common *st)
+{
+
+
+       hid_sensor_get_reporting_interval(hsdev, usage_id, st);
 
        sensor_hub_input_get_attribute_info(hsdev,
                                        HID_FEATURE_REPORT, usage_id,