iio: dac: ad5686: Add support for AD5337
authorFabio Estevam <festevam@gmail.com>
Wed, 30 Nov 2022 18:26:32 +0000 (15:26 -0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 28 Dec 2022 17:19:45 +0000 (17:19 +0000)
AD5337 belongs to the same family as the AD5338.

The difference is that the AD5337 has 8-bit precision instead of 10-bit.

Add support for the AD5337 chip in the driver.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/20221130182632.3856675-2-festevam@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/dac/Kconfig
drivers/iio/dac/ad5686.c
drivers/iio/dac/ad5686.h
drivers/iio/dac/ad5696-i2c.c

index 80521bd..e83eb75 100644 (file)
@@ -162,10 +162,10 @@ config AD5696_I2C
        depends on I2C
        select AD5686
        help
-         Say yes here to build support for Analog Devices AD5311R, AD5338R,
-         AD5671R, AD5673R, AD5675R, AD5677R, AD5691R, AD5692R, AD5693, AD5693R,
-         AD5694, AD5694R, AD5695R, AD5696, and AD5696R Digital to Analog
-         converters.
+         Say yes here to build support for Analog Devices AD5311R, AD5337,
+         AD5338R, AD5671R, AD5673R, AD5675R, AD5677R, AD5691R, AD5692R, AD5693,
+         AD5693R, AD5694, AD5694R, AD5695R, AD5696, and AD5696R Digital to
+         Analog converters.
 
          To compile this driver as a module, choose M here: the module will be
          called ad5696.
index 15361d8..57cc0f0 100644 (file)
@@ -258,6 +258,7 @@ static const struct iio_chan_spec name[] = {                        \
 
 DECLARE_AD5693_CHANNELS(ad5310r_channels, 10, 2);
 DECLARE_AD5693_CHANNELS(ad5311r_channels, 10, 6);
+DECLARE_AD5338_CHANNELS(ad5337r_channels, 8, 8);
 DECLARE_AD5338_CHANNELS(ad5338r_channels, 10, 6);
 DECLARE_AD5676_CHANNELS(ad5672_channels, 12, 4);
 DECLARE_AD5679_CHANNELS(ad5674r_channels, 12, 4);
@@ -283,6 +284,12 @@ static const struct ad5686_chip_info ad5686_chip_info_tbl[] = {
                .num_channels = 1,
                .regmap_type = AD5693_REGMAP,
        },
+       [ID_AD5337R] = {
+               .channels = ad5337r_channels,
+               .int_vref_mv = 2500,
+               .num_channels = 2,
+               .regmap_type = AD5686_REGMAP,
+       },
        [ID_AD5338R] = {
                .channels = ad5338r_channels,
                .int_vref_mv = 2500,
index b7ade3a..760f852 100644 (file)
@@ -54,6 +54,7 @@
 enum ad5686_supported_device_ids {
        ID_AD5310R,
        ID_AD5311R,
+       ID_AD5337R,
        ID_AD5338R,
        ID_AD5671R,
        ID_AD5672R,
index 160e80c..8a95f02 100644 (file)
@@ -72,6 +72,7 @@ static void ad5686_i2c_remove(struct i2c_client *i2c)
 
 static const struct i2c_device_id ad5686_i2c_id[] = {
        {"ad5311r", ID_AD5311R},
+       {"ad5337r", ID_AD5337R},
        {"ad5338r", ID_AD5338R},
        {"ad5671r", ID_AD5671R},
        {"ad5673r", ID_AD5673R},
@@ -92,6 +93,7 @@ MODULE_DEVICE_TABLE(i2c, ad5686_i2c_id);
 
 static const struct of_device_id ad5686_of_match[] = {
        { .compatible = "adi,ad5311r" },
+       { .compatible = "adi,ad5337r" },
        { .compatible = "adi,ad5338r" },
        { .compatible = "adi,ad5671r" },
        { .compatible = "adi,ad5675r" },