aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio/accel/adis16240.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/iio/accel/adis16240.h')
-rw-r--r--drivers/staging/iio/accel/adis16240.h85
1 files changed, 9 insertions, 76 deletions
diff --git a/drivers/staging/iio/accel/adis16240.h b/drivers/staging/iio/accel/adis16240.h
index 3fabcc0b347..d442d49f51f 100644
--- a/drivers/staging/iio/accel/adis16240.h
+++ b/drivers/staging/iio/accel/adis16240.h
@@ -3,9 +3,6 @@
3 3
4#define ADIS16240_STARTUP_DELAY 220 /* ms */ 4#define ADIS16240_STARTUP_DELAY 220 /* ms */
5 5
6#define ADIS16240_READ_REG(a) a
7#define ADIS16240_WRITE_REG(a) ((a) | 0x80)
8
9/* Flash memory write count */ 6/* Flash memory write count */
10#define ADIS16240_FLASH_CNT 0x00 7#define ADIS16240_FLASH_CNT 0x00
11/* Output, power supply */ 8/* Output, power supply */
@@ -75,8 +72,6 @@
75/* System command */ 72/* System command */
76#define ADIS16240_GLOB_CMD 0x4A 73#define ADIS16240_GLOB_CMD 0x4A
77 74
78#define ADIS16240_OUTPUTS 6
79
80/* MSC_CTRL */ 75/* MSC_CTRL */
81/* Enables sum-of-squares output (XYZPEAK_OUT) */ 76/* Enables sum-of-squares output (XYZPEAK_OUT) */
82#define ADIS16240_MSC_CTRL_XYZPEAK_OUT_EN (1 << 15) 77#define ADIS16240_MSC_CTRL_XYZPEAK_OUT_EN (1 << 15)
@@ -101,17 +96,17 @@
101/* Flash test, checksum flag: 1 = mismatch, 0 = match */ 96/* Flash test, checksum flag: 1 = mismatch, 0 = match */
102#define ADIS16240_DIAG_STAT_CHKSUM (1<<6) 97#define ADIS16240_DIAG_STAT_CHKSUM (1<<6)
103/* Power-on, self-test flag: 1 = failure, 0 = pass */ 98/* Power-on, self-test flag: 1 = failure, 0 = pass */
104#define ADIS16240_DIAG_STAT_PWRON_FAIL (1<<5) 99#define ADIS16240_DIAG_STAT_PWRON_FAIL_BIT 5
105/* Power-on self-test: 1 = in-progress, 0 = complete */ 100/* Power-on self-test: 1 = in-progress, 0 = complete */
106#define ADIS16240_DIAG_STAT_PWRON_BUSY (1<<4) 101#define ADIS16240_DIAG_STAT_PWRON_BUSY (1<<4)
107/* SPI communications failure */ 102/* SPI communications failure */
108#define ADIS16240_DIAG_STAT_SPI_FAIL (1<<3) 103#define ADIS16240_DIAG_STAT_SPI_FAIL_BIT 3
109/* Flash update failure */ 104/* Flash update failure */
110#define ADIS16240_DIAG_STAT_FLASH_UPT (1<<2) 105#define ADIS16240_DIAG_STAT_FLASH_UPT_BIT 2
111/* Power supply above 3.625 V */ 106/* Power supply above 3.625 V */
112#define ADIS16240_DIAG_STAT_POWER_HIGH (1<<1) 107#define ADIS16240_DIAG_STAT_POWER_HIGH_BIT 1
113 /* Power supply below 3.15 V */ 108 /* Power supply below 3.15 V */
114#define ADIS16240_DIAG_STAT_POWER_LOW (1<<0) 109#define ADIS16240_DIAG_STAT_POWER_LOW_BIT 0
115 110
116/* GLOB_CMD */ 111/* GLOB_CMD */
117#define ADIS16240_GLOB_CMD_RESUME (1<<8) 112#define ADIS16240_GLOB_CMD_RESUME (1<<8)
@@ -120,77 +115,15 @@
120 115
121#define ADIS16240_ERROR_ACTIVE (1<<14) 116#define ADIS16240_ERROR_ACTIVE (1<<14)
122 117
123#define ADIS16240_MAX_TX 24
124#define ADIS16240_MAX_RX 24
125
126/**
127 * struct adis16240_state - device instance specific data
128 * @us: actual spi_device
129 * @trig: data ready trigger registered with iio
130 * @tx: transmit buffer
131 * @rx: receive buffer
132 * @buf_lock: mutex to protect tx and rx
133 **/
134struct adis16240_state {
135 struct spi_device *us;
136 struct iio_trigger *trig;
137 struct mutex buf_lock;
138 u8 tx[ADIS16240_MAX_TX] ____cacheline_aligned;
139 u8 rx[ADIS16240_MAX_RX];
140};
141
142int adis16240_set_irq(struct iio_dev *indio_dev, bool enable);
143
144/* At the moment triggers are only used for ring buffer 118/* At the moment triggers are only used for ring buffer
145 * filling. This may change! 119 * filling. This may change!
146 */ 120 */
147 121
148#define ADIS16240_SCAN_SUPPLY 0 122#define ADIS16240_SCAN_ACC_X 0
149#define ADIS16240_SCAN_ACC_X 1 123#define ADIS16240_SCAN_ACC_Y 1
150#define ADIS16240_SCAN_ACC_Y 2 124#define ADIS16240_SCAN_ACC_Z 2
151#define ADIS16240_SCAN_ACC_Z 3 125#define ADIS16240_SCAN_SUPPLY 3
152#define ADIS16240_SCAN_AUX_ADC 4 126#define ADIS16240_SCAN_AUX_ADC 4
153#define ADIS16240_SCAN_TEMP 5 127#define ADIS16240_SCAN_TEMP 5
154 128
155#ifdef CONFIG_IIO_BUFFER
156void adis16240_remove_trigger(struct iio_dev *indio_dev);
157int adis16240_probe_trigger(struct iio_dev *indio_dev);
158
159ssize_t adis16240_read_data_from_ring(struct device *dev,
160 struct device_attribute *attr,
161 char *buf);
162
163
164int adis16240_configure_ring(struct iio_dev *indio_dev);
165void adis16240_unconfigure_ring(struct iio_dev *indio_dev);
166
167#else /* CONFIG_IIO_BUFFER */
168
169static inline void adis16240_remove_trigger(struct iio_dev *indio_dev)
170{
171}
172
173static inline int adis16240_probe_trigger(struct iio_dev *indio_dev)
174{
175 return 0;
176}
177
178static inline ssize_t
179adis16240_read_data_from_ring(struct device *dev,
180 struct device_attribute *attr,
181 char *buf)
182{
183 return 0;
184}
185
186static int adis16240_configure_ring(struct iio_dev *indio_dev)
187{
188 return 0;
189}
190
191static inline void adis16240_unconfigure_ring(struct iio_dev *indio_dev)
192{
193}
194
195#endif /* CONFIG_IIO_BUFFER */
196#endif /* SPI_ADIS16240_H_ */ 129#endif /* SPI_ADIS16240_H_ */