iio: magnetometer: separate the values of attributes based on their usage type for...
authorOoi, Joyce <joyce.ooi@intel.com>
Wed, 16 Nov 2016 09:43:09 +0000 (17:43 +0800)
committerJonathan Cameron <jic23@kernel.org>
Thu, 24 Nov 2016 20:41:30 +0000 (20:41 +0000)
commit6f771d0b338d59c492699814b0fe554f9d1ee27c
tree8ba4d624225c6553c84f841944110ea6d66b4ee1
parent0e8d2b0f74c07e68d6fa6ea3113de5735d59d018
iio: magnetometer: separate the values of attributes based on their usage type for HID compass sensor

There are 2 usage types (Magnetic Flux and Heading data field) for HID
compass sensor, thus the values of offset, scale, and sensitivity should
be separated according to their respective usage type. The changes made
are as below:
1. Hysteresis: A struct hid_sensor_common rot_attributes is created in
struct magn_3d_state to contain the sensitivity for IIO_ROT.
2. Scale: scale_pre_decml and scale_post_decml are separated for IIO_MAGN
and IIO_ROT.
3. Offset: Same as scale, value_offset is separated for IIO_MAGN and
IIO_ROT.

For sensitivity, HID_USAGE_SENSOR_ORIENT_MAGN_FLUX and
HID_USAGE_SENSOR_ORIENT_MAGN_HEADING are used for sensivitity fields based
on the HID Sensor Usages specifications. Hence, these changes are added on
the sensitivity field.

Signed-off-by: Ooi, Joyce <joyce.ooi@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/magnetometer/hid-sensor-magn-3d.c