GNU Linux-libre 4.9.309-gnu1
[releases.git] / drivers / staging / iio / accel / adis16209.h
1 #ifndef SPI_ADIS16209_H_
2 #define SPI_ADIS16209_H_
3
4 #define ADIS16209_STARTUP_DELAY 220 /* ms */
5
6 /* Flash memory write count */
7 #define ADIS16209_FLASH_CNT      0x00
8
9 /* Output, power supply */
10 #define ADIS16209_SUPPLY_OUT     0x02
11
12 /* Output, x-axis accelerometer */
13 #define ADIS16209_XACCL_OUT      0x04
14
15 /* Output, y-axis accelerometer */
16 #define ADIS16209_YACCL_OUT      0x06
17
18 /* Output, auxiliary ADC input */
19 #define ADIS16209_AUX_ADC        0x08
20
21 /* Output, temperature */
22 #define ADIS16209_TEMP_OUT       0x0A
23
24 /* Output, x-axis inclination */
25 #define ADIS16209_XINCL_OUT      0x0C
26
27 /* Output, y-axis inclination */
28 #define ADIS16209_YINCL_OUT      0x0E
29
30 /* Output, +/-180 vertical rotational position */
31 #define ADIS16209_ROT_OUT        0x10
32
33 /* Calibration, x-axis acceleration offset null */
34 #define ADIS16209_XACCL_NULL     0x12
35
36 /* Calibration, y-axis acceleration offset null */
37 #define ADIS16209_YACCL_NULL     0x14
38
39 /* Calibration, x-axis inclination offset null */
40 #define ADIS16209_XINCL_NULL     0x16
41
42 /* Calibration, y-axis inclination offset null */
43 #define ADIS16209_YINCL_NULL     0x18
44
45 /* Calibration, vertical rotation offset null */
46 #define ADIS16209_ROT_NULL       0x1A
47
48 /* Alarm 1 amplitude threshold */
49 #define ADIS16209_ALM_MAG1       0x20
50
51 /* Alarm 2 amplitude threshold */
52 #define ADIS16209_ALM_MAG2       0x22
53
54 /* Alarm 1, sample period */
55 #define ADIS16209_ALM_SMPL1      0x24
56
57 /* Alarm 2, sample period */
58 #define ADIS16209_ALM_SMPL2      0x26
59
60 /* Alarm control */
61 #define ADIS16209_ALM_CTRL       0x28
62
63 /* Auxiliary DAC data */
64 #define ADIS16209_AUX_DAC        0x30
65
66 /* General-purpose digital input/output control */
67 #define ADIS16209_GPIO_CTRL      0x32
68
69 /* Miscellaneous control */
70 #define ADIS16209_MSC_CTRL       0x34
71
72 /* Internal sample period (rate) control */
73 #define ADIS16209_SMPL_PRD       0x36
74
75 /* Operation, filter configuration */
76 #define ADIS16209_AVG_CNT        0x38
77
78 /* Operation, sleep mode control */
79 #define ADIS16209_SLP_CNT        0x3A
80
81 /* Diagnostics, system status register */
82 #define ADIS16209_DIAG_STAT      0x3C
83
84 /* Operation, system command register */
85 #define ADIS16209_GLOB_CMD       0x3E
86
87 /* MSC_CTRL */
88
89 /* Self-test at power-on: 1 = disabled, 0 = enabled */
90 #define ADIS16209_MSC_CTRL_PWRUP_SELF_TEST      BIT(10)
91
92 /* Self-test enable */
93 #define ADIS16209_MSC_CTRL_SELF_TEST_EN         BIT(8)
94
95 /* Data-ready enable: 1 = enabled, 0 = disabled */
96 #define ADIS16209_MSC_CTRL_DATA_RDY_EN          BIT(2)
97
98 /* Data-ready polarity: 1 = active high, 0 = active low */
99 #define ADIS16209_MSC_CTRL_ACTIVE_HIGH          BIT(1)
100
101 /* Data-ready line selection: 1 = DIO2, 0 = DIO1 */
102 #define ADIS16209_MSC_CTRL_DATA_RDY_DIO2        BIT(0)
103
104 /* DIAG_STAT */
105
106 /* Alarm 2 status: 1 = alarm active, 0 = alarm inactive */
107 #define ADIS16209_DIAG_STAT_ALARM2        BIT(9)
108
109 /* Alarm 1 status: 1 = alarm active, 0 = alarm inactive */
110 #define ADIS16209_DIAG_STAT_ALARM1        BIT(8)
111
112 /* Self-test diagnostic error flag: 1 = error condition, 0 = normal operation */
113 #define ADIS16209_DIAG_STAT_SELFTEST_FAIL_BIT   5
114
115 /* SPI communications failure */
116 #define ADIS16209_DIAG_STAT_SPI_FAIL_BIT        3
117
118 /* Flash update failure */
119 #define ADIS16209_DIAG_STAT_FLASH_UPT_BIT       2
120
121 /* Power supply above 3.625 V */
122 #define ADIS16209_DIAG_STAT_POWER_HIGH_BIT      1
123
124 /* Power supply below 3.15 V */
125 #define ADIS16209_DIAG_STAT_POWER_LOW_BIT       0
126
127 /* GLOB_CMD */
128
129 #define ADIS16209_GLOB_CMD_SW_RESET     BIT(7)
130 #define ADIS16209_GLOB_CMD_CLEAR_STAT   BIT(4)
131 #define ADIS16209_GLOB_CMD_FACTORY_CAL  BIT(1)
132
133 #define ADIS16209_ERROR_ACTIVE          BIT(14)
134
135 #define ADIS16209_SCAN_SUPPLY   0
136 #define ADIS16209_SCAN_ACC_X    1
137 #define ADIS16209_SCAN_ACC_Y    2
138 #define ADIS16209_SCAN_AUX_ADC  3
139 #define ADIS16209_SCAN_TEMP     4
140 #define ADIS16209_SCAN_INCLI_X  5
141 #define ADIS16209_SCAN_INCLI_Y  6
142 #define ADIS16209_SCAN_ROT      7
143
144 #endif /* SPI_ADIS16209_H_ */