Re: [PATCH v2 6/6] iio:dac:ad5686: Add AD5671R/75R/94/94R/95R/96/96R support

2018-04-10 Thread Randy Dunlap
On 04/10/18 08:58, Stefan Popa wrote:
> The AD5694/AD5694R/AD5695R/AD5696/AD5696R are a family of 4 channel DACs
> with 12-bit, 14-bit and 16-bit precision respectively. The devices have
> either no built-in reference, or built-in 2.5V reference.
> 
> The AD5671R/AD5675R are similar, except that they have 8 instead of 4
> channels.
> 
> These devices are similar to AD5672R/AD5676/AD5676R and
> AD5684/AD5684R/AD5684/AD5685R/AD5686/AD5686R, except that they use i2c
> instead of spi.
> 
> Datasheets:
> http://www.analog.com/media/en/technical-documentation/data-sheets/AD5671R_5675R.pdf
> http://www.analog.com/media/en/technical-documentation/data-sheets/AD5696R_5695R_5694R.pdf
> 
> Signed-off-by: Stefan Popa 
> ---
> Changes in v2:
>   - Refactored the patch
> 
>  MAINTAINERS  |  1 +
>  drivers/iio/dac/Kconfig  | 10 +
>  drivers/iio/dac/Makefile |  1 +
>  drivers/iio/dac/ad5686.c | 28 +
>  drivers/iio/dac/ad5686.h |  7 
>  drivers/iio/dac/ad5696-i2c.c | 98 
> 
>  6 files changed, 145 insertions(+)
>  create mode 100644 drivers/iio/dac/ad5696-i2c.c
> 
> diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig
> index a00fc45..dab0b8a 100644
> --- a/drivers/iio/dac/Kconfig
> +++ b/drivers/iio/dac/Kconfig
> @@ -145,6 +145,16 @@ config AD5686_SPI
>   To compile this driver as a module, choose M here: the
>   module will be called ad5686.
>  
> +config AD5696_I2C
> + tristate "Analog Devices AD5696 and similar multi-channel DACs (I2C)"
> + depends on I2C
> + select AD5686
> + help
> + Say yes here to build support for Analog Devices AD5671R, AD5675R,
> + AD5694, AD5694R, AD5695R, AD5696, AD5696R Voltage Output Digital to
> + Analog Converter.
> + To compile this driver as a module, choose M here: the module will be
> + called ad5696.

The help text (following the "help" line) should be indented 2 additional 
spaces,
according to Documentation/process/coding-style.rst.

(for patches 5 & 6)

>  config AD5755
>   tristate "Analog Devices AD5755/AD5755-1/AD5757/AD5735/AD5737 DAC 
> driver"


-- 
~Randy


Re: [PATCH v2 6/6] iio:dac:ad5686: Add AD5671R/75R/94/94R/95R/96/96R support

2018-04-10 Thread Randy Dunlap
On 04/10/18 08:58, Stefan Popa wrote:
> The AD5694/AD5694R/AD5695R/AD5696/AD5696R are a family of 4 channel DACs
> with 12-bit, 14-bit and 16-bit precision respectively. The devices have
> either no built-in reference, or built-in 2.5V reference.
> 
> The AD5671R/AD5675R are similar, except that they have 8 instead of 4
> channels.
> 
> These devices are similar to AD5672R/AD5676/AD5676R and
> AD5684/AD5684R/AD5684/AD5685R/AD5686/AD5686R, except that they use i2c
> instead of spi.
> 
> Datasheets:
> http://www.analog.com/media/en/technical-documentation/data-sheets/AD5671R_5675R.pdf
> http://www.analog.com/media/en/technical-documentation/data-sheets/AD5696R_5695R_5694R.pdf
> 
> Signed-off-by: Stefan Popa 
> ---
> Changes in v2:
>   - Refactored the patch
> 
>  MAINTAINERS  |  1 +
>  drivers/iio/dac/Kconfig  | 10 +
>  drivers/iio/dac/Makefile |  1 +
>  drivers/iio/dac/ad5686.c | 28 +
>  drivers/iio/dac/ad5686.h |  7 
>  drivers/iio/dac/ad5696-i2c.c | 98 
> 
>  6 files changed, 145 insertions(+)
>  create mode 100644 drivers/iio/dac/ad5696-i2c.c
> 
> diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig
> index a00fc45..dab0b8a 100644
> --- a/drivers/iio/dac/Kconfig
> +++ b/drivers/iio/dac/Kconfig
> @@ -145,6 +145,16 @@ config AD5686_SPI
>   To compile this driver as a module, choose M here: the
>   module will be called ad5686.
>  
> +config AD5696_I2C
> + tristate "Analog Devices AD5696 and similar multi-channel DACs (I2C)"
> + depends on I2C
> + select AD5686
> + help
> + Say yes here to build support for Analog Devices AD5671R, AD5675R,
> + AD5694, AD5694R, AD5695R, AD5696, AD5696R Voltage Output Digital to
> + Analog Converter.
> + To compile this driver as a module, choose M here: the module will be
> + called ad5696.

The help text (following the "help" line) should be indented 2 additional 
spaces,
according to Documentation/process/coding-style.rst.

(for patches 5 & 6)

>  config AD5755
>   tristate "Analog Devices AD5755/AD5755-1/AD5757/AD5735/AD5737 DAC 
> driver"


-- 
~Randy


[PATCH v2 6/6] iio:dac:ad5686: Add AD5671R/75R/94/94R/95R/96/96R support

2018-04-10 Thread Stefan Popa
The AD5694/AD5694R/AD5695R/AD5696/AD5696R are a family of 4 channel DACs
with 12-bit, 14-bit and 16-bit precision respectively. The devices have
either no built-in reference, or built-in 2.5V reference.

The AD5671R/AD5675R are similar, except that they have 8 instead of 4
channels.

These devices are similar to AD5672R/AD5676/AD5676R and
AD5684/AD5684R/AD5684/AD5685R/AD5686/AD5686R, except that they use i2c
instead of spi.

Datasheets:
http://www.analog.com/media/en/technical-documentation/data-sheets/AD5671R_5675R.pdf
http://www.analog.com/media/en/technical-documentation/data-sheets/AD5696R_5695R_5694R.pdf

Signed-off-by: Stefan Popa 
---
Changes in v2:
- Refactored the patch

 MAINTAINERS  |  1 +
 drivers/iio/dac/Kconfig  | 10 +
 drivers/iio/dac/Makefile |  1 +
 drivers/iio/dac/ad5686.c | 28 +
 drivers/iio/dac/ad5686.h |  7 
 drivers/iio/dac/ad5696-i2c.c | 98 
 6 files changed, 145 insertions(+)
 create mode 100644 drivers/iio/dac/ad5696-i2c.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 637e62d..002cb01 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -797,6 +797,7 @@ L:  linux...@vger.kernel.org
 W: http://ez.analog.com/community/linux-device-drivers
 S: Supported
 F: drivers/iio/dac/ad5686*
+F: drivers/iio/dac/ad5696*
 
 ANALOG DEVICES INC AD9389B DRIVER
 M: Hans Verkuil 
diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig
index a00fc45..dab0b8a 100644
--- a/drivers/iio/dac/Kconfig
+++ b/drivers/iio/dac/Kconfig
@@ -145,6 +145,16 @@ config AD5686_SPI
To compile this driver as a module, choose M here: the
module will be called ad5686.
 
+config AD5696_I2C
+   tristate "Analog Devices AD5696 and similar multi-channel DACs (I2C)"
+   depends on I2C
+   select AD5686
+   help
+   Say yes here to build support for Analog Devices AD5671R, AD5675R,
+   AD5694, AD5694R, AD5695R, AD5696, AD5696R Voltage Output Digital to
+   Analog Converter.
+   To compile this driver as a module, choose M here: the module will be
+   called ad5696.
 
 config AD5755
tristate "Analog Devices AD5755/AD5755-1/AD5757/AD5735/AD5737 DAC 
driver"
diff --git a/drivers/iio/dac/Makefile b/drivers/iio/dac/Makefile
index 07db92e..4397e21 100644
--- a/drivers/iio/dac/Makefile
+++ b/drivers/iio/dac/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_AD5764) += ad5764.o
 obj-$(CONFIG_AD5791) += ad5791.o
 obj-$(CONFIG_AD5686) += ad5686.o
 obj-$(CONFIG_AD5686_SPI) += ad5686-spi.o
+obj-$(CONFIG_AD5696_I2C) += ad5696-i2c.o
 obj-$(CONFIG_AD7303) += ad7303.o
 obj-$(CONFIG_AD8801) += ad8801.o
 obj-$(CONFIG_CIO_DAC) += cio-dac.o
diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
index 95de8b8..596e1c9 100644
--- a/drivers/iio/dac/ad5686.c
+++ b/drivers/iio/dac/ad5686.c
@@ -203,11 +203,21 @@ DECLARE_AD5686_CHANNELS(ad5685r_channels, 14, 2);
 DECLARE_AD5686_CHANNELS(ad5686_channels, 16, 0);
 
 static const struct ad5686_chip_info ad5686_chip_info_tbl[] = {
+   [ID_AD5671R] = {
+   .channels = ad5672_channels,
+   .int_vref_mv = 2500,
+   .num_channels = 8,
+   },
[ID_AD5672R] = {
.channels = ad5672_channels,
.int_vref_mv = 2500,
.num_channels = 8,
},
+   [ID_AD5675R] = {
+   .channels = ad5676_channels,
+   .int_vref_mv = 2500,
+   .num_channels = 8,
+   },
[ID_AD5676] = {
.channels = ad5676_channels,
.num_channels = 8,
@@ -240,6 +250,24 @@ static const struct ad5686_chip_info 
ad5686_chip_info_tbl[] = {
.int_vref_mv = 2500,
.num_channels = 4,
},
+   [ID_AD5694] = {
+   .channels = ad5684_channels,
+   .num_channels = 4,
+   },
+   [ID_AD5694R] = {
+   .channels = ad5684_channels,
+   .int_vref_mv = 2500,
+   .num_channels = 4,
+   },
+   [ID_AD5696] = {
+   .channels = ad5686_channels,
+   .num_channels = 4,
+   },
+   [ID_AD5696R] = {
+   .channels = ad5686_channels,
+   .int_vref_mv = 2500,
+   .num_channels = 4,
+   },
 };
 
 int ad5686_probe(struct device *dev,
diff --git a/drivers/iio/dac/ad5686.h b/drivers/iio/dac/ad5686.h
index e6423af..b2b0110 100644
--- a/drivers/iio/dac/ad5686.h
+++ b/drivers/iio/dac/ad5686.h
@@ -32,7 +32,9 @@
  * ad5686_supported_device_ids:
  */
 enum ad5686_supported_device_ids {
+   ID_AD5671R,
ID_AD5672R,
+   ID_AD5675R,
ID_AD5676,
ID_AD5676R,
ID_AD5684,
@@ -40,6 +42,11 @@ enum ad5686_supported_device_ids {
ID_AD5685R,
ID_AD5686,
ID_AD5686R,
+   ID_AD5694,
+   ID_AD5694R,
+   ID_AD5695R,
+   ID_AD5696,
+   ID_AD5696R,
 

[PATCH v2 6/6] iio:dac:ad5686: Add AD5671R/75R/94/94R/95R/96/96R support

2018-04-10 Thread Stefan Popa
The AD5694/AD5694R/AD5695R/AD5696/AD5696R are a family of 4 channel DACs
with 12-bit, 14-bit and 16-bit precision respectively. The devices have
either no built-in reference, or built-in 2.5V reference.

The AD5671R/AD5675R are similar, except that they have 8 instead of 4
channels.

These devices are similar to AD5672R/AD5676/AD5676R and
AD5684/AD5684R/AD5684/AD5685R/AD5686/AD5686R, except that they use i2c
instead of spi.

Datasheets:
http://www.analog.com/media/en/technical-documentation/data-sheets/AD5671R_5675R.pdf
http://www.analog.com/media/en/technical-documentation/data-sheets/AD5696R_5695R_5694R.pdf

Signed-off-by: Stefan Popa 
---
Changes in v2:
- Refactored the patch

 MAINTAINERS  |  1 +
 drivers/iio/dac/Kconfig  | 10 +
 drivers/iio/dac/Makefile |  1 +
 drivers/iio/dac/ad5686.c | 28 +
 drivers/iio/dac/ad5686.h |  7 
 drivers/iio/dac/ad5696-i2c.c | 98 
 6 files changed, 145 insertions(+)
 create mode 100644 drivers/iio/dac/ad5696-i2c.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 637e62d..002cb01 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -797,6 +797,7 @@ L:  linux...@vger.kernel.org
 W: http://ez.analog.com/community/linux-device-drivers
 S: Supported
 F: drivers/iio/dac/ad5686*
+F: drivers/iio/dac/ad5696*
 
 ANALOG DEVICES INC AD9389B DRIVER
 M: Hans Verkuil 
diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig
index a00fc45..dab0b8a 100644
--- a/drivers/iio/dac/Kconfig
+++ b/drivers/iio/dac/Kconfig
@@ -145,6 +145,16 @@ config AD5686_SPI
To compile this driver as a module, choose M here: the
module will be called ad5686.
 
+config AD5696_I2C
+   tristate "Analog Devices AD5696 and similar multi-channel DACs (I2C)"
+   depends on I2C
+   select AD5686
+   help
+   Say yes here to build support for Analog Devices AD5671R, AD5675R,
+   AD5694, AD5694R, AD5695R, AD5696, AD5696R Voltage Output Digital to
+   Analog Converter.
+   To compile this driver as a module, choose M here: the module will be
+   called ad5696.
 
 config AD5755
tristate "Analog Devices AD5755/AD5755-1/AD5757/AD5735/AD5737 DAC 
driver"
diff --git a/drivers/iio/dac/Makefile b/drivers/iio/dac/Makefile
index 07db92e..4397e21 100644
--- a/drivers/iio/dac/Makefile
+++ b/drivers/iio/dac/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_AD5764) += ad5764.o
 obj-$(CONFIG_AD5791) += ad5791.o
 obj-$(CONFIG_AD5686) += ad5686.o
 obj-$(CONFIG_AD5686_SPI) += ad5686-spi.o
+obj-$(CONFIG_AD5696_I2C) += ad5696-i2c.o
 obj-$(CONFIG_AD7303) += ad7303.o
 obj-$(CONFIG_AD8801) += ad8801.o
 obj-$(CONFIG_CIO_DAC) += cio-dac.o
diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
index 95de8b8..596e1c9 100644
--- a/drivers/iio/dac/ad5686.c
+++ b/drivers/iio/dac/ad5686.c
@@ -203,11 +203,21 @@ DECLARE_AD5686_CHANNELS(ad5685r_channels, 14, 2);
 DECLARE_AD5686_CHANNELS(ad5686_channels, 16, 0);
 
 static const struct ad5686_chip_info ad5686_chip_info_tbl[] = {
+   [ID_AD5671R] = {
+   .channels = ad5672_channels,
+   .int_vref_mv = 2500,
+   .num_channels = 8,
+   },
[ID_AD5672R] = {
.channels = ad5672_channels,
.int_vref_mv = 2500,
.num_channels = 8,
},
+   [ID_AD5675R] = {
+   .channels = ad5676_channels,
+   .int_vref_mv = 2500,
+   .num_channels = 8,
+   },
[ID_AD5676] = {
.channels = ad5676_channels,
.num_channels = 8,
@@ -240,6 +250,24 @@ static const struct ad5686_chip_info 
ad5686_chip_info_tbl[] = {
.int_vref_mv = 2500,
.num_channels = 4,
},
+   [ID_AD5694] = {
+   .channels = ad5684_channels,
+   .num_channels = 4,
+   },
+   [ID_AD5694R] = {
+   .channels = ad5684_channels,
+   .int_vref_mv = 2500,
+   .num_channels = 4,
+   },
+   [ID_AD5696] = {
+   .channels = ad5686_channels,
+   .num_channels = 4,
+   },
+   [ID_AD5696R] = {
+   .channels = ad5686_channels,
+   .int_vref_mv = 2500,
+   .num_channels = 4,
+   },
 };
 
 int ad5686_probe(struct device *dev,
diff --git a/drivers/iio/dac/ad5686.h b/drivers/iio/dac/ad5686.h
index e6423af..b2b0110 100644
--- a/drivers/iio/dac/ad5686.h
+++ b/drivers/iio/dac/ad5686.h
@@ -32,7 +32,9 @@
  * ad5686_supported_device_ids:
  */
 enum ad5686_supported_device_ids {
+   ID_AD5671R,
ID_AD5672R,
+   ID_AD5675R,
ID_AD5676,
ID_AD5676R,
ID_AD5684,
@@ -40,6 +42,11 @@ enum ad5686_supported_device_ids {
ID_AD5685R,
ID_AD5686,
ID_AD5686R,
+   ID_AD5694,
+   ID_AD5694R,
+   ID_AD5695R,
+   ID_AD5696,
+   ID_AD5696R,
 };
 
 struct ad5686_state;
diff --git