1 /* 2 * AD7606 ADC driver 3 * 4 * Copyright 2011 Analog Devices Inc. 5 * 6 * Licensed under the GPL-2. 7 */ 8 9 #ifndef IIO_ADC_AD7606_H_ 10 #define IIO_ADC_AD7606_H_ 11 12 /** 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 18 */ 19 20 struct ad7606_chip_info { 21 const struct iio_chan_spec *channels; 22 unsigned int num_channels; 23 }; 24 25 /** 26 * struct ad7606_state - driver instance specific data 27 * @lock protect sensor state 28 */ 29 30 struct ad7606_state { 31 struct device *dev; 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; 37 unsigned int range; 38 unsigned int oversampling; 39 bool done; 40 void __iomem *base_address; 41 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; 49 50 /* 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 54 */ 55 unsigned short data[12] ____cacheline_aligned; 56 }; 57 58 struct ad7606_bus_ops { 59 /* more methods added in future? */ 60 int (*read_block)(struct device *dev, int num, void *data); 61 }; 62 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); 67 68 enum ad7606_supported_device_ids { 69 ID_AD7606_8, 70 ID_AD7606_6, 71 ID_AD7606_4 72 }; 73 74 #ifdef CONFIG_PM_SLEEP 75 extern const struct dev_pm_ops ad7606_pm_ops; 76 #define AD7606_PM_OPS (&ad7606_pm_ops) 77 #else 78 #define AD7606_PM_OPS NULL 79 #endif 80 81 #endif /* IIO_ADC_AD7606_H_ */ 82