Commit 2461fc9f3f45828eee23dd5018e7b5576aceec80
Committed by
Jonathan Cameron
1 parent
f227c13259
Exists in
master
and in
16 other branches
iio: hid-sensors: magnetometer : Add sensitivity
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>
Showing 2 changed files with 13 additions and 0 deletions Side-by-side Diff
drivers/iio/magnetometer/hid-sensor-magn-3d.c
... | ... | @@ -263,6 +263,18 @@ |
263 | 263 | st->magn[1].index, st->magn[1].report_id, |
264 | 264 | st->magn[2].index, st->magn[2].report_id); |
265 | 265 | |
266 | + /* Set Sensitivity field ids, when there is no individual modifier */ | |
267 | + if (st->common_attributes.sensitivity.index < 0) { | |
268 | + sensor_hub_input_get_attribute_info(hsdev, | |
269 | + HID_FEATURE_REPORT, usage_id, | |
270 | + HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS | | |
271 | + HID_USAGE_SENSOR_DATA_ORIENTATION, | |
272 | + &st->common_attributes.sensitivity); | |
273 | + dev_dbg(&pdev->dev, "Sensitivity index:report %d:%d\n", | |
274 | + st->common_attributes.sensitivity.index, | |
275 | + st->common_attributes.sensitivity.report_id); | |
276 | + } | |
277 | + | |
266 | 278 | return ret; |
267 | 279 | } |
268 | 280 |
include/linux/hid-sensor-ids.h
... | ... | @@ -42,6 +42,7 @@ |
42 | 42 | |
43 | 43 | /* ORIENTATION: Compass 3D: (200083) */ |
44 | 44 | #define HID_USAGE_SENSOR_COMPASS_3D 0x200083 |
45 | +#define HID_USAGE_SENSOR_DATA_ORIENTATION 0x200470 | |
45 | 46 | #define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING 0x200471 |
46 | 47 | #define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING_X 0x200472 |
47 | 48 | #define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING_Y 0x200473 |