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 * struct ad7606_chip_info - chip specific information
14 * @name: identification string for chip
15 * @channels: channel specification
16 * @num_channels: number of channels
19 struct ad7606_chip_info {
20 const struct iio_chan_spec *channels;
21 unsigned int num_channels;
25 * struct ad7606_state - driver instance specific data
30 const struct ad7606_chip_info *chip_info;
31 struct regulator *reg;
32 struct work_struct poll_work;
33 wait_queue_head_t wq_data_avail;
34 const struct ad7606_bus_ops *bops;
36 unsigned int oversampling;
38 void __iomem *base_address;
40 struct gpio_desc *gpio_convst;
41 struct gpio_desc *gpio_reset;
42 struct gpio_desc *gpio_range;
43 struct gpio_desc *gpio_standby;
44 struct gpio_desc *gpio_frstdata;
45 struct gpio_descs *gpio_os;
48 * DMA (thus cache coherency maintenance) requires the
49 * transfer buffers to live in their own cache lines.
50 * 8 * 16-bit samples + 64-bit timestamp
52 unsigned short data[12] ____cacheline_aligned;
55 struct ad7606_bus_ops {
56 /* more methods added in future? */
57 int (*read_block)(struct device *, int, void *);
60 int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
61 const char *name, unsigned int id,
62 const struct ad7606_bus_ops *bops);
63 int ad7606_remove(struct device *dev, int irq);
64 int ad7606_reset(struct ad7606_state *st);
65 int ad7606_read_samples(struct ad7606_state *st);
67 enum ad7606_supported_device_ids {
73 int ad7606_register_ring_funcs_and_init(struct iio_dev *indio_dev);
74 void ad7606_ring_cleanup(struct iio_dev *indio_dev);
76 #ifdef CONFIG_PM_SLEEP
77 extern const struct dev_pm_ops ad7606_pm_ops;
78 #define AD7606_PM_OPS (&ad7606_pm_ops)
80 #define AD7606_PM_OPS NULL
83 #endif /* IIO_ADC_AD7606_H_ */