iio: hid-sensors: Increase the precision of scale to fix wrong reading interpretation.
authorSong Hongyan <hongyan.song@intel.com>
Tue, 25 Oct 2016 01:30:07 +0000 (01:30 +0000)
committerJonathan Cameron <jic23@kernel.org>
Sat, 5 Nov 2016 17:50:56 +0000 (17:50 +0000)
commit6f77199e9e4b84340c751c585691d7642a47d226
tree35edc5dbc3255acaeb4051009d88df19e2305db8
parent8af644a7d6846f48d6b72be5d4a3c6eb16bd33c8
iio: hid-sensors: Increase the precision of scale to fix wrong reading interpretation.

While testing, it was observed that on some platforms the scale value
from iio sysfs for gyroscope is always 0 (E.g. Yoga 260). This results
in the final angular velocity component values to be zeros.

This is caused by insufficient precision of scale value displayed in sysfs.
If the precision is changed to nano from current micro, then this is
sufficient to display the scale value on this platform.
Since this can be a problem for all other HID sensors, increase scale
precision of all HID sensors to nano from current micro.

Results on Yoga 260:

name scale before scale now
--------------------------------------------
gyro_3d 0.000000 0.000000174
als 0.001000 0.001000000
magn_3d 0.000001 0.000001000
accel_3d 0.000009 0.000009806

Signed-off-by: Song Hongyan <hongyan.song@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/common/hid-sensors/hid-sensor-attributes.c