Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: adc: ad4080: add support for AD4081

Add support for AD4081 20-bit SAR ADC. The AD4081 has the same
resolution as AD4080 (20-bit) but differs in LVDS CNV clock count
maximum (2 vs 7).

Changes:
- Add AD4081_CHIP_ID definition (0x0051)
- Create ad4081_channel with 20-bit resolution and 32-bit storage
- Add ad4081_chip_info with lvds_cnv_clk_cnt_max = 2
- Register AD4081 in device ID and OF match tables

Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Antoniu Miclaus and committed by
Jonathan Cameron
d34ad646 83185903

+15
+15
drivers/iio/adc/ad4080.c
··· 126 126 /* Miscellaneous Definitions */ 127 127 #define AD4080_SPI_READ BIT(7) 128 128 #define AD4080_CHIP_ID 0x0050 129 + #define AD4081_CHIP_ID 0x0051 129 130 #define AD4084_CHIP_ID 0x0054 130 131 131 132 #define AD4080_LVDS_CNV_CLK_CNT_MAX 7 ··· 437 436 438 437 static const struct iio_chan_spec ad4080_channel = AD4080_CHANNEL_DEFINE(20, 32); 439 438 439 + static const struct iio_chan_spec ad4081_channel = AD4080_CHANNEL_DEFINE(20, 32); 440 + 440 441 static const struct iio_chan_spec ad4084_channel = AD4080_CHANNEL_DEFINE(16, 16); 441 442 442 443 static const struct ad4080_chip_info ad4080_chip_info = { ··· 449 446 .num_channels = 1, 450 447 .channels = &ad4080_channel, 451 448 .lvds_cnv_clk_cnt_max = AD4080_LVDS_CNV_CLK_CNT_MAX, 449 + }; 450 + 451 + static const struct ad4080_chip_info ad4081_chip_info = { 452 + .name = "ad4081", 453 + .product_id = AD4081_CHIP_ID, 454 + .scale_table = ad4080_scale_table, 455 + .num_scales = ARRAY_SIZE(ad4080_scale_table), 456 + .num_channels = 1, 457 + .channels = &ad4081_channel, 458 + .lvds_cnv_clk_cnt_max = 2, 452 459 }; 453 460 454 461 static const struct ad4080_chip_info ad4084_chip_info = { ··· 626 613 627 614 static const struct spi_device_id ad4080_id[] = { 628 615 { "ad4080", (kernel_ulong_t)&ad4080_chip_info }, 616 + { "ad4081", (kernel_ulong_t)&ad4081_chip_info }, 629 617 { "ad4084", (kernel_ulong_t)&ad4084_chip_info }, 630 618 { } 631 619 }; ··· 634 620 635 621 static const struct of_device_id ad4080_of_match[] = { 636 622 { .compatible = "adi,ad4080", &ad4080_chip_info }, 623 + { .compatible = "adi,ad4081", &ad4081_chip_info }, 637 624 { .compatible = "adi,ad4084", &ad4084_chip_info }, 638 625 { } 639 626 };