kernel_optimize_test/drivers/hwmon
Samu Onkalo 32496c76b7 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>
2009-12-15 08:53:36 -08:00
..
ams
abituguru3.c
abituguru.c
ad7414.c
ad7418.c
adcxx.c
adm1021.c
adm1025.c
adm1026.c
adm1029.c
adm1031.c
adm9240.c
ads7828.c
adt7462.c
adt7470.c
adt7473.c
adt7475.c
applesmc.c
asb100.c
asus_atk0110.c
atxp1.c
coretemp.c
dme1737.c
ds1621.c
f71805f.c
f71882fg.c
f75375s.c
fschmd.c
g760a.c
gl518sm.c
gl520sm.c
hdaps.c
hp_accel.c
hwmon-vid.c
hwmon.c
i5k_amb.c
ibmaem.c
ibmpex.c
it87.c
k8temp.c
Kconfig
lis3lv02d_spi.c
lis3lv02d.c
lis3lv02d.h
lm63.c
lm70.c
lm73.c
lm75.c
lm75.h
lm77.c
lm78.c
lm80.c
lm83.c
lm85.c
lm87.c
lm90.c
lm92.c
lm93.c
lm95241.c
ltc4215.c
ltc4245.c
Makefile
max1111.c
max1619.c
max6650.c
mc13783-adc.c
pc87360.c
pc87427.c
pcf8591.c
s3c-hwmon.c
sht15.c
sis5595.c
smsc47b397.c
smsc47m1.c
smsc47m192.c
thmc50.c
tmp401.c
tmp421.c
ultra45_env.c
via686a.c
vt1211.c
vt8231.c
w83l785ts.c
w83l786ng.c
w83627ehf.c
w83627hf.c
w83781d.c
w83791d.c
w83792d.c
w83793.c
wm831x-hwmon.c
wm8350-hwmon.c