1 #ifndef SPI_ADIS16060_H_
2 #define SPI_ADIS16060_H_
4 #define ADIS16060_GYRO 0x20 /* Measure Angular Rate (Gyro) */
5 #define ADIS16060_SUPPLY_OUT 0x10 /* Measure Temperature */
6 #define ADIS16060_AIN2 0x80 /* Measure AIN2 */
7 #define ADIS16060_AIN1 0x40 /* Measure AIN1 */
8 #define ADIS16060_TEMP_OUT 0x22 /* Set Positive Self-Test and Output for Angular Rate */
9 #define ADIS16060_ANGL_OUT 0x21 /* Set Negative Self-Test and Output for Angular Rate */
11 #define ADIS16060_MAX_TX 3
12 #define ADIS16060_MAX_RX 3
15 * struct adis16060_state - device instance specific data
16 * @us_w: actual spi_device to write data
17 * @work_trigger_to_ring: bh for triggered event handling
18 * @inter: used to check if new interrupt has been triggered
19 * @last_timestamp: passing timestamp from th to bh of interrupt handler
20 * @indio_dev: industrial I/O device structure
21 * @trig: data ready trigger registered with iio
22 * @tx: transmit buffer
24 * @buf_lock: mutex to protect tx and rx
26 struct adis16060_state {
27 struct spi_device *us_w;
28 struct spi_device *us_r;
29 struct work_struct work_trigger_to_ring;
31 struct iio_dev *indio_dev;
32 struct iio_trigger *trig;
35 struct mutex buf_lock;
38 #if defined(CONFIG_IIO_RING_BUFFER) && defined(THIS_HAS_RING_BUFFER_SUPPORT)
39 /* At the moment triggers are only used for ring buffer
40 * filling. This may change!
50 void adis16060_remove_trigger(struct iio_dev *indio_dev);
51 int adis16060_probe_trigger(struct iio_dev *indio_dev);
53 ssize_t adis16060_read_data_from_ring(struct device *dev,
54 struct device_attribute *attr,
58 int adis16060_configure_ring(struct iio_dev *indio_dev);
59 void adis16060_unconfigure_ring(struct iio_dev *indio_dev);
61 int adis16060_initialize_ring(struct iio_ring_buffer *ring);
62 void adis16060_uninitialize_ring(struct iio_ring_buffer *ring);
63 #else /* CONFIG_IIO_RING_BUFFER */
65 static inline void adis16060_remove_trigger(struct iio_dev *indio_dev)
69 static inline int adis16060_probe_trigger(struct iio_dev *indio_dev)
75 adis16060_read_data_from_ring(struct device *dev,
76 struct device_attribute *attr,
82 static int adis16060_configure_ring(struct iio_dev *indio_dev)
87 static inline void adis16060_unconfigure_ring(struct iio_dev *indio_dev)
91 static inline int adis16060_initialize_ring(struct iio_ring_buffer *ring)
96 static inline void adis16060_uninitialize_ring(struct iio_ring_buffer *ring)
100 #endif /* CONFIG_IIO_RING_BUFFER */
101 #endif /* SPI_ADIS16060_H_ */