2 * AD7476/5/7/8 (A) SPI ADC driver
4 * Copyright 2010 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
8 #ifndef IIO_ADC_AD7476_H_
9 #define IIO_ADC_AD7476_H_
11 #define RES_MASK(bits) ((1 << (bits)) - 1)
14 * TODO: struct ad7476_platform_data needs to go into include/linux/iio
17 struct ad7476_platform_data
{
21 struct ad7476_chip_info
{
23 struct iio_chan_spec channel
[2];
27 struct spi_device
*spi
;
28 const struct ad7476_chip_info
*chip_info
;
29 struct regulator
*reg
;
32 struct spi_transfer xfer
;
33 struct spi_message msg
;
35 * DMA (thus cache coherency maintenance) requires the
36 * transfer buffers to live in their own cache lines.
38 unsigned char data
[2] ____cacheline_aligned
;
41 enum ad7476_supported_device_ids
{
52 #ifdef CONFIG_IIO_RING_BUFFER
53 int ad7476_scan_from_ring(struct iio_dev
*indio_dev
);
54 int ad7476_register_ring_funcs_and_init(struct iio_dev
*indio_dev
);
55 void ad7476_ring_cleanup(struct iio_dev
*indio_dev
);
56 #else /* CONFIG_IIO_RING_BUFFER */
57 static inline int ad7476_scan_from_ring(struct iio_dev
*indio_dev
)
63 ad7476_register_ring_funcs_and_init(struct iio_dev
*indio_dev
)
68 static inline void ad7476_ring_cleanup(struct iio_dev
*indio_dev
)
71 #endif /* CONFIG_IIO_RING_BUFFER */
72 #endif /* IIO_ADC_AD7476_H_ */