diff options
author | AnilKumar Ch <anilkumar@ti.com> | 2012-08-22 02:30:39 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-05 16:44:04 -0400 |
commit | 0bf5a8be4723fd5f243d9d1ed8e6eb9d81f31cf2 (patch) | |
tree | ad3c4f0265c8a06c878d2f5918e68bcb2b8dc476 /drivers/misc/lis3lv02d/lis3lv02d.h | |
parent | 7da59d2fe30d8169c7c9e7b488beb1b9af932608 (diff) |
lis3lv02d: Add STMicroelectronics lis331dlh digital accelerometer
This patch adds support for lis331dlh digital accelerometer to the
lis3lv02d driver family. Adds ID field for detecting the lis331dlh
module, based on this ID field lis3lv02d driver will export the
lis331dlh module functionality.
Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/lis3lv02d/lis3lv02d.h')
-rw-r--r-- | drivers/misc/lis3lv02d/lis3lv02d.h | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/drivers/misc/lis3lv02d/lis3lv02d.h b/drivers/misc/lis3lv02d/lis3lv02d.h index 2b1482ad3f16..c1a545e136a0 100644 --- a/drivers/misc/lis3lv02d/lis3lv02d.h +++ b/drivers/misc/lis3lv02d/lis3lv02d.h | |||
@@ -26,12 +26,12 @@ | |||
26 | /* | 26 | /* |
27 | * This driver tries to support the "digital" accelerometer chips from | 27 | * This driver tries to support the "digital" accelerometer chips from |
28 | * STMicroelectronics such as LIS3LV02DL, LIS302DL, LIS3L02DQ, LIS331DL, | 28 | * STMicroelectronics such as LIS3LV02DL, LIS302DL, LIS3L02DQ, LIS331DL, |
29 | * LIS35DE, or LIS202DL. They are very similar in terms of programming, with | 29 | * LIS331DLH, LIS35DE, or LIS202DL. They are very similar in terms of |
30 | * almost the same registers. In addition to differing on physical properties, | 30 | * programming, with almost the same registers. In addition to differing |
31 | * they differ on the number of axes (2/3), precision (8/12 bits), and special | 31 | * on physical properties, they differ on the number of axes (2/3), |
32 | * features (freefall detection, click...). Unfortunately, not all the | 32 | * precision (8/12 bits), and special features (freefall detection, |
33 | * differences can be probed via a register. | 33 | * click...). Unfortunately, not all the differences can be probed via |
34 | * They can be connected either via I²C or SPI. | 34 | * a register. They can be connected either via I²C or SPI. |
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include <linux/lis3lv02d.h> | 37 | #include <linux/lis3lv02d.h> |
@@ -96,12 +96,22 @@ enum lis3lv02d_reg { | |||
96 | }; | 96 | }; |
97 | 97 | ||
98 | enum lis3_who_am_i { | 98 | enum lis3_who_am_i { |
99 | WAI_3DLH = 0x32, /* 16 bits: LIS331DLH */ | ||
99 | WAI_3DC = 0x33, /* 8 bits: LIS3DC, HP3DC */ | 100 | WAI_3DC = 0x33, /* 8 bits: LIS3DC, HP3DC */ |
100 | WAI_12B = 0x3A, /* 12 bits: LIS3LV02D[LQ]... */ | 101 | WAI_12B = 0x3A, /* 12 bits: LIS3LV02D[LQ]... */ |
101 | WAI_8B = 0x3B, /* 8 bits: LIS[23]02D[LQ]... */ | 102 | WAI_8B = 0x3B, /* 8 bits: LIS[23]02D[LQ]... */ |
102 | WAI_6B = 0x52, /* 6 bits: LIS331DLF - not supported */ | 103 | WAI_6B = 0x52, /* 6 bits: LIS331DLF - not supported */ |
103 | }; | 104 | }; |
104 | 105 | ||
106 | enum lis3_type { | ||
107 | LIS3DC, | ||
108 | HP3DC, | ||
109 | LIS3LV02D, | ||
110 | LIS2302D, | ||
111 | LIS331DLF, | ||
112 | LIS331DLH, | ||
113 | }; | ||
114 | |||
105 | enum lis3lv02d_ctrl1_12b { | 115 | enum lis3lv02d_ctrl1_12b { |
106 | CTRL1_Xen = 0x01, | 116 | CTRL1_Xen = 0x01, |
107 | CTRL1_Yen = 0x02, | 117 | CTRL1_Yen = 0x02, |
@@ -129,6 +139,27 @@ enum lis3lv02d_ctrl1_3dc { | |||
129 | CTRL1_ODR3 = 0x80, | 139 | CTRL1_ODR3 = 0x80, |
130 | }; | 140 | }; |
131 | 141 | ||
142 | enum lis331dlh_ctrl1 { | ||
143 | CTRL1_DR0 = 0x08, | ||
144 | CTRL1_DR1 = 0x10, | ||
145 | CTRL1_PM0 = 0x20, | ||
146 | CTRL1_PM1 = 0x40, | ||
147 | CTRL1_PM2 = 0x80, | ||
148 | }; | ||
149 | |||
150 | enum lis331dlh_ctrl2 { | ||
151 | CTRL2_HPEN1 = 0x04, | ||
152 | CTRL2_HPEN2 = 0x08, | ||
153 | CTRL2_FDS_3DLH = 0x10, | ||
154 | CTRL2_BOOT_3DLH = 0x80, | ||
155 | }; | ||
156 | |||
157 | enum lis331dlh_ctrl4 { | ||
158 | CTRL4_STSIGN = 0x08, | ||
159 | CTRL4_BLE = 0x40, | ||
160 | CTRL4_BDU = 0x80, | ||
161 | }; | ||
162 | |||
132 | enum lis3lv02d_ctrl2 { | 163 | enum lis3lv02d_ctrl2 { |
133 | CTRL2_DAS = 0x01, | 164 | CTRL2_DAS = 0x01, |
134 | CTRL2_SIM = 0x02, | 165 | CTRL2_SIM = 0x02, |
@@ -279,6 +310,7 @@ struct lis3lv02d { | |||
279 | int data_ready_count[2]; | 310 | int data_ready_count[2]; |
280 | atomic_t wake_thread; | 311 | atomic_t wake_thread; |
281 | unsigned char irq_cfg; | 312 | unsigned char irq_cfg; |
313 | unsigned int shift_adj; | ||
282 | 314 | ||
283 | struct lis3lv02d_platform_data *pdata; /* for passing board config */ | 315 | struct lis3lv02d_platform_data *pdata; /* for passing board config */ |
284 | struct mutex mutex; /* Serialize poll and selftest */ | 316 | struct mutex mutex; /* Serialize poll and selftest */ |