2011-02-22 13:46:18 -07:00
|
|
|
/*
|
|
|
|
* AD7606 ADC driver
|
|
|
|
*
|
|
|
|
* Copyright 2011 Analog Devices Inc.
|
|
|
|
*
|
|
|
|
* Licensed under the GPL-2.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef IIO_ADC_AD7606_H_
|
|
|
|
#define IIO_ADC_AD7606_H_
|
|
|
|
|
|
|
|
/**
|
2014-04-22 05:23:00 -06:00
|
|
|
* struct ad7606_chip_info - chip specific information
|
2013-10-11 17:29:46 -06:00
|
|
|
* @name: identification string for chip
|
2011-05-18 07:42:00 -06:00
|
|
|
* @channels: channel specification
|
|
|
|
* @num_channels: number of channels
|
2011-02-22 13:46:18 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
struct ad7606_chip_info {
|
2012-08-09 01:51:00 -06:00
|
|
|
const struct iio_chan_spec *channels;
|
2016-03-26 13:50:24 -06:00
|
|
|
unsigned int num_channels;
|
2011-02-22 13:46:18 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct ad7606_state - driver instance specific data
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct ad7606_state {
|
|
|
|
struct device *dev;
|
|
|
|
const struct ad7606_chip_info *chip_info;
|
|
|
|
struct regulator *reg;
|
|
|
|
struct work_struct poll_work;
|
|
|
|
wait_queue_head_t wq_data_avail;
|
|
|
|
const struct ad7606_bus_ops *bops;
|
2016-03-26 13:50:24 -06:00
|
|
|
unsigned int range;
|
|
|
|
unsigned int oversampling;
|
2011-02-22 13:46:18 -07:00
|
|
|
bool done;
|
|
|
|
void __iomem *base_address;
|
|
|
|
|
2016-10-19 11:07:07 -06:00
|
|
|
struct gpio_desc *gpio_convst;
|
|
|
|
struct gpio_desc *gpio_reset;
|
|
|
|
struct gpio_desc *gpio_range;
|
|
|
|
struct gpio_desc *gpio_standby;
|
|
|
|
struct gpio_desc *gpio_frstdata;
|
|
|
|
struct gpio_descs *gpio_os;
|
|
|
|
|
2011-02-22 13:46:18 -07:00
|
|
|
/*
|
|
|
|
* DMA (thus cache coherency maintenance) requires the
|
|
|
|
* transfer buffers to live in their own cache lines.
|
2016-10-19 11:07:01 -06:00
|
|
|
* 8 * 16-bit samples + 64-bit timestamp
|
2011-02-22 13:46:18 -07:00
|
|
|
*/
|
2016-10-19 11:07:01 -06:00
|
|
|
unsigned short data[12] ____cacheline_aligned;
|
2011-02-22 13:46:18 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ad7606_bus_ops {
|
|
|
|
/* more methods added in future? */
|
|
|
|
int (*read_block)(struct device *, int, void *);
|
|
|
|
};
|
|
|
|
|
2016-10-19 11:07:04 -06:00
|
|
|
int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
|
|
|
|
const char *name, unsigned int id,
|
|
|
|
const struct ad7606_bus_ops *bops);
|
2016-10-19 11:07:05 -06:00
|
|
|
int ad7606_remove(struct device *dev, int irq);
|
2011-02-22 13:46:18 -07:00
|
|
|
|
|
|
|
enum ad7606_supported_device_ids {
|
|
|
|
ID_AD7606_8,
|
|
|
|
ID_AD7606_6,
|
|
|
|
ID_AD7606_4
|
|
|
|
};
|
|
|
|
|
2016-02-08 03:13:29 -07:00
|
|
|
#ifdef CONFIG_PM_SLEEP
|
|
|
|
extern const struct dev_pm_ops ad7606_pm_ops;
|
|
|
|
#define AD7606_PM_OPS (&ad7606_pm_ops)
|
|
|
|
#else
|
|
|
|
#define AD7606_PM_OPS NULL
|
|
|
|
#endif
|
|
|
|
|
2011-02-22 13:46:18 -07:00
|
|
|
#endif /* IIO_ADC_AD7606_H_ */
|