linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio:ad5064: Add support for ltc2633 and similar devices
@ 2017-04-26  9:44 Mike Looijmans
  2017-04-27  5:52 ` Jonathan Cameron
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Looijmans @ 2017-04-26  9:44 UTC (permalink / raw)
  To: linux-iio
  Cc: linux-kernel, lars, Michael.Hennerich, jic23, knaack.h, pmeerw,
	Mike Looijmans

The Linear Technology LTC2631, LTC2633 and LTC2635 are very similar
to the AD5064 device, in particular the LTC2627.

This patch adds support for those devices. Only the LTC2633 has been
tested, which is the 2-channel variant. The LTC2631 is the 1-channel,
and the LTC2635 the 4-channel version. The actual DAC resolution depends
on the exact chip type and can be 12, 10 or 8 bits, using the upper bits
so this has no effect on the register map. The internal reference is set
to 2.5V on "L" versions, and it's 4.096V for "H" versions.

Datasheets:
    LTC2631: http://www.linear.com/docs/26553
    LTC2633: http://www.linear.com/docs/39529
    LTC2635: http://www.linear.com/docs/28754

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
---
 drivers/iio/dac/Kconfig  |  3 ++-
 drivers/iio/dac/ad5064.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 58 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig
index d3084028..31ffb67 100644
--- a/drivers/iio/dac/Kconfig
+++ b/drivers/iio/dac/Kconfig
@@ -13,7 +13,8 @@ config AD5064
 	  AD5045, AD5064, AD5064-1, AD5065, AD5625, AD5625R, AD5627, AD5627R,
 	  AD5628, AD5629R, AD5645R, AD5647R, AD5648, AD5665, AD5665R, AD5666,
 	  AD5667, AD5667R, AD5668, AD5669R, LTC2606, LTC2607, LTC2609, LTC2616,
-	  LTC2617, LTC2619, LTC2626, LTC2627, LTC2629 Digital to Analog Converter.
+	  LTC2617, LTC2619, LTC2626, LTC2627, LTC2629, LTC2631, LTC2633, LTC2635
+	  Digital to Analog Converter.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called ad5064.
diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
index 6803e4a..b440180 100644
--- a/drivers/iio/dac/ad5064.c
+++ b/drivers/iio/dac/ad5064.c
@@ -2,8 +2,8 @@
  * AD5024, AD5025, AD5044, AD5045, AD5064, AD5064-1, AD5065, AD5625, AD5625R,
  * AD5627, AD5627R, AD5628, AD5629R, AD5645R, AD5647R, AD5648, AD5665, AD5665R,
  * AD5666, AD5667, AD5667R, AD5668, AD5669R, LTC2606, LTC2607, LTC2609, LTC2616,
- * LTC2617, LTC2619, LTC2626, LTC2627, LTC2629 Digital to analog converters
- * driver
+ * LTC2617, LTC2619, LTC2626, LTC2627, LTC2629, LTC2631, LTC2633, LTC2635
+ * Digital to analog converters driver
  *
  * Copyright 2011 Analog Devices Inc.
  *
@@ -168,6 +168,12 @@ enum ad5064_type {
 	ID_LTC2626,
 	ID_LTC2627,
 	ID_LTC2629,
+	ID_LTC2631_L,
+	ID_LTC2631_H,
+	ID_LTC2633_L,
+	ID_LTC2633_H,
+	ID_LTC2635_L,
+	ID_LTC2635_H,
 };
 
 static int ad5064_write(struct ad5064_state *st, unsigned int cmd,
@@ -724,6 +730,48 @@ static int ad5064_write_raw(struct iio_dev *indio_dev,
 		.num_channels = 4,
 		.regmap_type = AD5064_REGMAP_LTC,
 	},
+	[ID_LTC2631_L] = {
+		.shared_vref = true,
+		.internal_vref = 2500000,
+		.channels = ltc2627_channels,
+		.num_channels = 1,
+		.regmap_type = AD5064_REGMAP_LTC,
+	},
+	[ID_LTC2631_H] = {
+		.shared_vref = true,
+		.internal_vref = 4096000,
+		.channels = ltc2627_channels,
+		.num_channels = 1,
+		.regmap_type = AD5064_REGMAP_LTC,
+	},
+	[ID_LTC2633_L] = {
+		.shared_vref = true,
+		.internal_vref = 2500000,
+		.channels = ltc2627_channels,
+		.num_channels = 2,
+		.regmap_type = AD5064_REGMAP_LTC,
+	},
+	[ID_LTC2633_H] = {
+		.shared_vref = true,
+		.internal_vref = 4096000,
+		.channels = ltc2627_channels,
+		.num_channels = 2,
+		.regmap_type = AD5064_REGMAP_LTC,
+	},
+	[ID_LTC2635_L] = {
+		.shared_vref = true,
+		.internal_vref = 2500000,
+		.channels = ltc2627_channels,
+		.num_channels = 4,
+		.regmap_type = AD5064_REGMAP_LTC,
+	},
+	[ID_LTC2635_H] = {
+		.shared_vref = true,
+		.internal_vref = 4096000,
+		.channels = ltc2627_channels,
+		.num_channels = 4,
+		.regmap_type = AD5064_REGMAP_LTC,
+	},
 };
 
 static inline unsigned int ad5064_num_vref(struct ad5064_state *st)
@@ -982,6 +1030,12 @@ static int ad5064_i2c_remove(struct i2c_client *i2c)
 	{"ltc2626", ID_LTC2626},
 	{"ltc2627", ID_LTC2627},
 	{"ltc2629", ID_LTC2629},
+	{"ltc2631-l", ID_LTC2631_L},
+	{"ltc2631-h", ID_LTC2631_H},
+	{"ltc2633-l", ID_LTC2633_L},
+	{"ltc2633-h", ID_LTC2633_H},
+	{"ltc2635-l", ID_LTC2635_L},
+	{"ltc2635-h", ID_LTC2635_H},
 	{}
 };
 MODULE_DEVICE_TABLE(i2c, ad5064_i2c_ids);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] iio:ad5064: Add support for ltc2633 and similar devices
  2017-04-26  9:44 [PATCH] iio:ad5064: Add support for ltc2633 and similar devices Mike Looijmans
@ 2017-04-27  5:52 ` Jonathan Cameron
  2017-04-27  9:16   ` Lars-Peter Clausen
  0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Cameron @ 2017-04-27  5:52 UTC (permalink / raw)
  To: Mike Looijmans, linux-iio
  Cc: linux-kernel, lars, Michael.Hennerich, knaack.h, pmeerw

On 26/04/17 10:44, Mike Looijmans wrote:
> The Linear Technology LTC2631, LTC2633 and LTC2635 are very similar
> to the AD5064 device, in particular the LTC2627.
> 
> This patch adds support for those devices. Only the LTC2633 has been
> tested, which is the 2-channel variant. The LTC2631 is the 1-channel,
> and the LTC2635 the 4-channel version. The actual DAC resolution depends
> on the exact chip type and can be 12, 10 or 8 bits, using the upper bits
> so this has no effect on the register map. The internal reference is set
> to 2.5V on "L" versions, and it's 4.096V for "H" versions.
> 
> Datasheets:
>     LTC2631: http://www.linear.com/docs/26553
>     LTC2633: http://www.linear.com/docs/39529
>     LTC2635: http://www.linear.com/docs/28754
> 
> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Looks fine to me, but I'd like to give time for Lars to take a look
as it is his driver.

Jonathan
> ---
>  drivers/iio/dac/Kconfig  |  3 ++-
>  drivers/iio/dac/ad5064.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++--
>  2 files changed, 58 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig
> index d3084028..31ffb67 100644
> --- a/drivers/iio/dac/Kconfig
> +++ b/drivers/iio/dac/Kconfig
> @@ -13,7 +13,8 @@ config AD5064
>  	  AD5045, AD5064, AD5064-1, AD5065, AD5625, AD5625R, AD5627, AD5627R,
>  	  AD5628, AD5629R, AD5645R, AD5647R, AD5648, AD5665, AD5665R, AD5666,
>  	  AD5667, AD5667R, AD5668, AD5669R, LTC2606, LTC2607, LTC2609, LTC2616,
> -	  LTC2617, LTC2619, LTC2626, LTC2627, LTC2629 Digital to Analog Converter.
> +	  LTC2617, LTC2619, LTC2626, LTC2627, LTC2629, LTC2631, LTC2633, LTC2635
> +	  Digital to Analog Converter.
>  
>  	  To compile this driver as a module, choose M here: the
>  	  module will be called ad5064.
> diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
> index 6803e4a..b440180 100644
> --- a/drivers/iio/dac/ad5064.c
> +++ b/drivers/iio/dac/ad5064.c
> @@ -2,8 +2,8 @@
>   * AD5024, AD5025, AD5044, AD5045, AD5064, AD5064-1, AD5065, AD5625, AD5625R,
>   * AD5627, AD5627R, AD5628, AD5629R, AD5645R, AD5647R, AD5648, AD5665, AD5665R,
>   * AD5666, AD5667, AD5667R, AD5668, AD5669R, LTC2606, LTC2607, LTC2609, LTC2616,
> - * LTC2617, LTC2619, LTC2626, LTC2627, LTC2629 Digital to analog converters
> - * driver
> + * LTC2617, LTC2619, LTC2626, LTC2627, LTC2629, LTC2631, LTC2633, LTC2635
> + * Digital to analog converters driver
>   *
>   * Copyright 2011 Analog Devices Inc.
>   *
> @@ -168,6 +168,12 @@ enum ad5064_type {
>  	ID_LTC2626,
>  	ID_LTC2627,
>  	ID_LTC2629,
> +	ID_LTC2631_L,
> +	ID_LTC2631_H,
> +	ID_LTC2633_L,
> +	ID_LTC2633_H,
> +	ID_LTC2635_L,
> +	ID_LTC2635_H,
>  };
>  
>  static int ad5064_write(struct ad5064_state *st, unsigned int cmd,
> @@ -724,6 +730,48 @@ static int ad5064_write_raw(struct iio_dev *indio_dev,
>  		.num_channels = 4,
>  		.regmap_type = AD5064_REGMAP_LTC,
>  	},
> +	[ID_LTC2631_L] = {
> +		.shared_vref = true,
> +		.internal_vref = 2500000,
> +		.channels = ltc2627_channels,
> +		.num_channels = 1,
> +		.regmap_type = AD5064_REGMAP_LTC,
> +	},
> +	[ID_LTC2631_H] = {
> +		.shared_vref = true,
> +		.internal_vref = 4096000,
> +		.channels = ltc2627_channels,
> +		.num_channels = 1,
> +		.regmap_type = AD5064_REGMAP_LTC,
> +	},
> +	[ID_LTC2633_L] = {
> +		.shared_vref = true,
> +		.internal_vref = 2500000,
> +		.channels = ltc2627_channels,
> +		.num_channels = 2,
> +		.regmap_type = AD5064_REGMAP_LTC,
> +	},
> +	[ID_LTC2633_H] = {
> +		.shared_vref = true,
> +		.internal_vref = 4096000,
> +		.channels = ltc2627_channels,
> +		.num_channels = 2,
> +		.regmap_type = AD5064_REGMAP_LTC,
> +	},
> +	[ID_LTC2635_L] = {
> +		.shared_vref = true,
> +		.internal_vref = 2500000,
> +		.channels = ltc2627_channels,
> +		.num_channels = 4,
> +		.regmap_type = AD5064_REGMAP_LTC,
> +	},
> +	[ID_LTC2635_H] = {
> +		.shared_vref = true,
> +		.internal_vref = 4096000,
> +		.channels = ltc2627_channels,
> +		.num_channels = 4,
> +		.regmap_type = AD5064_REGMAP_LTC,
> +	},
>  };
>  
>  static inline unsigned int ad5064_num_vref(struct ad5064_state *st)
> @@ -982,6 +1030,12 @@ static int ad5064_i2c_remove(struct i2c_client *i2c)
>  	{"ltc2626", ID_LTC2626},
>  	{"ltc2627", ID_LTC2627},
>  	{"ltc2629", ID_LTC2629},
> +	{"ltc2631-l", ID_LTC2631_L},
> +	{"ltc2631-h", ID_LTC2631_H},
> +	{"ltc2633-l", ID_LTC2633_L},
> +	{"ltc2633-h", ID_LTC2633_H},
> +	{"ltc2635-l", ID_LTC2635_L},
> +	{"ltc2635-h", ID_LTC2635_H},
>  	{}
>  };
>  MODULE_DEVICE_TABLE(i2c, ad5064_i2c_ids);
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] iio:ad5064: Add support for ltc2633 and similar devices
  2017-04-27  5:52 ` Jonathan Cameron
@ 2017-04-27  9:16   ` Lars-Peter Clausen
  2017-04-27 17:09     ` Mike Looijmans
  2017-05-08  7:26     ` [PATCH v2] " Mike Looijmans
  0 siblings, 2 replies; 7+ messages in thread
From: Lars-Peter Clausen @ 2017-04-27  9:16 UTC (permalink / raw)
  To: Jonathan Cameron, Mike Looijmans, linux-iio
  Cc: linux-kernel, Michael.Hennerich, knaack.h, pmeerw

On 04/27/2017 07:52 AM, Jonathan Cameron wrote:
> On 26/04/17 10:44, Mike Looijmans wrote:
>> The Linear Technology LTC2631, LTC2633 and LTC2635 are very similar
>> to the AD5064 device, in particular the LTC2627.
>>
>> This patch adds support for those devices. Only the LTC2633 has been
>> tested, which is the 2-channel variant. The LTC2631 is the 1-channel,
>> and the LTC2635 the 4-channel version. The actual DAC resolution depends
>> on the exact chip type and can be 12, 10 or 8 bits, using the upper bits
>> so this has no effect on the register map. The internal reference is set
>> to 2.5V on "L" versions, and it's 4.096V for "H" versions.
>>
>> Datasheets:
>>     LTC2631: http://www.linear.com/docs/26553
>>     LTC2633: http://www.linear.com/docs/39529
>>     LTC2635: http://www.linear.com/docs/28754
>>
>> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>

Ah, its always good if somebody manages to clear an item from your TODO list
before you :)

> Looks fine to me, but I'd like to give time for Lars to take a look
> as it is his driver.

Patch looks good, but I'd prefer it if we had different entries in the
device table for different resolutions. So you don't have to manually shift
the output value by 12 when you are using the 8-bit version. This is how it
has been done for other DAC drivers and it would be good to stay consistent.

Maybe even include the reset-to-midscale/reset-to-gnd designator of the part
number in the compatible string.

http://cds.linear.com/docs/en/datasheet/2631fc.pdf#page=3


> Jonathan
>> ---
>>  drivers/iio/dac/Kconfig  |  3 ++-
>>  drivers/iio/dac/ad5064.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++--
>>  2 files changed, 58 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig
>> index d3084028..31ffb67 100644
>> --- a/drivers/iio/dac/Kconfig
>> +++ b/drivers/iio/dac/Kconfig
>> @@ -13,7 +13,8 @@ config AD5064
>>  	  AD5045, AD5064, AD5064-1, AD5065, AD5625, AD5625R, AD5627, AD5627R,
>>  	  AD5628, AD5629R, AD5645R, AD5647R, AD5648, AD5665, AD5665R, AD5666,
>>  	  AD5667, AD5667R, AD5668, AD5669R, LTC2606, LTC2607, LTC2609, LTC2616,
>> -	  LTC2617, LTC2619, LTC2626, LTC2627, LTC2629 Digital to Analog Converter.
>> +	  LTC2617, LTC2619, LTC2626, LTC2627, LTC2629, LTC2631, LTC2633, LTC2635
>> +	  Digital to Analog Converter.
>>  
>>  	  To compile this driver as a module, choose M here: the
>>  	  module will be called ad5064.
>> diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
>> index 6803e4a..b440180 100644
>> --- a/drivers/iio/dac/ad5064.c
>> +++ b/drivers/iio/dac/ad5064.c
>> @@ -2,8 +2,8 @@
>>   * AD5024, AD5025, AD5044, AD5045, AD5064, AD5064-1, AD5065, AD5625, AD5625R,
>>   * AD5627, AD5627R, AD5628, AD5629R, AD5645R, AD5647R, AD5648, AD5665, AD5665R,
>>   * AD5666, AD5667, AD5667R, AD5668, AD5669R, LTC2606, LTC2607, LTC2609, LTC2616,
>> - * LTC2617, LTC2619, LTC2626, LTC2627, LTC2629 Digital to analog converters
>> - * driver
>> + * LTC2617, LTC2619, LTC2626, LTC2627, LTC2629, LTC2631, LTC2633, LTC2635
>> + * Digital to analog converters driver
>>   *
>>   * Copyright 2011 Analog Devices Inc.
>>   *
>> @@ -168,6 +168,12 @@ enum ad5064_type {
>>  	ID_LTC2626,
>>  	ID_LTC2627,
>>  	ID_LTC2629,
>> +	ID_LTC2631_L,
>> +	ID_LTC2631_H,
>> +	ID_LTC2633_L,
>> +	ID_LTC2633_H,
>> +	ID_LTC2635_L,
>> +	ID_LTC2635_H,
>>  };
>>  
>>  static int ad5064_write(struct ad5064_state *st, unsigned int cmd,
>> @@ -724,6 +730,48 @@ static int ad5064_write_raw(struct iio_dev *indio_dev,
>>  		.num_channels = 4,
>>  		.regmap_type = AD5064_REGMAP_LTC,
>>  	},
>> +	[ID_LTC2631_L] = {
>> +		.shared_vref = true,
>> +		.internal_vref = 2500000,
>> +		.channels = ltc2627_channels,
>> +		.num_channels = 1,
>> +		.regmap_type = AD5064_REGMAP_LTC,
>> +	},
>> +	[ID_LTC2631_H] = {
>> +		.shared_vref = true,
>> +		.internal_vref = 4096000,
>> +		.channels = ltc2627_channels,
>> +		.num_channels = 1,
>> +		.regmap_type = AD5064_REGMAP_LTC,
>> +	},
>> +	[ID_LTC2633_L] = {
>> +		.shared_vref = true,
>> +		.internal_vref = 2500000,
>> +		.channels = ltc2627_channels,
>> +		.num_channels = 2,
>> +		.regmap_type = AD5064_REGMAP_LTC,
>> +	},
>> +	[ID_LTC2633_H] = {
>> +		.shared_vref = true,
>> +		.internal_vref = 4096000,
>> +		.channels = ltc2627_channels,
>> +		.num_channels = 2,
>> +		.regmap_type = AD5064_REGMAP_LTC,
>> +	},
>> +	[ID_LTC2635_L] = {
>> +		.shared_vref = true,
>> +		.internal_vref = 2500000,
>> +		.channels = ltc2627_channels,
>> +		.num_channels = 4,
>> +		.regmap_type = AD5064_REGMAP_LTC,
>> +	},
>> +	[ID_LTC2635_H] = {
>> +		.shared_vref = true,
>> +		.internal_vref = 4096000,
>> +		.channels = ltc2627_channels,
>> +		.num_channels = 4,
>> +		.regmap_type = AD5064_REGMAP_LTC,
>> +	},
>>  };
>>  
>>  static inline unsigned int ad5064_num_vref(struct ad5064_state *st)
>> @@ -982,6 +1030,12 @@ static int ad5064_i2c_remove(struct i2c_client *i2c)
>>  	{"ltc2626", ID_LTC2626},
>>  	{"ltc2627", ID_LTC2627},
>>  	{"ltc2629", ID_LTC2629},
>> +	{"ltc2631-l", ID_LTC2631_L},
>> +	{"ltc2631-h", ID_LTC2631_H},
>> +	{"ltc2633-l", ID_LTC2633_L},
>> +	{"ltc2633-h", ID_LTC2633_H},
>> +	{"ltc2635-l", ID_LTC2635_L},
>> +	{"ltc2635-h", ID_LTC2635_H},
>>  	{}
>>  };
>>  MODULE_DEVICE_TABLE(i2c, ad5064_i2c_ids);
>>
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] iio:ad5064: Add support for ltc2633 and similar devices
  2017-04-27  9:16   ` Lars-Peter Clausen
@ 2017-04-27 17:09     ` Mike Looijmans
  2017-05-08  7:26     ` [PATCH v2] " Mike Looijmans
  1 sibling, 0 replies; 7+ messages in thread
From: Mike Looijmans @ 2017-04-27 17:09 UTC (permalink / raw)
  To: Lars-Peter Clausen, Jonathan Cameron, linux-iio
  Cc: linux-kernel, Michael.Hennerich, knaack.h, pmeerw

On 27-04-17 11:16, Lars-Peter Clausen wrote:
> On 04/27/2017 07:52 AM, Jonathan Cameron wrote:
>> On 26/04/17 10:44, Mike Looijmans wrote:
>>> The Linear Technology LTC2631, LTC2633 and LTC2635 are very similar
>>> to the AD5064 device, in particular the LTC2627.
>>>
>>> This patch adds support for those devices. Only the LTC2633 has been
>>> tested, which is the 2-channel variant. The LTC2631 is the 1-channel,
>>> and the LTC2635 the 4-channel version. The actual DAC resolution depends
>>> on the exact chip type and can be 12, 10 or 8 bits, using the upper bits
>>> so this has no effect on the register map. The internal reference is set
>>> to 2.5V on "L" versions, and it's 4.096V for "H" versions.
>>>
>>> Datasheets:
>>>     LTC2631: http://www.linear.com/docs/26553
>>>     LTC2633: http://www.linear.com/docs/39529
>>>     LTC2635: http://www.linear.com/docs/28754
>>>
>>> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
>
> Ah, its always good if somebody manages to clear an item from your TODO list
> before you :)

Glad to be able to reverse the roles this time :)

>> Looks fine to me, but I'd like to give time for Lars to take a look
>> as it is his driver.
>
> Patch looks good, but I'd prefer it if we had different entries in the
> device table for different resolutions. So you don't have to manually shift
> the output value by 12 when you are using the 8-bit version. This is how it
> has been done for other DAC drivers and it would be good to stay consistent.

Doing so would add 18 entries (3 channels, 2 ranges, 3 resolutions) 
instead of a mere 6. That's why I refrained from it.

>
> Maybe even include the reset-to-midscale/reset-to-gnd designator of the part
> number in the compatible string.
>
> http://cds.linear.com/docs/en/datasheet/2631fc.pdf#page=3

And that would make the number of entries to add 36. I think if we go 
that path, we should make things parameterizable, e.g. have channel 
count, bit resolution, reset state and range as devicetree parameters, 
so that the "compatible" string needn't hold all information. It would 
impact existing trees though.


>> Jonathan
>>> ---
>>>  drivers/iio/dac/Kconfig  |  3 ++-
>>>  drivers/iio/dac/ad5064.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++--
>>>  2 files changed, 58 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig
>>> index d3084028..31ffb67 100644
>>> --- a/drivers/iio/dac/Kconfig
>>> +++ b/drivers/iio/dac/Kconfig
>>> @@ -13,7 +13,8 @@ config AD5064
>>>  	  AD5045, AD5064, AD5064-1, AD5065, AD5625, AD5625R, AD5627, AD5627R,
>>>  	  AD5628, AD5629R, AD5645R, AD5647R, AD5648, AD5665, AD5665R, AD5666,
>>>  	  AD5667, AD5667R, AD5668, AD5669R, LTC2606, LTC2607, LTC2609, LTC2616,
>>> -	  LTC2617, LTC2619, LTC2626, LTC2627, LTC2629 Digital to Analog Converter.
>>> +	  LTC2617, LTC2619, LTC2626, LTC2627, LTC2629, LTC2631, LTC2633, LTC2635
>>> +	  Digital to Analog Converter.
>>>
>>>  	  To compile this driver as a module, choose M here: the
>>>  	  module will be called ad5064.
>>> diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
>>> index 6803e4a..b440180 100644
>>> --- a/drivers/iio/dac/ad5064.c
>>> +++ b/drivers/iio/dac/ad5064.c
>>> @@ -2,8 +2,8 @@
>>>   * AD5024, AD5025, AD5044, AD5045, AD5064, AD5064-1, AD5065, AD5625, AD5625R,
>>>   * AD5627, AD5627R, AD5628, AD5629R, AD5645R, AD5647R, AD5648, AD5665, AD5665R,
>>>   * AD5666, AD5667, AD5667R, AD5668, AD5669R, LTC2606, LTC2607, LTC2609, LTC2616,
>>> - * LTC2617, LTC2619, LTC2626, LTC2627, LTC2629 Digital to analog converters
>>> - * driver
>>> + * LTC2617, LTC2619, LTC2626, LTC2627, LTC2629, LTC2631, LTC2633, LTC2635
>>> + * Digital to analog converters driver
>>>   *
>>>   * Copyright 2011 Analog Devices Inc.
>>>   *
>>> @@ -168,6 +168,12 @@ enum ad5064_type {
>>>  	ID_LTC2626,
>>>  	ID_LTC2627,
>>>  	ID_LTC2629,
>>> +	ID_LTC2631_L,
>>> +	ID_LTC2631_H,
>>> +	ID_LTC2633_L,
>>> +	ID_LTC2633_H,
>>> +	ID_LTC2635_L,
>>> +	ID_LTC2635_H,
>>>  };
>>>
>>>  static int ad5064_write(struct ad5064_state *st, unsigned int cmd,
>>> @@ -724,6 +730,48 @@ static int ad5064_write_raw(struct iio_dev *indio_dev,
>>>  		.num_channels = 4,
>>>  		.regmap_type = AD5064_REGMAP_LTC,
>>>  	},
>>> +	[ID_LTC2631_L] = {
>>> +		.shared_vref = true,
>>> +		.internal_vref = 2500000,
>>> +		.channels = ltc2627_channels,
>>> +		.num_channels = 1,
>>> +		.regmap_type = AD5064_REGMAP_LTC,
>>> +	},
>>> +	[ID_LTC2631_H] = {
>>> +		.shared_vref = true,
>>> +		.internal_vref = 4096000,
>>> +		.channels = ltc2627_channels,
>>> +		.num_channels = 1,
>>> +		.regmap_type = AD5064_REGMAP_LTC,
>>> +	},
>>> +	[ID_LTC2633_L] = {
>>> +		.shared_vref = true,
>>> +		.internal_vref = 2500000,
>>> +		.channels = ltc2627_channels,
>>> +		.num_channels = 2,
>>> +		.regmap_type = AD5064_REGMAP_LTC,
>>> +	},
>>> +	[ID_LTC2633_H] = {
>>> +		.shared_vref = true,
>>> +		.internal_vref = 4096000,
>>> +		.channels = ltc2627_channels,
>>> +		.num_channels = 2,
>>> +		.regmap_type = AD5064_REGMAP_LTC,
>>> +	},
>>> +	[ID_LTC2635_L] = {
>>> +		.shared_vref = true,
>>> +		.internal_vref = 2500000,
>>> +		.channels = ltc2627_channels,
>>> +		.num_channels = 4,
>>> +		.regmap_type = AD5064_REGMAP_LTC,
>>> +	},
>>> +	[ID_LTC2635_H] = {
>>> +		.shared_vref = true,
>>> +		.internal_vref = 4096000,
>>> +		.channels = ltc2627_channels,
>>> +		.num_channels = 4,
>>> +		.regmap_type = AD5064_REGMAP_LTC,
>>> +	},
>>>  };
>>>
>>>  static inline unsigned int ad5064_num_vref(struct ad5064_state *st)
>>> @@ -982,6 +1030,12 @@ static int ad5064_i2c_remove(struct i2c_client *i2c)
>>>  	{"ltc2626", ID_LTC2626},
>>>  	{"ltc2627", ID_LTC2627},
>>>  	{"ltc2629", ID_LTC2629},
>>> +	{"ltc2631-l", ID_LTC2631_L},
>>> +	{"ltc2631-h", ID_LTC2631_H},
>>> +	{"ltc2633-l", ID_LTC2633_L},
>>> +	{"ltc2633-h", ID_LTC2633_H},
>>> +	{"ltc2635-l", ID_LTC2635_L},
>>> +	{"ltc2635-h", ID_LTC2635_H},
>>>  	{}
>>>  };
>>>  MODULE_DEVICE_TABLE(i2c, ad5064_i2c_ids);
>>>
>>
>


-- 
Mike Looijmans


Kind regards,

Mike Looijmans
System Expert

TOPIC Products
Materiaalweg 4, NL-5681 RJ Best
Postbus 440, NL-5680 AK Best
Telefoon: +31 (0) 499 33 69 79
E-mail: mike.looijmans@topicproducts.com
Website: www.topicproducts.com

Please consider the environment before printing this e-mail

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] iio:ad5064: Add support for ltc2633 and similar devices
  2017-04-27  9:16   ` Lars-Peter Clausen
  2017-04-27 17:09     ` Mike Looijmans
@ 2017-05-08  7:26     ` Mike Looijmans
  2017-05-10  9:12       ` Lars-Peter Clausen
  1 sibling, 1 reply; 7+ messages in thread
From: Mike Looijmans @ 2017-05-08  7:26 UTC (permalink / raw)
  To: linux-iio
  Cc: linux-kernel, lars, Michael.Hennerich, jic23, knaack.h, pmeerw,
	Mike Looijmans

The Linear Technology LTC2631, LTC2633 and LTC2635 are very similar
to the AD5064 device, in particular the LTC2627.

This patch adds support for those devices. Only the LTC2633 has been
tested, which is the 2-channel variant. The LTC2631 is the 1-channel,
and the LTC2635 the 4-channel version. The actual DAC resolution depends
on the exact chip type and can be 12, 10 or 8 bits, using the upper bits
so this has no effect on the register map. The internal reference is set
to 2.5V on "L" versions, and it's 4.096V for "H" versions.

Datasheets:
    LTC2631: http://www.linear.com/docs/26553
    LTC2633: http://www.linear.com/docs/39529
    LTC2635: http://www.linear.com/docs/28754

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
---
v2: Add separate definitions for 8, 10 and 12-bit versions

 drivers/iio/dac/Kconfig  |  3 +-
 drivers/iio/dac/ad5064.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 71 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig
index d3084028..31ffb67 100644
--- a/drivers/iio/dac/Kconfig
+++ b/drivers/iio/dac/Kconfig
@@ -13,7 +13,8 @@ config AD5064
 	  AD5045, AD5064, AD5064-1, AD5065, AD5625, AD5625R, AD5627, AD5627R,
 	  AD5628, AD5629R, AD5645R, AD5647R, AD5648, AD5665, AD5665R, AD5666,
 	  AD5667, AD5667R, AD5668, AD5669R, LTC2606, LTC2607, LTC2609, LTC2616,
-	  LTC2617, LTC2619, LTC2626, LTC2627, LTC2629 Digital to Analog Converter.
+	  LTC2617, LTC2619, LTC2626, LTC2627, LTC2629, LTC2631, LTC2633, LTC2635
+	  Digital to Analog Converter.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called ad5064.
diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
index 6803e4a..3f9399c 100644
--- a/drivers/iio/dac/ad5064.c
+++ b/drivers/iio/dac/ad5064.c
@@ -2,8 +2,8 @@
  * AD5024, AD5025, AD5044, AD5045, AD5064, AD5064-1, AD5065, AD5625, AD5625R,
  * AD5627, AD5627R, AD5628, AD5629R, AD5645R, AD5647R, AD5648, AD5665, AD5665R,
  * AD5666, AD5667, AD5667R, AD5668, AD5669R, LTC2606, LTC2607, LTC2609, LTC2616,
- * LTC2617, LTC2619, LTC2626, LTC2627, LTC2629 Digital to analog converters
- * driver
+ * LTC2617, LTC2619, LTC2626, LTC2627, LTC2629, LTC2631, LTC2633, LTC2635
+ * Digital to analog converters driver
  *
  * Copyright 2011 Analog Devices Inc.
  *
@@ -168,6 +168,24 @@ enum ad5064_type {
 	ID_LTC2626,
 	ID_LTC2627,
 	ID_LTC2629,
+	ID_LTC2631_L12,
+	ID_LTC2631_H12,
+	ID_LTC2631_L10,
+	ID_LTC2631_H10,
+	ID_LTC2631_L8,
+	ID_LTC2631_H8,
+	ID_LTC2633_L12,
+	ID_LTC2633_H12,
+	ID_LTC2633_L10,
+	ID_LTC2633_H10,
+	ID_LTC2633_L8,
+	ID_LTC2633_H8,
+	ID_LTC2635_L12,
+	ID_LTC2635_H12,
+	ID_LTC2635_L10,
+	ID_LTC2635_H10,
+	ID_LTC2635_L8,
+	ID_LTC2635_H8,
 };
 
 static int ad5064_write(struct ad5064_state *st, unsigned int cmd,
@@ -425,6 +443,19 @@ static int ad5064_write_raw(struct iio_dev *indio_dev,
 static DECLARE_AD5064_CHANNELS(ltc2607_channels, 16, 0, ltc2617_ext_info);
 static DECLARE_AD5064_CHANNELS(ltc2617_channels, 14, 2, ltc2617_ext_info);
 static DECLARE_AD5064_CHANNELS(ltc2627_channels, 12, 4, ltc2617_ext_info);
+#define ltc2631_12_channels ltc2627_channels
+static DECLARE_AD5064_CHANNELS(ltc2631_10_channels, 10, 6, ltc2617_ext_info);
+static DECLARE_AD5064_CHANNELS(ltc2631_8_channels, 8, 8, ltc2617_ext_info);
+
+#define LTC2631_INFO(vref, pchannels, nchannels)	\
+	{						\
+		.shared_vref = true,			\
+		.internal_vref = vref,			\
+		.channels = pchannels,			\
+		.num_channels = nchannels,		\
+		.regmap_type = AD5064_REGMAP_LTC,	\
+	}
+
 
 static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {
 	[ID_AD5024] = {
@@ -724,6 +755,24 @@ static int ad5064_write_raw(struct iio_dev *indio_dev,
 		.num_channels = 4,
 		.regmap_type = AD5064_REGMAP_LTC,
 	},
+	[ID_LTC2631_L12] = LTC2631_INFO(2500000, ltc2631_12_channels, 1),
+	[ID_LTC2631_H12] = LTC2631_INFO(4096000, ltc2631_12_channels, 1),
+	[ID_LTC2631_L10] = LTC2631_INFO(2500000, ltc2631_10_channels, 1),
+	[ID_LTC2631_H10] = LTC2631_INFO(4096000, ltc2631_10_channels, 1),
+	[ID_LTC2631_L8] = LTC2631_INFO(2500000, ltc2631_8_channels, 1),
+	[ID_LTC2631_H8] = LTC2631_INFO(4096000, ltc2631_8_channels, 1),
+	[ID_LTC2633_L12] = LTC2631_INFO(2500000, ltc2631_12_channels, 2),
+	[ID_LTC2633_H12] = LTC2631_INFO(4096000, ltc2631_12_channels, 2),
+	[ID_LTC2633_L10] = LTC2631_INFO(2500000, ltc2631_10_channels, 2),
+	[ID_LTC2633_H10] = LTC2631_INFO(4096000, ltc2631_10_channels, 2),
+	[ID_LTC2633_L8] = LTC2631_INFO(2500000, ltc2631_8_channels, 2),
+	[ID_LTC2633_H8] = LTC2631_INFO(4096000, ltc2631_8_channels, 2),
+	[ID_LTC2635_L12] = LTC2631_INFO(2500000, ltc2631_12_channels, 4),
+	[ID_LTC2635_H12] = LTC2631_INFO(4096000, ltc2631_12_channels, 4),
+	[ID_LTC2635_L10] = LTC2631_INFO(2500000, ltc2631_10_channels, 4),
+	[ID_LTC2635_H10] = LTC2631_INFO(4096000, ltc2631_10_channels, 4),
+	[ID_LTC2635_L8] = LTC2631_INFO(2500000, ltc2631_8_channels, 4),
+	[ID_LTC2635_H8] = LTC2631_INFO(4096000, ltc2631_8_channels, 4),
 };
 
 static inline unsigned int ad5064_num_vref(struct ad5064_state *st)
@@ -982,6 +1031,24 @@ static int ad5064_i2c_remove(struct i2c_client *i2c)
 	{"ltc2626", ID_LTC2626},
 	{"ltc2627", ID_LTC2627},
 	{"ltc2629", ID_LTC2629},
+	{"ltc2631-l12", ID_LTC2631_L12},
+	{"ltc2631-h12", ID_LTC2631_H12},
+	{"ltc2631-l10", ID_LTC2631_L10},
+	{"ltc2631-h10", ID_LTC2631_H10},
+	{"ltc2631-l8", ID_LTC2631_L8},
+	{"ltc2631-h8", ID_LTC2631_H8},
+	{"ltc2633-l12", ID_LTC2633_L12},
+	{"ltc2633-h12", ID_LTC2633_H12},
+	{"ltc2633-l10", ID_LTC2633_L10},
+	{"ltc2633-h10", ID_LTC2633_H10},
+	{"ltc2633-l8", ID_LTC2633_L8},
+	{"ltc2633-h8", ID_LTC2633_H8},
+	{"ltc2635-l12", ID_LTC2635_L12},
+	{"ltc2635-h12", ID_LTC2635_H12},
+	{"ltc2635-l10", ID_LTC2635_L10},
+	{"ltc2635-h10", ID_LTC2635_H10},
+	{"ltc2635-l8", ID_LTC2635_L8},
+	{"ltc2635-h8", ID_LTC2635_H8},
 	{}
 };
 MODULE_DEVICE_TABLE(i2c, ad5064_i2c_ids);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] iio:ad5064: Add support for ltc2633 and similar devices
  2017-05-08  7:26     ` [PATCH v2] " Mike Looijmans
@ 2017-05-10  9:12       ` Lars-Peter Clausen
  2017-05-14 15:18         ` Jonathan Cameron
  0 siblings, 1 reply; 7+ messages in thread
From: Lars-Peter Clausen @ 2017-05-10  9:12 UTC (permalink / raw)
  To: Mike Looijmans, linux-iio
  Cc: linux-kernel, Michael.Hennerich, jic23, knaack.h, pmeerw

On 05/08/2017 09:26 AM, Mike Looijmans wrote:
> The Linear Technology LTC2631, LTC2633 and LTC2635 are very similar
> to the AD5064 device, in particular the LTC2627.
> 
> This patch adds support for those devices. Only the LTC2633 has been
> tested, which is the 2-channel variant. The LTC2631 is the 1-channel,
> and the LTC2635 the 4-channel version. The actual DAC resolution depends
> on the exact chip type and can be 12, 10 or 8 bits, using the upper bits
> so this has no effect on the register map. The internal reference is set
> to 2.5V on "L" versions, and it's 4.096V for "H" versions.
> 
> Datasheets:
>     LTC2631: http://www.linear.com/docs/26553
>     LTC2633: http://www.linear.com/docs/39529
>     LTC2635: http://www.linear.com/docs/28754
> 
> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>

Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>

Thanks for reworking the patch.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] iio:ad5064: Add support for ltc2633 and similar devices
  2017-05-10  9:12       ` Lars-Peter Clausen
@ 2017-05-14 15:18         ` Jonathan Cameron
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2017-05-14 15:18 UTC (permalink / raw)
  To: Lars-Peter Clausen, Mike Looijmans, linux-iio
  Cc: linux-kernel, Michael.Hennerich, knaack.h, pmeerw

On 10/05/17 10:12, Lars-Peter Clausen wrote:
> On 05/08/2017 09:26 AM, Mike Looijmans wrote:
>> The Linear Technology LTC2631, LTC2633 and LTC2635 are very similar
>> to the AD5064 device, in particular the LTC2627.
>>
>> This patch adds support for those devices. Only the LTC2633 has been
>> tested, which is the 2-channel variant. The LTC2631 is the 1-channel,
>> and the LTC2635 the 4-channel version. The actual DAC resolution depends
>> on the exact chip type and can be 12, 10 or 8 bits, using the upper bits
>> so this has no effect on the register map. The internal reference is set
>> to 2.5V on "L" versions, and it's 4.096V for "H" versions.
>>
>> Datasheets:
>>      LTC2631: http://www.linear.com/docs/26553
>>      LTC2633: http://www.linear.com/docs/39529
>>      LTC2635: http://www.linear.com/docs/28754
>>
>> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
> 
> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
> 
> Thanks for reworking the patch.
> 
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

Thanks,

Jonathan

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-05-14 15:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-26  9:44 [PATCH] iio:ad5064: Add support for ltc2633 and similar devices Mike Looijmans
2017-04-27  5:52 ` Jonathan Cameron
2017-04-27  9:16   ` Lars-Peter Clausen
2017-04-27 17:09     ` Mike Looijmans
2017-05-08  7:26     ` [PATCH v2] " Mike Looijmans
2017-05-10  9:12       ` Lars-Peter Clausen
2017-05-14 15:18         ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).