4
* Copyright 2011 Analog Devices Inc.
6
* Licensed under the GPL-2.
9
#ifndef IIO_ADC_AD7606_H_
10
#define IIO_ADC_AD7606_H_
13
* TODO: struct ad7606_platform_data needs to go into include/linux/iio
17
* struct ad7606_platform_data - platform/board specifc information
18
* @default_os: default oversampling value {0, 2, 4, 8, 16, 32, 64}
19
* @default_range: default range +/-{5000, 10000} mVolt
20
* @gpio_convst: number of gpio connected to the CONVST pin
21
* @gpio_reset: gpio connected to the RESET pin, if not used set to -1
22
* @gpio_range: gpio connected to the RANGE pin, if not used set to -1
23
* @gpio_os0: gpio connected to the OS0 pin, if not used set to -1
24
* @gpio_os1: gpio connected to the OS1 pin, if not used set to -1
25
* @gpio_os2: gpio connected to the OS2 pin, if not used set to -1
26
* @gpio_frstdata: gpio connected to the FRSTDAT pin, if not used set to -1
27
* @gpio_stby: gpio connected to the STBY pin, if not used set to -1
30
struct ad7606_platform_data {
32
unsigned default_range;
39
unsigned gpio_frstdata;
44
* struct ad7606_chip_info - chip specifc information
45
* @name: indentification string for chip
46
* @bits: accuracy of the adc in bits
47
* @bits: output coding [s]igned or [u]nsigned
48
* @int_vref_mv: the internal reference voltage
49
* @num_channels: number of physical inputs on chip
52
struct ad7606_chip_info {
57
unsigned num_channels;
61
* struct ad7606_state - driver instance specific data
65
struct iio_dev *indio_dev;
67
const struct ad7606_chip_info *chip_info;
68
struct ad7606_platform_data *pdata;
69
struct regulator *reg;
70
struct work_struct poll_work;
71
wait_queue_head_t wq_data_avail;
72
atomic_t protect_ring;
74
const struct ad7606_bus_ops *bops;
78
unsigned oversampling;
85
void __iomem *base_address;
88
* DMA (thus cache coherency maintenance) requires the
89
* transfer buffers to live in their own cache lines.
92
unsigned short data[8] ____cacheline_aligned;
95
struct ad7606_bus_ops {
96
/* more methods added in future? */
97
int (*read_block)(struct device *, int, void *);
100
void ad7606_suspend(struct ad7606_state *st);
101
void ad7606_resume(struct ad7606_state *st);
102
struct ad7606_state *ad7606_probe(struct device *dev, int irq,
103
void __iomem *base_address, unsigned id,
104
const struct ad7606_bus_ops *bops);
105
int ad7606_remove(struct ad7606_state *st);
106
int ad7606_reset(struct ad7606_state *st);
108
enum ad7606_supported_device_ids {
114
int ad7606_scan_from_ring(struct ad7606_state *st, unsigned ch);
115
int ad7606_register_ring_funcs_and_init(struct iio_dev *indio_dev);
116
void ad7606_ring_cleanup(struct iio_dev *indio_dev);
117
#endif /* IIO_ADC_AD7606_H_ */