diff options
author | Samu Onkalo <samu.p.onkalo@nokia.com> | 2009-12-15 03:01:46 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-15 17:53:36 +0100 |
commit | 32496c76b777752ba84b125bebfb0cc498f5602c (patch) | |
tree | 199a2e71fca6e19c5b7075965856a8934c7b9db6 /firmware | |
parent | lis3: sysfs entry for setting chip measurement rate (diff) | |
download | linux-32496c76b777752ba84b125bebfb0cc498f5602c.tar.xz linux-32496c76b777752ba84b125bebfb0cc498f5602c.zip |
lis3: scale output values to mg
Report output values as 1/1000 of earth gravity.
Output values from lis3 can be read from sysfs position entry and from
input device. Input device can be accessed as event device and as
joystick device. Joystick device can be in two modes. Meaning of the
output values varies from case to case depending on the chip type and
configuration (scale). Only joystick interface in JS_CORR_BROKEN mode
returned somehow similar output values in different configurations.
Joystick device is in that state by default in case of lis3.
Position sysfs entry, input event device and raw joystick device have been
little bit broken since meaning of the output values has been varied
between 12 and 8 bit devices. Applications which relayed on those methods
failed if the chip is different than the expected one.
This patch converts output values to mean similar thing in different
configurations. Both 8 and 12 bit devices reports now same acceleration
values. If somebody implements full scale support to the driver, output
values will still mean the same. Scaling factor and input device range
must be updated in that case.
Joystick interface in JS_CORR_BROKEN mode is not touched by this patch.
All other interfaces have different scale after this change. For 12 bit
device scaling factor is 0.977 which keeps scaled and unscaled values are
quite close to each others. For 8 bit device, scaled values are 18 times
bigger than unscaled values.
Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com>
Acked-by: Éric Piel <Eric.Piel@tremplin-utc.net>
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'firmware')
0 files changed, 0 insertions, 0 deletions