Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c26cc89e authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Jonathan Cameron
Browse files

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: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 4c337de8
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -36,9 +36,9 @@ config AD7476
	select IIO_BUFFER
	select IIO_BUFFER
	select IIO_TRIGGERED_BUFFER
	select IIO_TRIGGERED_BUFFER
	help
	help
	  Say yes here to build support for Analog Devices AD7475, AD7476, AD7477,
	  Say yes here to build support for Analog Devices AD7273, AD7274, AD7276,
	  AD7478, AD7466, AD7467, AD7468, AD7495, AD7910, AD7920, AD7920 SPI analog
	  AD7277, AD7278, AD7475, AD7476, AD7477, AD7478, AD7466, AD7467, AD7468,
	  to digital converters (ADC).
	  AD7495, AD7910, AD7920, AD7920 SPI analog to digital converters (ADC).


	  If unsure, say N (but it's safe to say "Y").
	  If unsure, say N (but it's safe to say "Y").


+20 −0
Original line number Original line Diff line number Diff line
@@ -45,6 +45,9 @@ struct ad7476_state {
};
};


enum ad7476_supported_device_ids {
enum ad7476_supported_device_ids {
	ID_AD7276,
	ID_AD7277,
	ID_AD7278,
	ID_AD7466,
	ID_AD7466,
	ID_AD7467,
	ID_AD7467,
	ID_AD7468,
	ID_AD7468,
@@ -146,6 +149,18 @@ static int ad7476_read_raw(struct iio_dev *indio_dev,
#define AD7940_CHAN(bits) _AD7476_CHAN((bits), 15 - (bits))
#define AD7940_CHAN(bits) _AD7476_CHAN((bits), 15 - (bits))


static const struct ad7476_chip_info ad7476_chip_info_tbl[] = {
static const struct ad7476_chip_info ad7476_chip_info_tbl[] = {
	[ID_AD7276] = {
		.channel[0] = AD7940_CHAN(12),
		.channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1),
	},
	[ID_AD7277] = {
		.channel[0] = AD7940_CHAN(10),
		.channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1),
	},
	[ID_AD7278] = {
		.channel[0] = AD7940_CHAN(8),
		.channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1),
	},
	[ID_AD7466] = {
	[ID_AD7466] = {
		.channel[0] = AD7476_CHAN(12),
		.channel[0] = AD7476_CHAN(12),
		.channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1),
		.channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1),
@@ -256,6 +271,11 @@ static int __devexit ad7476_remove(struct spi_device *spi)
}
}


static const struct spi_device_id ad7476_id[] = {
static const struct spi_device_id ad7476_id[] = {
	{"ad7273", ID_AD7277},
	{"ad7274", ID_AD7276},
	{"ad7276", ID_AD7276},
	{"ad7277", ID_AD7277},
	{"ad7278", ID_AD7278},
	{"ad7466", ID_AD7466},
	{"ad7466", ID_AD7466},
	{"ad7467", ID_AD7467},
	{"ad7467", ID_AD7467},
	{"ad7468", ID_AD7468},
	{"ad7468", ID_AD7468},