diff options
author | Samu Onkalo <samu.p.onkalo@nokia.com> | 2010-10-22 07:57:30 -0400 |
---|---|---|
committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2010-10-25 17:11:39 -0400 |
commit | 477bc918c2323a51f577cd892ca49376f6feb5d5 (patch) | |
tree | e4902eac91b80243413efd376a38b23cbbd82943 /drivers/hwmon | |
parent | cc23aa1ce2631b2fe1e3fba82ee444460f5ee3b7 (diff) |
hwmon: lis3: Adjust fuzziness for 8 bit device
Default fuziness is set smaller for 8 device.
In 12 bit device LSB is quite close to 1 mg
(mg = 1 / 1000 of earth gravity).
In 8bit device LSB is about 18 mg.
Set fuziness to 1 for 8 bit device.
Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com>
Acked-by: Eric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/lis3lv02d.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/hwmon/lis3lv02d.c b/drivers/hwmon/lis3lv02d.c index 3109eb8648ce..a4929b72506e 100644 --- a/drivers/hwmon/lis3lv02d.c +++ b/drivers/hwmon/lis3lv02d.c | |||
@@ -71,8 +71,10 @@ | |||
71 | #define LIS3_SENSITIVITY_12B ((LIS3_ACCURACY * 1000) / 1024) | 71 | #define LIS3_SENSITIVITY_12B ((LIS3_ACCURACY * 1000) / 1024) |
72 | #define LIS3_SENSITIVITY_8B (18 * LIS3_ACCURACY) | 72 | #define LIS3_SENSITIVITY_8B (18 * LIS3_ACCURACY) |
73 | 73 | ||
74 | #define LIS3_DEFAULT_FUZZ 3 | 74 | #define LIS3_DEFAULT_FUZZ_12B 3 |
75 | #define LIS3_DEFAULT_FLAT 3 | 75 | #define LIS3_DEFAULT_FLAT_12B 3 |
76 | #define LIS3_DEFAULT_FUZZ_8B 1 | ||
77 | #define LIS3_DEFAULT_FLAT_8B 1 | ||
76 | 78 | ||
77 | struct lis3lv02d lis3_dev = { | 79 | struct lis3lv02d lis3_dev = { |
78 | .misc_wait = __WAIT_QUEUE_HEAD_INITIALIZER(lis3_dev.misc_wait), | 80 | .misc_wait = __WAIT_QUEUE_HEAD_INITIALIZER(lis3_dev.misc_wait), |
@@ -564,8 +566,16 @@ int lis3lv02d_joystick_enable(void) | |||
564 | 566 | ||
565 | set_bit(EV_ABS, input_dev->evbit); | 567 | set_bit(EV_ABS, input_dev->evbit); |
566 | max_val = (lis3_dev.mdps_max_val * lis3_dev.scale) / LIS3_ACCURACY; | 568 | max_val = (lis3_dev.mdps_max_val * lis3_dev.scale) / LIS3_ACCURACY; |
567 | fuzz = (LIS3_DEFAULT_FUZZ * lis3_dev.scale) / LIS3_ACCURACY; | 569 | if (lis3_dev.whoami == WAI_12B) { |
568 | flat = (LIS3_DEFAULT_FLAT * lis3_dev.scale) / LIS3_ACCURACY; | 570 | fuzz = LIS3_DEFAULT_FUZZ_12B; |
571 | flat = LIS3_DEFAULT_FLAT_12B; | ||
572 | } else { | ||
573 | fuzz = LIS3_DEFAULT_FUZZ_8B; | ||
574 | flat = LIS3_DEFAULT_FLAT_8B; | ||
575 | } | ||
576 | fuzz = (fuzz * lis3_dev.scale) / LIS3_ACCURACY; | ||
577 | flat = (flat * lis3_dev.scale) / LIS3_ACCURACY; | ||
578 | |||
569 | input_set_abs_params(input_dev, ABS_X, -max_val, max_val, fuzz, flat); | 579 | input_set_abs_params(input_dev, ABS_X, -max_val, max_val, fuzz, flat); |
570 | input_set_abs_params(input_dev, ABS_Y, -max_val, max_val, fuzz, flat); | 580 | input_set_abs_params(input_dev, ABS_Y, -max_val, max_val, fuzz, flat); |
571 | input_set_abs_params(input_dev, ABS_Z, -max_val, max_val, fuzz, flat); | 581 | input_set_abs_params(input_dev, ABS_Z, -max_val, max_val, fuzz, flat); |