aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2012-09-10 05:33:00 -0400
committerJonathan Cameron <jic23@kernel.org>2012-09-15 05:02:16 -0400
commitc26cc89e8d758804499dcaa58ba7d2a993b954fe (patch)
treed2b39ac54cfe1dfbd4b5ee838e94dfd84412bf32
parent4c337de870d9bd1459ab603574256bb0e7644ad6 (diff)
iio:ad7476: Add support for ad7273/ad7274/ad7276/ad7277/ad7278
The ad7276/ad7277/ad7278 are similar to the ad7476/ad7477/ad7478 but have the same number of leading zeros as the ad7940. The ad7273/ad7274 have a extra pin for VREF where as for the ad7276/ad7277/ad7278 VREF is taken from VDD, but otherwise they are compatible to the ad7276/ad7277. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r--drivers/iio/adc/Kconfig6
-rw-r--r--drivers/iio/adc/ad7476.c20
2 files changed, 23 insertions, 3 deletions
diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
index e2e696395ac8..03791a6de349 100644
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -36,9 +36,9 @@ config AD7476
36 select IIO_BUFFER 36 select IIO_BUFFER
37 select IIO_TRIGGERED_BUFFER 37 select IIO_TRIGGERED_BUFFER
38 help 38 help
39 Say yes here to build support for Analog Devices AD7475, AD7476, AD7477, 39 Say yes here to build support for Analog Devices AD7273, AD7274, AD7276,
40 AD7478, AD7466, AD7467, AD7468, AD7495, AD7910, AD7920, AD7920 SPI analog 40 AD7277, AD7278, AD7475, AD7476, AD7477, AD7478, AD7466, AD7467, AD7468,
41 to digital converters (ADC). 41 AD7495, AD7910, AD7920, AD7920 SPI analog to digital converters (ADC).
42 42
43 If unsure, say N (but it's safe to say "Y"). 43 If unsure, say N (but it's safe to say "Y").
44 44
diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c
index be22757d54e4..be2098d62b8b 100644
--- a/drivers/iio/adc/ad7476.c
+++ b/drivers/iio/adc/ad7476.c
@@ -45,6 +45,9 @@ struct ad7476_state {
45}; 45};
46 46
47enum ad7476_supported_device_ids { 47enum ad7476_supported_device_ids {
48 ID_AD7276,
49 ID_AD7277,
50 ID_AD7278,
48 ID_AD7466, 51 ID_AD7466,
49 ID_AD7467, 52 ID_AD7467,
50 ID_AD7468, 53 ID_AD7468,
@@ -146,6 +149,18 @@ static int ad7476_read_raw(struct iio_dev *indio_dev,
146#define AD7940_CHAN(bits) _AD7476_CHAN((bits), 15 - (bits)) 149#define AD7940_CHAN(bits) _AD7476_CHAN((bits), 15 - (bits))
147 150
148static const struct ad7476_chip_info ad7476_chip_info_tbl[] = { 151static const struct ad7476_chip_info ad7476_chip_info_tbl[] = {
152 [ID_AD7276] = {
153 .channel[0] = AD7940_CHAN(12),
154 .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1),
155 },
156 [ID_AD7277] = {
157 .channel[0] = AD7940_CHAN(10),
158 .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1),
159 },
160 [ID_AD7278] = {
161 .channel[0] = AD7940_CHAN(8),
162 .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1),
163 },
149 [ID_AD7466] = { 164 [ID_AD7466] = {
150 .channel[0] = AD7476_CHAN(12), 165 .channel[0] = AD7476_CHAN(12),
151 .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), 166 .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1),
@@ -256,6 +271,11 @@ static int __devexit ad7476_remove(struct spi_device *spi)
256} 271}
257 272
258static const struct spi_device_id ad7476_id[] = { 273static const struct spi_device_id ad7476_id[] = {
274 {"ad7273", ID_AD7277},
275 {"ad7274", ID_AD7276},
276 {"ad7276", ID_AD7276},
277 {"ad7277", ID_AD7277},
278 {"ad7278", ID_AD7278},
259 {"ad7466", ID_AD7466}, 279 {"ad7466", ID_AD7466},
260 {"ad7467", ID_AD7467}, 280 {"ad7467", ID_AD7467},
261 {"ad7468", ID_AD7468}, 281 {"ad7468", ID_AD7468},