diff options
author | Samu Onkalo <samu.p.onkalo@nokia.com> | 2009-12-14 21:01:43 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-15 11:53:36 -0500 |
commit | 2db4a76d5f3554e9e5632c8f91828313318579c8 (patch) | |
tree | 63089645aab712fe58e382e36d7fbac14dbd150f /drivers/hwmon/lis3lv02d.h | |
parent | 641615abfac0b7c5e6f242a6db77f7690925b443 (diff) |
lis3: selftest support
Implement selftest feature as specified by chip manufacturer. Control:
read selftest sysfs entry
Response: "OK x y z" or "FAIL x y z"
where x, y, and z are difference between selftest mode and normal mode.
Test is passed when values are within acceptance limit values.
Acceptance limits are provided via platform data. See chip spesifications
for acceptance limits. If limits are not properly set, OK / FAIL decision
is meaningless. However, userspace application can still make decision
based on the numeric x, y, z values.
Selftest is meant for HW diagnostic purposes. It is not meant to be
called during normal use of the chip. It may cause false interrupt
events. Selftest mode delays polling of the normal results but it doesn't
cause wrong values. Chip must be in static state during selftest. Any
acceration during the test causes most probably failure.
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 'drivers/hwmon/lis3lv02d.h')
-rw-r--r-- | drivers/hwmon/lis3lv02d.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/hwmon/lis3lv02d.h b/drivers/hwmon/lis3lv02d.h index c57f21f45676..166794cb91a3 100644 --- a/drivers/hwmon/lis3lv02d.h +++ b/drivers/hwmon/lis3lv02d.h | |||
@@ -98,7 +98,7 @@ enum lis3_who_am_i { | |||
98 | WAI_6B = 0x52, /* 6 bits: LIS331DLF - not supported */ | 98 | WAI_6B = 0x52, /* 6 bits: LIS331DLF - not supported */ |
99 | }; | 99 | }; |
100 | 100 | ||
101 | enum lis3lv02d_ctrl1 { | 101 | enum lis3lv02d_ctrl1_12b { |
102 | CTRL1_Xen = 0x01, | 102 | CTRL1_Xen = 0x01, |
103 | CTRL1_Yen = 0x02, | 103 | CTRL1_Yen = 0x02, |
104 | CTRL1_Zen = 0x04, | 104 | CTRL1_Zen = 0x04, |
@@ -107,8 +107,17 @@ enum lis3lv02d_ctrl1 { | |||
107 | CTRL1_DF1 = 0x20, | 107 | CTRL1_DF1 = 0x20, |
108 | CTRL1_PD0 = 0x40, | 108 | CTRL1_PD0 = 0x40, |
109 | CTRL1_PD1 = 0x80, | 109 | CTRL1_PD1 = 0x80, |
110 | CTRL1_DR = 0x80, /* Data rate on 8 bits */ | ||
111 | }; | 110 | }; |
111 | |||
112 | /* Delta to ctrl1_12b version */ | ||
113 | enum lis3lv02d_ctrl1_8b { | ||
114 | CTRL1_STM = 0x08, | ||
115 | CTRL1_STP = 0x10, | ||
116 | CTRL1_FS = 0x20, | ||
117 | CTRL1_PD = 0x40, | ||
118 | CTRL1_DR = 0x80, | ||
119 | }; | ||
120 | |||
112 | enum lis3lv02d_ctrl2 { | 121 | enum lis3lv02d_ctrl2 { |
113 | CTRL2_DAS = 0x01, | 122 | CTRL2_DAS = 0x01, |
114 | CTRL2_SIM = 0x02, | 123 | CTRL2_SIM = 0x02, |
@@ -218,6 +227,7 @@ struct lis3lv02d { | |||
218 | unsigned long misc_opened; /* bit0: whether the device is open */ | 227 | unsigned long misc_opened; /* bit0: whether the device is open */ |
219 | 228 | ||
220 | struct lis3lv02d_platform_data *pdata; /* for passing board config */ | 229 | struct lis3lv02d_platform_data *pdata; /* for passing board config */ |
230 | struct mutex mutex; /* Serialize poll and selftest */ | ||
221 | }; | 231 | }; |
222 | 232 | ||
223 | int lis3lv02d_init_device(struct lis3lv02d *lis3); | 233 | int lis3lv02d_init_device(struct lis3lv02d *lis3); |