]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commita610b30c4a5e2f6a4bf14d6bb1dd55dcaf36904a
tree35edc5dbc3255acaeb4051009d88df19e2305db8
parent747d849b47ae0b2e6effd0eb7d63f9f64a06410f
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