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
17 * @lock protect sensor state
20 struct ad7606_chip_info {
21 const struct iio_chan_spec *channels;
22 unsigned int num_channels;
26 * struct ad7606_state - driver instance specific data
27 * @lock protect sensor state
32 const struct ad7606_chip_info *chip_info;
33 struct regulator *reg;
34 struct work_struct poll_work;
35 wait_queue_head_t wq_data_avail;
36 const struct ad7606_bus_ops *bops;
38 unsigned int oversampling;
40 void __iomem *base_address;
42 struct mutex lock; /* protect sensor state */
43 struct gpio_desc *gpio_convst;
44 struct gpio_desc *gpio_reset;
45 struct gpio_desc *gpio_range;
46 struct gpio_desc *gpio_standby;
47 struct gpio_desc *gpio_frstdata;
48 struct gpio_descs *gpio_os;
51 * DMA (thus cache coherency maintenance) requires the
52 * transfer buffers to live in their own cache lines.
53 * 8 * 16-bit samples + 64-bit timestamp
55 unsigned short data[12] ____cacheline_aligned;
58 struct ad7606_bus_ops {
59 /* more methods added in future? */
60 int (*read_block)(struct device *dev, int num, void *data);
63 int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
64 const char *name, unsigned int id,
65 const struct ad7606_bus_ops *bops);
66 int ad7606_remove(struct device *dev, int irq);
68 enum ad7606_supported_device_ids {
74 #ifdef CONFIG_PM_SLEEP
75 extern const struct dev_pm_ops ad7606_pm_ops;
76 #define AD7606_PM_OPS (&ad7606_pm_ops)
78 #define AD7606_PM_OPS NULL
81 #endif /* IIO_ADC_AD7606_H_ */