]> Git Repo - linux.git/blob - drivers/iio/adc/ad7606.h
mips: vdso: drop unnecessary cc-ldoption
[linux.git] / drivers / iio / adc / ad7606.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * AD7606 ADC driver
4  *
5  * Copyright 2011 Analog Devices Inc.
6  */
7
8 #ifndef IIO_ADC_AD7606_H_
9 #define IIO_ADC_AD7606_H_
10
11 /**
12  * struct ad7606_chip_info - chip specific information
13  * @channels:           channel specification
14  * @num_channels:       number of channels
15  * @has_oversampling:   whether the device has oversampling support
16  */
17 struct ad7606_chip_info {
18         const struct iio_chan_spec      *channels;
19         unsigned int                    num_channels;
20         bool                            has_oversampling;
21 };
22
23 /**
24  * struct ad7606_state - driver instance specific data
25  * @dev         pointer to kernel device
26  * @chip_info           entry in the table of chips that describes this device
27  * @reg         regulator info for the the power supply of the device
28  * @bops                bus operations (SPI or parallel)
29  * @range               voltage range selection, selects which scale to apply
30  * @oversampling        oversampling selection
31  * @base_address        address from where to read data in parallel operation
32  * @lock                protect sensor state from concurrent accesses to GPIOs
33  * @gpio_convst GPIO descriptor for conversion start signal (CONVST)
34  * @gpio_reset          GPIO descriptor for device hard-reset
35  * @gpio_range          GPIO descriptor for range selection
36  * @gpio_standby        GPIO descriptor for stand-by signal (STBY),
37  *                      controls power-down mode of device
38  * @gpio_frstdata       GPIO descriptor for reading from device when data
39  *                      is being read on the first channel
40  * @gpio_os             GPIO descriptors to control oversampling on the device
41  * @complete            completion to indicate end of conversion
42  * @trig                The IIO trigger associated with the device.
43  * @data                buffer for reading data from the device
44  */
45 struct ad7606_state {
46         struct device                   *dev;
47         const struct ad7606_chip_info   *chip_info;
48         struct regulator                *reg;
49         const struct ad7606_bus_ops     *bops;
50         unsigned int                    range;
51         unsigned int                    oversampling;
52         void __iomem                    *base_address;
53
54         struct mutex                    lock; /* protect sensor state */
55         struct gpio_desc                *gpio_convst;
56         struct gpio_desc                *gpio_reset;
57         struct gpio_desc                *gpio_range;
58         struct gpio_desc                *gpio_standby;
59         struct gpio_desc                *gpio_frstdata;
60         struct gpio_descs               *gpio_os;
61         struct iio_trigger              *trig;
62         struct completion               completion;
63
64         /*
65          * DMA (thus cache coherency maintenance) requires the
66          * transfer buffers to live in their own cache lines.
67          * 8 * 16-bit samples + 64-bit timestamp
68          */
69         unsigned short                  data[12] ____cacheline_aligned;
70 };
71
72 /**
73  * struct ad7606_bus_ops - driver bus operations
74  * @read_block          function pointer for reading blocks of data
75  */
76 struct ad7606_bus_ops {
77         /* more methods added in future? */
78         int (*read_block)(struct device *dev, int num, void *data);
79 };
80
81 int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
82                  const char *name, unsigned int id,
83                  const struct ad7606_bus_ops *bops);
84
85 enum ad7606_supported_device_ids {
86         ID_AD7605_4,
87         ID_AD7606_8,
88         ID_AD7606_6,
89         ID_AD7606_4
90 };
91
92 #ifdef CONFIG_PM_SLEEP
93 extern const struct dev_pm_ops ad7606_pm_ops;
94 #define AD7606_PM_OPS (&ad7606_pm_ops)
95 #else
96 #define AD7606_PM_OPS NULL
97 #endif
98
99 #endif /* IIO_ADC_AD7606_H_ */
This page took 0.032647 seconds and 4 git commands to generate.