aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/lis3lv02d/lis3lv02d.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/lis3lv02d/lis3lv02d.h')
-rw-r--r--drivers/misc/lis3lv02d/lis3lv02d.h49
1 files changed, 43 insertions, 6 deletions
diff --git a/drivers/misc/lis3lv02d/lis3lv02d.h b/drivers/misc/lis3lv02d/lis3lv02d.h
index 2b1482ad3f16..c439c827eea8 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
98enum lis3_who_am_i { 98enum 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
106enum lis3_type {
107 LIS3LV02D,
108 LIS3DC,
109 HP3DC,
110 LIS2302D,
111 LIS331DLF,
112 LIS331DLH,
113};
114
105enum lis3lv02d_ctrl1_12b { 115enum 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
142enum lis331dlh_ctrl1 {
143 CTRL1_DR0 = 0x08,
144 CTRL1_DR1 = 0x10,
145 CTRL1_PM0 = 0x20,
146 CTRL1_PM1 = 0x40,
147 CTRL1_PM2 = 0x80,
148};
149
150enum lis331dlh_ctrl2 {
151 CTRL2_HPEN1 = 0x04,
152 CTRL2_HPEN2 = 0x08,
153 CTRL2_FDS_3DLH = 0x10,
154 CTRL2_BOOT_3DLH = 0x80,
155};
156
157enum lis331dlh_ctrl4 {
158 CTRL4_STSIGN = 0x08,
159 CTRL4_BLE = 0x40,
160 CTRL4_BDU = 0x80,
161};
162
132enum lis3lv02d_ctrl2 { 163enum lis3lv02d_ctrl2 {
133 CTRL2_DAS = 0x01, 164 CTRL2_DAS = 0x01,
134 CTRL2_SIM = 0x02, 165 CTRL2_SIM = 0x02,
@@ -279,9 +310,14 @@ 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 */
317
318#ifdef CONFIG_OF
319 struct device_node *of_node;
320#endif
285}; 321};
286 322
287int lis3lv02d_init_device(struct lis3lv02d *lis3); 323int lis3lv02d_init_device(struct lis3lv02d *lis3);
@@ -290,5 +326,6 @@ void lis3lv02d_joystick_disable(struct lis3lv02d *lis3);
290void lis3lv02d_poweroff(struct lis3lv02d *lis3); 326void lis3lv02d_poweroff(struct lis3lv02d *lis3);
291int lis3lv02d_poweron(struct lis3lv02d *lis3); 327int lis3lv02d_poweron(struct lis3lv02d *lis3);
292int lis3lv02d_remove_fs(struct lis3lv02d *lis3); 328int lis3lv02d_remove_fs(struct lis3lv02d *lis3);
329int lis3lv02d_init_dt(struct lis3lv02d *lis3);
293 330
294extern struct lis3lv02d lis3_dev; 331extern struct lis3lv02d lis3_dev;