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 AD4084

Add support for AD4084 16-bit SAR ADC. The AD4084 differs from
AD4080 in resolution (16-bit vs 20-bit) and LVDS CNV clock count
maximum (2 vs 7).

Changes:
- Add AD4084_CHIP_ID definition (0x0054)
- Create ad4084_channel with 16-bit resolution and storage
- Add ad4084_chip_info with appropriate configuration
- Register AD4084 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
6c3e7265 1b86053b

+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 AD4084_CHIP_ID 0x0054 129 130 130 131 #define AD4080_LVDS_CNV_CLK_CNT_MAX 7 131 132 ··· 436 435 437 436 static const struct iio_chan_spec ad4080_channel = AD4080_CHANNEL_DEFINE(20, 32); 438 437 438 + static const struct iio_chan_spec ad4084_channel = AD4080_CHANNEL_DEFINE(16, 16); 439 + 439 440 static const struct ad4080_chip_info ad4080_chip_info = { 440 441 .name = "ad4080", 441 442 .product_id = AD4080_CHIP_ID, ··· 446 443 .num_channels = 1, 447 444 .channels = &ad4080_channel, 448 445 .lvds_cnv_clk_cnt_max = AD4080_LVDS_CNV_CLK_CNT_MAX, 446 + }; 447 + 448 + static const struct ad4080_chip_info ad4084_chip_info = { 449 + .name = "ad4084", 450 + .product_id = AD4084_CHIP_ID, 451 + .scale_table = ad4080_scale_table, 452 + .num_scales = ARRAY_SIZE(ad4080_scale_table), 453 + .num_channels = 1, 454 + .channels = &ad4084_channel, 455 + .lvds_cnv_clk_cnt_max = 2, 449 456 }; 450 457 451 458 static int ad4080_setup(struct iio_dev *indio_dev) ··· 613 600 614 601 static const struct spi_device_id ad4080_id[] = { 615 602 { "ad4080", (kernel_ulong_t)&ad4080_chip_info }, 603 + { "ad4084", (kernel_ulong_t)&ad4084_chip_info }, 616 604 { } 617 605 }; 618 606 MODULE_DEVICE_TABLE(spi, ad4080_id); 619 607 620 608 static const struct of_device_id ad4080_of_match[] = { 621 609 { .compatible = "adi,ad4080", &ad4080_chip_info }, 610 + { .compatible = "adi,ad4084", &ad4084_chip_info }, 622 611 { } 623 612 }; 624 613 MODULE_DEVICE_TABLE(of, ad4080_of_match);