iio: hid-sensors: magnetometer : Add sensitivity
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Wed, 6 Nov 2013 00:11:00 +0000 (00:11 +0000)
committerJonathan Cameron <jic23@kernel.org>
Sat, 9 Nov 2013 13:51:23 +0000 (13:51 +0000)
A number of Properties that can be applied to Data Fields are per data
field basis or for all data fields. Adding sensitivity field for all
magnetometer fields, which is most commonly used in currently available
sensor hubs.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/magnetometer/hid-sensor-magn-3d.c
include/linux/hid-sensor-ids.h

index 2634920562fb7263bad4ac9d8c6c75fe7a434b49..67fce1916d2173466277da389708a895f462c2ce 100644 (file)
@@ -263,6 +263,18 @@ static int magn_3d_parse_report(struct platform_device *pdev,
                        st->magn[1].index, st->magn[1].report_id,
                        st->magn[2].index, st->magn[2].report_id);
 
+       /* Set Sensitivity field ids, when there is no individual modifier */
+       if (st->common_attributes.sensitivity.index < 0) {
+               sensor_hub_input_get_attribute_info(hsdev,
+                       HID_FEATURE_REPORT, usage_id,
+                       HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS |
+                       HID_USAGE_SENSOR_DATA_ORIENTATION,
+                       &st->common_attributes.sensitivity);
+               dev_dbg(&pdev->dev, "Sensitivity index:report %d:%d\n",
+                       st->common_attributes.sensitivity.index,
+                       st->common_attributes.sensitivity.report_id);
+       }
+
        return ret;
 }
 
index 8d45e0290c9134f507b924597a967d3cebe63ebe..4cc165887b091685d5ada87624156c2dc0b98626 100644 (file)
@@ -42,6 +42,7 @@
 
 /* ORIENTATION: Compass 3D: (200083) */
 #define HID_USAGE_SENSOR_COMPASS_3D                            0x200083
+#define HID_USAGE_SENSOR_DATA_ORIENTATION                      0x200470
 #define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING                   0x200471
 #define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING_X                 0x200472
 #define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING_Y                 0x200473