linux/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 hwmon: (ams) Simplify IRQ handling routine 2008-10-17 17:51:13 +02:00
abituguru3.c hwmon: Include <linux/io.h> instead of <asm/io.h> 2009-09-15 17:18:13 +02:00
abituguru.c hwmon: Include <linux/io.h> instead of <asm/io.h> 2009-09-15 17:18:13 +02:00
ad7414.c hwmon: (ad7414) Make ad7414_update_device() static 2008-09-20 10:25:20 +02:00
ad7418.c hwmon: (ad7418) Convert to a new-style i2c driver 2008-07-16 19:30:08 +02:00
adcxx.c hwmon: adxx: convert to device table matching 2009-09-23 07:39:43 -07:00
adm1021.c i2c: Drop I2C_CLIENT_INSMOD_2 to 8 2009-12-14 21:17:27 +01:00
adm1025.c i2c: Drop I2C_CLIENT_INSMOD_2 to 8 2009-12-14 21:17:27 +01:00
adm1026.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
adm1029.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
adm1031.c i2c: Drop I2C_CLIENT_INSMOD_2 to 8 2009-12-14 21:17:27 +01:00
adm9240.c i2c: Drop I2C_CLIENT_INSMOD_2 to 8 2009-12-14 21:17:27 +01:00
ads7828.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
adt7462.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
adt7470.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
adt7473.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
adt7475.c i2c: Drop I2C_CLIENT_INSMOD_2 to 8 2009-12-14 21:17:27 +01:00
applesmc.c const: constify remaining dev_pm_ops 2009-12-15 08:53:25 -08:00
asb100.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
asus_atk0110.c hwmon: (asus_atk0110) Enable the EC 2009-10-09 20:35:18 +02:00
atxp1.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
coretemp.c hwmon: (coretemp) Add Lynnfield CPU 2009-09-23 22:59:43 +02:00
dme1737.c i2c: Drop I2C_CLIENT_INSMOD_2 to 8 2009-12-14 21:17:27 +01:00
ds1621.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
f71805f.c hwmon: Include <linux/io.h> instead of <asm/io.h> 2009-09-15 17:18:13 +02:00
f71882fg.c hwmon: (f71882fg) Add support for the f71889fg (version 2) 2009-12-09 20:36:01 +01:00
f75375s.c i2c: Drop I2C_CLIENT_INSMOD_2 to 8 2009-12-14 21:17:27 +01:00
fschmd.c i2c: Drop I2C_CLIENT_INSMOD_2 to 8 2009-12-14 21:17:27 +01:00
g760a.c hwmon: add support for GMT G760A fan speed PWM controller 2009-04-07 08:31:03 -07:00
gl518sm.c i2c: Drop I2C_CLIENT_INSMOD_2 to 8 2009-12-14 21:17:27 +01:00
gl520sm.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
hdaps.c hwmon: Include <linux/io.h> instead of <asm/io.h> 2009-09-15 17:18:13 +02:00
hp_accel.c lis3: add support for the HP HDX 18 2009-10-29 07:39:32 -07:00
hwmon-vid.c hwmon-vid: Ignore 6th VID pin of AMD family 0Fh processors 2009-09-15 17:18:11 +02:00
hwmon.c hwmon: PCI quirk for hwmon access on MSI MS-7031 board 2009-06-15 18:39:50 +02:00
i5k_amb.c hwmon: (i5k_amb) Load automatically on all 5000/5400 chipsets 2009-01-07 16:37:33 +01:00
ibmaem.c hwmon: (ibmaem) Automatically load on HC10 blade 2009-06-15 18:39:46 +02:00
ibmpex.c ibmpex: add endian annotation to extract_data() helper 2009-01-06 15:59:18 -08:00
it87.c hwmon: (it87) Check for fan2 and fan3 availability 2009-12-09 20:35:48 +01:00
k8temp.c hwmon: (k8temp) Fix temperature reporting for (most) K8 RevG CPUs 2009-01-15 22:27:47 +01:00
Kconfig lis3: update documentation and comments 2009-12-15 08:53:36 -08:00
lis3lv02d_spi.c lis3lv02d_spi: module unload didn't remove sysfs entry 2009-10-08 07:36:40 -07:00
lis3lv02d.c lis3: scale output values to mg 2009-12-15 08:53:36 -08:00
lis3lv02d.h lis3: scale output values to mg 2009-12-15 08:53:36 -08:00
lm63.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
lm70.c hwmon: lm70: convert to device table matching 2009-09-23 07:39:43 -07:00
lm73.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
lm75.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
lm75.h hwmon: Allow writing of negative trigger temperatures 2007-10-09 22:56:29 -04:00
lm77.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
lm78.c i2c: Drop I2C_CLIENT_INSMOD_2 to 8 2009-12-14 21:17:27 +01:00
lm80.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
lm83.c i2c: Drop I2C_CLIENT_INSMOD_2 to 8 2009-12-14 21:17:27 +01:00
lm85.c i2c: Drop I2C_CLIENT_INSMOD_2 to 8 2009-12-14 21:17:27 +01:00
lm87.c i2c: Drop I2C_CLIENT_INSMOD_2 to 8 2009-12-14 21:17:27 +01:00
lm90.c i2c: Drop I2C_CLIENT_INSMOD_2 to 8 2009-12-14 21:17:27 +01:00
lm92.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
lm93.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
lm95241.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
ltc4215.c ltc4215/ltc4245: Discard obsolete detect methods 2009-10-04 22:53:42 +02:00
ltc4245.c ltc4215/ltc4245: Discard obsolete detect methods 2009-10-04 22:53:42 +02:00
Makefile hwmon: Add Freescale MC13783 ADC driver 2009-12-09 20:35:58 +01:00
max1111.c spi: prefix modalias with "spi:" 2009-09-23 07:39:43 -07:00
max1619.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
max6650.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
mc13783-adc.c hwmon: Add Freescale MC13783 ADC driver 2009-12-09 20:35:58 +01:00
pc87360.c hwmon: Include <linux/io.h> instead of <asm/io.h> 2009-09-15 17:18:13 +02:00
pc87427.c hwmon: Use resource_size 2009-09-15 17:18:13 +02:00
pcf8591.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
s3c-hwmon.c hwmon: (s3c-hwmon) Fix build error 2009-12-09 20:35:45 +01:00
sht15.c Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging 2009-10-11 11:23:33 -07:00
sis5595.c hwmon: Include <linux/io.h> instead of <asm/io.h> 2009-09-15 17:18:13 +02:00
smsc47b397.c hwmon: Include <linux/io.h> instead of <asm/io.h> 2009-09-15 17:18:13 +02:00
smsc47m1.c hwmon: Include <linux/io.h> instead of <asm/io.h> 2009-09-15 17:18:13 +02:00
smsc47m192.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
thmc50.c i2c: Drop I2C_CLIENT_INSMOD_2 to 8 2009-12-14 21:17:27 +01:00
tmp401.c i2c: Drop I2C_CLIENT_INSMOD_2 to 8 2009-12-14 21:17:27 +01:00
tmp421.c i2c: Drop I2C_CLIENT_INSMOD_2 to 8 2009-12-14 21:17:27 +01:00
ultra45_env.c sparc: Annotate of_device_id arrays with const or __initdata. 2008-08-31 01:23:17 -07:00
via686a.c hwmon: Include <linux/io.h> instead of <asm/io.h> 2009-09-15 17:18:13 +02:00
vt1211.c hwmon: Use resource_size 2009-09-15 17:18:13 +02:00
vt8231.c hwmon: Include <linux/io.h> instead of <asm/io.h> 2009-09-15 17:18:13 +02:00
w83l785ts.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
w83l786ng.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
w83627ehf.c hwmon: w83627ehf updates 2009-12-15 08:53:35 -08:00
w83627hf.c hwmon: (w83627hf) Stop using globals for I/O port numbers 2009-12-09 20:35:49 +01:00
w83781d.c i2c: Drop I2C_CLIENT_INSMOD_2 to 8 2009-12-14 21:17:27 +01:00
w83791d.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
w83792d.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
w83793.c i2c: Drop I2C_CLIENT_INSMOD_1 2009-12-14 21:17:26 +01:00
wm831x-hwmon.c hwmon: WM831x PMIC hardware monitoring driver 2009-09-17 09:47:02 +02:00
wm8350-hwmon.c hwmon: Add WM835x PMIC hardware monitoring driver 2009-09-17 09:46:51 +02:00