Bläddra i källkod

iio: hid-sensors: gyro : 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
gyro 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>
Srinivas Pandruvada 11 år sedan
förälder
incheckning
2371aebf02
2 ändrade filer med 12 tillägg och 0 borttagningar
  1. 11 0
      drivers/iio/gyro/hid-sensor-gyro-3d.c
  2. 1 0
      include/linux/hid-sensor-ids.h

+ 11 - 0
drivers/iio/gyro/hid-sensor-gyro-3d.c

@@ -262,6 +262,17 @@ static int gyro_3d_parse_report(struct platform_device *pdev,
 			st->gyro[1].index, st->gyro[1].report_id,
 			st->gyro[1].index, st->gyro[1].report_id,
 			st->gyro[2].index, st->gyro[2].report_id);
 			st->gyro[2].index, st->gyro[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_ANGL_VELOCITY,
+			&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;
 	return ret;
 }
 }
 
 

+ 1 - 0
include/linux/hid-sensor-ids.h

@@ -34,6 +34,7 @@
 
 
 /* Gyro 3D: (200076) */
 /* Gyro 3D: (200076) */
 #define HID_USAGE_SENSOR_GYRO_3D				0x200076
 #define HID_USAGE_SENSOR_GYRO_3D				0x200076
+#define HID_USAGE_SENSOR_DATA_ANGL_VELOCITY			0x200456
 #define HID_USAGE_SENSOR_ANGL_VELOCITY_X_AXIS			0x200457
 #define HID_USAGE_SENSOR_ANGL_VELOCITY_X_AXIS			0x200457
 #define HID_USAGE_SENSOR_ANGL_VELOCITY_Y_AXIS			0x200458
 #define HID_USAGE_SENSOR_ANGL_VELOCITY_Y_AXIS			0x200458
 #define HID_USAGE_SENSOR_ANGL_VELOCITY_Z_AXIS			0x200459
 #define HID_USAGE_SENSOR_ANGL_VELOCITY_Z_AXIS			0x200459