GNU Linux-libre 4.9-gnu1
[releases.git] / drivers / staging / iio / accel / adis16240.h
1 #ifndef SPI_ADIS16240_H_
2 #define SPI_ADIS16240_H_
3
4 #define ADIS16240_STARTUP_DELAY 220 /* ms */
5
6 /* Flash memory write count */
7 #define ADIS16240_FLASH_CNT      0x00
8
9 /* Output, power supply */
10 #define ADIS16240_SUPPLY_OUT     0x02
11
12 /* Output, x-axis accelerometer */
13 #define ADIS16240_XACCL_OUT      0x04
14
15 /* Output, y-axis accelerometer */
16 #define ADIS16240_YACCL_OUT      0x06
17
18 /* Output, z-axis accelerometer */
19 #define ADIS16240_ZACCL_OUT      0x08
20
21 /* Output, auxiliary ADC input */
22 #define ADIS16240_AUX_ADC        0x0A
23
24 /* Output, temperature */
25 #define ADIS16240_TEMP_OUT       0x0C
26
27 /* Output, x-axis acceleration peak */
28 #define ADIS16240_XPEAK_OUT      0x0E
29
30 /* Output, y-axis acceleration peak */
31 #define ADIS16240_YPEAK_OUT      0x10
32
33 /* Output, z-axis acceleration peak */
34 #define ADIS16240_ZPEAK_OUT      0x12
35
36 /* Output, sum-of-squares acceleration peak */
37 #define ADIS16240_XYZPEAK_OUT    0x14
38
39 /* Output, Capture Buffer 1, X and Y acceleration */
40 #define ADIS16240_CAPT_BUF1      0x16
41
42 /* Output, Capture Buffer 2, Z acceleration */
43 #define ADIS16240_CAPT_BUF2      0x18
44
45 /* Diagnostic, error flags */
46 #define ADIS16240_DIAG_STAT      0x1A
47
48 /* Diagnostic, event counter */
49 #define ADIS16240_EVNT_CNTR      0x1C
50
51 /* Diagnostic, check sum value from firmware test */
52 #define ADIS16240_CHK_SUM        0x1E
53
54 /* Calibration, x-axis acceleration offset adjustment */
55 #define ADIS16240_XACCL_OFF      0x20
56
57 /* Calibration, y-axis acceleration offset adjustment */
58 #define ADIS16240_YACCL_OFF      0x22
59
60 /* Calibration, z-axis acceleration offset adjustment */
61 #define ADIS16240_ZACCL_OFF      0x24
62
63 /* Clock, hour and minute */
64 #define ADIS16240_CLK_TIME       0x2E
65
66 /* Clock, month and day */
67 #define ADIS16240_CLK_DATE       0x30
68
69 /* Clock, year */
70 #define ADIS16240_CLK_YEAR       0x32
71
72 /* Wake-up setting, hour and minute */
73 #define ADIS16240_WAKE_TIME      0x34
74
75 /* Wake-up setting, month and day */
76 #define ADIS16240_WAKE_DATE      0x36
77
78 /* Alarm 1 amplitude threshold */
79 #define ADIS16240_ALM_MAG1       0x38
80
81 /* Alarm 2 amplitude threshold */
82 #define ADIS16240_ALM_MAG2       0x3A
83
84 /* Alarm control */
85 #define ADIS16240_ALM_CTRL       0x3C
86
87 /* Capture, external trigger control */
88 #define ADIS16240_XTRIG_CTRL     0x3E
89
90 /* Capture, address pointer */
91 #define ADIS16240_CAPT_PNTR      0x40
92
93 /* Capture, configuration and control */
94 #define ADIS16240_CAPT_CTRL      0x42
95
96 /* General-purpose digital input/output control */
97 #define ADIS16240_GPIO_CTRL      0x44
98
99 /* Miscellaneous control */
100 #define ADIS16240_MSC_CTRL       0x46
101
102 /* Internal sample period (rate) control */
103 #define ADIS16240_SMPL_PRD       0x48
104
105 /* System command */
106 #define ADIS16240_GLOB_CMD       0x4A
107
108 /* MSC_CTRL */
109
110 /* Enables sum-of-squares output (XYZPEAK_OUT) */
111 #define ADIS16240_MSC_CTRL_XYZPEAK_OUT_EN       BIT(15)
112
113 /* Enables peak tracking output (XPEAK_OUT, YPEAK_OUT, and ZPEAK_OUT) */
114 #define ADIS16240_MSC_CTRL_X_Y_ZPEAK_OUT_EN     BIT(14)
115
116 /* Self-test enable: 1 = apply electrostatic force, 0 = disabled */
117 #define ADIS16240_MSC_CTRL_SELF_TEST_EN         BIT(8)
118
119 /* Data-ready enable: 1 = enabled, 0 = disabled */
120 #define ADIS16240_MSC_CTRL_DATA_RDY_EN          BIT(2)
121
122 /* Data-ready polarity: 1 = active high, 0 = active low */
123 #define ADIS16240_MSC_CTRL_ACTIVE_HIGH          BIT(1)
124
125 /* Data-ready line selection: 1 = DIO2, 0 = DIO1 */
126 #define ADIS16240_MSC_CTRL_DATA_RDY_DIO2        BIT(0)
127
128 /* DIAG_STAT */
129
130 /* Alarm 2 status: 1 = alarm active, 0 = alarm inactive */
131 #define ADIS16240_DIAG_STAT_ALARM2      BIT(9)
132
133 /* Alarm 1 status: 1 = alarm active, 0 = alarm inactive */
134 #define ADIS16240_DIAG_STAT_ALARM1      BIT(8)
135
136 /* Capture buffer full: 1 = capture buffer is full */
137 #define ADIS16240_DIAG_STAT_CPT_BUF_FUL BIT(7)
138
139 /* Flash test, checksum flag: 1 = mismatch, 0 = match */
140 #define ADIS16240_DIAG_STAT_CHKSUM      BIT(6)
141
142 /* Power-on, self-test flag: 1 = failure, 0 = pass */
143 #define ADIS16240_DIAG_STAT_PWRON_FAIL_BIT  5
144
145 /* Power-on self-test: 1 = in-progress, 0 = complete */
146 #define ADIS16240_DIAG_STAT_PWRON_BUSY  BIT(4)
147
148 /* SPI communications failure */
149 #define ADIS16240_DIAG_STAT_SPI_FAIL_BIT        3
150
151 /* Flash update failure */
152 #define ADIS16240_DIAG_STAT_FLASH_UPT_BIT       2
153
154 /* Power supply above 3.625 V */
155 #define ADIS16240_DIAG_STAT_POWER_HIGH_BIT      1
156
157  /* Power supply below 3.15 V */
158 #define ADIS16240_DIAG_STAT_POWER_LOW_BIT       0
159
160 /* GLOB_CMD */
161
162 #define ADIS16240_GLOB_CMD_RESUME       BIT(8)
163 #define ADIS16240_GLOB_CMD_SW_RESET     BIT(7)
164 #define ADIS16240_GLOB_CMD_STANDBY      BIT(2)
165
166 #define ADIS16240_ERROR_ACTIVE          BIT(14)
167
168 /* At the moment triggers are only used for ring buffer
169  * filling. This may change!
170  */
171
172 #define ADIS16240_SCAN_ACC_X    0
173 #define ADIS16240_SCAN_ACC_Y    1
174 #define ADIS16240_SCAN_ACC_Z    2
175 #define ADIS16240_SCAN_SUPPLY   3
176 #define ADIS16240_SCAN_AUX_ADC  4
177 #define ADIS16240_SCAN_TEMP     5
178
179 #endif /* SPI_ADIS16240_H_ */