* [PATCH v3 0/2] iio:ad5064: Add support for LTC2617
@ 2015-10-22 4:34 Marc Andre
2015-10-22 4:34 ` [PATCH v3 1/2] iio:ad5064: Structural changes to support LTC2617 Marc Andre
2015-10-22 4:34 ` [PATCH v3 2/2] iio:ad5064: Add support for ltc2617 and similar devices Marc Andre
0 siblings, 2 replies; 7+ messages in thread
From: Marc Andre @ 2015-10-22 4:34 UTC (permalink / raw)
To: jic23; +Cc: knaack.h, lars, pmeerw, linux-iio, marc.andre
Based on the feedback from Lars-Peter I've reordered the patch to
first adjust the structure and then add the LTC2617 support.
The result file (after applying both patches) is identical. Of course
the commit description has changed.
**** Original intro *****
Based on the discussion after submitting my patch to add a new driver
for LTC2617, I've now implemented the support for the LTC2617 (and
similar) devices into the AD5064 driver.
I've split the implementation into two patches. The first patch adds
basic support for LTC2617. The second patch fixes the power down
functionality because the LTC handle that differently than the AD
devices.
[PATCH v3 1/2] iio:ad5064: Structural changes to support LTC2617
[PATCH v3 2/2] iio:ad5064: Add support for ltc2617 and similar devices
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 1/2] iio:ad5064: Structural changes to support LTC2617
2015-10-22 4:34 [PATCH v3 0/2] iio:ad5064: Add support for LTC2617 Marc Andre
@ 2015-10-22 4:34 ` Marc Andre
2015-10-25 11:14 ` Jonathan Cameron
2015-10-22 4:34 ` [PATCH v3 2/2] iio:ad5064: Add support for ltc2617 and similar devices Marc Andre
1 sibling, 1 reply; 7+ messages in thread
From: Marc Andre @ 2015-10-22 4:34 UTC (permalink / raw)
To: jic23; +Cc: knaack.h, lars, pmeerw, linux-iio, marc.andre
This patch makes minor structural changes to support specifics
for LTC2617 DAC. This DAC requires different handling of the
power down modes. The configuration to actually support the
DAC will be submitted in a secondary patch.
Adjust the DECLARE_AD5064_CHANNELS() macro to accept a new
ext_info parameter. This allows to use different power down
modes per DAC. (e.g. DAC only support 90kohm to ground)
Add the chip_info parameter "powerdown_ltc". This parameter is
used in the ad5064_sync_powerdown_mode() function to handle the
power down command for LTC diffently. For those devices the
power down command must be addressed to the channel.
Signed-off-by: Marc Andre <marc.andre@netline.ch>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
---
drivers/iio/dac/ad5064.c | 67 +++++++++++++++++++++++++++---------------------
1 file changed, 38 insertions(+), 29 deletions(-)
diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
index 978f130..3bb0312 100644
--- a/drivers/iio/dac/ad5064.c
+++ b/drivers/iio/dac/ad5064.c
@@ -50,10 +50,12 @@
/**
* struct ad5064_chip_info - chip specific information
* @shared_vref: whether the vref supply is shared between channels
- * @internal_vref: internal reference voltage. 0 if the chip has no internal
- * vref.
+ * @internal_vref: internal reference voltage. 0 if the chip has no
+ internal vref.
* @channel: channel specification
* @num_channels: number of channels
+ * @powerdown_ltc: Use alternative power down addressing as required by
+ * ltc2617 and others.
*/
struct ad5064_chip_info {
@@ -61,6 +63,7 @@ struct ad5064_chip_info {
unsigned long internal_vref;
const struct iio_chan_spec *channels;
unsigned int num_channels;
+ bool powerdown_ltc;
};
struct ad5064_state;
@@ -136,15 +139,21 @@ static int ad5064_write(struct ad5064_state *st, unsigned int cmd,
static int ad5064_sync_powerdown_mode(struct ad5064_state *st,
const struct iio_chan_spec *chan)
{
- unsigned int val;
+ unsigned int val, address;
int ret;
- val = (0x1 << chan->address);
+ if (st->chip_info->powerdown_ltc) {
+ val = 0;
+ address = chan->address;
+ } else {
+ address = 0;
+ val = (0x1 << chan->address);
- if (st->pwr_down[chan->channel])
- val |= st->pwr_down_mode[chan->channel] << 8;
+ if (st->pwr_down[chan->channel])
+ val |= st->pwr_down_mode[chan->channel] << 8;
+ }
- ret = ad5064_write(st, AD5064_CMD_POWERDOWN_DAC, 0, val, 0);
+ ret = ad5064_write(st, AD5064_CMD_POWERDOWN_DAC, address, val, 0);
return ret;
}
@@ -295,7 +304,7 @@ static const struct iio_chan_spec_ext_info ad5064_ext_info[] = {
{ },
};
-#define AD5064_CHANNEL(chan, addr, bits, _shift) { \
+#define AD5064_CHANNEL(chan, addr, bits, _shift, _ext_info) { \
.type = IIO_VOLTAGE, \
.indexed = 1, \
.output = 1, \
@@ -309,37 +318,37 @@ static const struct iio_chan_spec_ext_info ad5064_ext_info[] = {
.storagebits = 16, \
.shift = (_shift), \
}, \
- .ext_info = ad5064_ext_info, \
+ .ext_info = (_ext_info), \
}
-#define DECLARE_AD5064_CHANNELS(name, bits, shift) \
+#define DECLARE_AD5064_CHANNELS(name, bits, shift, ext_info) \
const struct iio_chan_spec name[] = { \
- AD5064_CHANNEL(0, 0, bits, shift), \
- AD5064_CHANNEL(1, 1, bits, shift), \
- AD5064_CHANNEL(2, 2, bits, shift), \
- AD5064_CHANNEL(3, 3, bits, shift), \
- AD5064_CHANNEL(4, 4, bits, shift), \
- AD5064_CHANNEL(5, 5, bits, shift), \
- AD5064_CHANNEL(6, 6, bits, shift), \
- AD5064_CHANNEL(7, 7, bits, shift), \
+ AD5064_CHANNEL(0, 0, bits, shift, ext_info), \
+ AD5064_CHANNEL(1, 1, bits, shift, ext_info), \
+ AD5064_CHANNEL(2, 2, bits, shift, ext_info), \
+ AD5064_CHANNEL(3, 3, bits, shift, ext_info), \
+ AD5064_CHANNEL(4, 4, bits, shift, ext_info), \
+ AD5064_CHANNEL(5, 5, bits, shift, ext_info), \
+ AD5064_CHANNEL(6, 6, bits, shift, ext_info), \
+ AD5064_CHANNEL(7, 7, bits, shift, ext_info), \
}
-#define DECLARE_AD5065_CHANNELS(name, bits, shift) \
+#define DECLARE_AD5065_CHANNELS(name, bits, shift, ext_info) \
const struct iio_chan_spec name[] = { \
- AD5064_CHANNEL(0, 0, bits, shift), \
- AD5064_CHANNEL(1, 3, bits, shift), \
+ AD5064_CHANNEL(0, 0, bits, shift, ext_info), \
+ AD5064_CHANNEL(1, 3, bits, shift, ext_info), \
}
-static DECLARE_AD5064_CHANNELS(ad5024_channels, 12, 8);
-static DECLARE_AD5064_CHANNELS(ad5044_channels, 14, 6);
-static DECLARE_AD5064_CHANNELS(ad5064_channels, 16, 4);
+static DECLARE_AD5064_CHANNELS(ad5024_channels, 12, 8, ad5064_ext_info);
+static DECLARE_AD5064_CHANNELS(ad5044_channels, 14, 6, ad5064_ext_info);
+static DECLARE_AD5064_CHANNELS(ad5064_channels, 16, 4, ad5064_ext_info);
-static DECLARE_AD5065_CHANNELS(ad5025_channels, 12, 8);
-static DECLARE_AD5065_CHANNELS(ad5045_channels, 14, 6);
-static DECLARE_AD5065_CHANNELS(ad5065_channels, 16, 4);
+static DECLARE_AD5065_CHANNELS(ad5025_channels, 12, 8, ad5064_ext_info);
+static DECLARE_AD5065_CHANNELS(ad5045_channels, 14, 6, ad5064_ext_info);
+static DECLARE_AD5065_CHANNELS(ad5065_channels, 16, 4, ad5064_ext_info);
-static DECLARE_AD5064_CHANNELS(ad5629_channels, 12, 4);
-static DECLARE_AD5064_CHANNELS(ad5669_channels, 16, 0);
+static DECLARE_AD5064_CHANNELS(ad5629_channels, 12, 4, ad5064_ext_info);
+static DECLARE_AD5064_CHANNELS(ad5669_channels, 16, 0, ad5064_ext_info);
static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {
[ID_AD5024] = {
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 2/2] iio:ad5064: Add support for ltc2617 and similar devices
2015-10-22 4:34 [PATCH v3 0/2] iio:ad5064: Add support for LTC2617 Marc Andre
2015-10-22 4:34 ` [PATCH v3 1/2] iio:ad5064: Structural changes to support LTC2617 Marc Andre
@ 2015-10-22 4:34 ` Marc Andre
2015-10-25 11:19 ` Jonathan Cameron
1 sibling, 1 reply; 7+ messages in thread
From: Marc Andre @ 2015-10-22 4:34 UTC (permalink / raw)
To: jic23; +Cc: knaack.h, lars, pmeerw, linux-iio, marc.andre
The Linear Technology LTC2606, LTC2607, LTC2609, LTC2616, LTC2617,
LTC2619, LTC2626, LTC2627 and LTC2629 devices are very similar
to the AD5064 device.
This patch adds support for those devices.
Datasheet for LTC devices:
LTC2606, LTC2616, LTC2626: http://www.linear.com/docs/6398
LTC2607, LTC2617, LTC2627: http://www.linear.com/docs/8977
LTC2709, LTC2619, LTC2629: http://www.linear.com/docs/8477
Signed-off-by: Marc Andre <marc.andre@netline.ch>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
---
Documentation/ABI/testing/sysfs-bus-iio | 1 +
drivers/iio/dac/ad5064.c | 112 +++++++++++++++++++++++++++++++-
2 files changed, 112 insertions(+), 1 deletion(-)
diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
index 42d360f..3e8b778 100644
--- a/Documentation/ABI/testing/sysfs-bus-iio
+++ b/Documentation/ABI/testing/sysfs-bus-iio
@@ -496,6 +496,7 @@ Description:
1kohm_to_gnd: connected to ground via an 1kOhm resistor,
6kohm_to_gnd: connected to ground via a 6kOhm resistor,
20kohm_to_gnd: connected to ground via a 20kOhm resistor,
+ 90kohm_to_gnd: connected to ground via a 90kOhm resistor,
100kohm_to_gnd: connected to ground via an 100kOhm resistor,
500kohm_to_gnd: connected to ground via a 500kOhm resistor,
three_state: left floating.
diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
index 3bb0312..1b89625 100644
--- a/drivers/iio/dac/ad5064.c
+++ b/drivers/iio/dac/ad5064.c
@@ -1,6 +1,8 @@
/*
* AD5024, AD5025, AD5044, AD5045, AD5064, AD5064-1, AD5065, AD5628, AD5629R,
- * AD5648, AD5666, AD5668, AD5669R Digital to analog converters driver
+ * AD5648, AD5666, AD5668, AD5669R, LTC2606, LTC2607, LTC2609, LTC2616,
+ * LTC2617, LTC2619, LTC2626, LTC2627, LTC2629 Digital to analog converters
+ * driver
*
* Copyright 2011 Analog Devices Inc.
*
@@ -126,6 +128,15 @@ enum ad5064_type {
ID_AD5668_2,
ID_AD5669_1,
ID_AD5669_2,
+ ID_LTC2606,
+ ID_LTC2607,
+ ID_LTC2609,
+ ID_LTC2616,
+ ID_LTC2617,
+ ID_LTC2619,
+ ID_LTC2626,
+ ID_LTC2627,
+ ID_LTC2629,
};
static int ad5064_write(struct ad5064_state *st, unsigned int cmd,
@@ -164,6 +175,10 @@ static const char * const ad5064_powerdown_modes[] = {
"three_state",
};
+static const char * const ltc2617_powerdown_modes[] = {
+ "90kohm_to_gnd",
+};
+
static int ad5064_get_powerdown_mode(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan)
{
@@ -194,6 +209,13 @@ static const struct iio_enum ad5064_powerdown_mode_enum = {
.set = ad5064_set_powerdown_mode,
};
+static const struct iio_enum ltc2617_powerdown_mode_enum = {
+ .items = ltc2617_powerdown_modes,
+ .num_items = ARRAY_SIZE(ltc2617_powerdown_modes),
+ .get = ad5064_get_powerdown_mode,
+ .set = ad5064_set_powerdown_mode,
+};
+
static ssize_t ad5064_read_dac_powerdown(struct iio_dev *indio_dev,
uintptr_t private, const struct iio_chan_spec *chan, char *buf)
{
@@ -304,6 +326,18 @@ static const struct iio_chan_spec_ext_info ad5064_ext_info[] = {
{ },
};
+static const struct iio_chan_spec_ext_info ltc2617_ext_info[] = {
+ {
+ .name = "powerdown",
+ .read = ad5064_read_dac_powerdown,
+ .write = ad5064_write_dac_powerdown,
+ .shared = IIO_SEPARATE,
+ },
+ IIO_ENUM("powerdown_mode", IIO_SEPARATE, <c2617_powerdown_mode_enum),
+ IIO_ENUM_AVAILABLE("powerdown_mode", <c2617_powerdown_mode_enum),
+ { },
+};
+
#define AD5064_CHANNEL(chan, addr, bits, _shift, _ext_info) { \
.type = IIO_VOLTAGE, \
.indexed = 1, \
@@ -350,6 +384,10 @@ static DECLARE_AD5065_CHANNELS(ad5065_channels, 16, 4, ad5064_ext_info);
static DECLARE_AD5064_CHANNELS(ad5629_channels, 12, 4, ad5064_ext_info);
static DECLARE_AD5064_CHANNELS(ad5669_channels, 16, 0, ad5064_ext_info);
+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);
+
static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {
[ID_AD5024] = {
.shared_vref = false,
@@ -458,6 +496,69 @@ static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {
.channels = ad5669_channels,
.num_channels = 8,
},
+ [ID_LTC2606] = {
+ .shared_vref = true,
+ .internal_vref = 0,
+ .channels = ltc2607_channels,
+ .num_channels = 1,
+ .powerdown_ltc = true,
+ },
+ [ID_LTC2607] = {
+ .shared_vref = true,
+ .internal_vref = 0,
+ .channels = ltc2607_channels,
+ .num_channels = 2,
+ .powerdown_ltc = true,
+ },
+ [ID_LTC2609] = {
+ .shared_vref = false,
+ .internal_vref = 0,
+ .channels = ltc2607_channels,
+ .num_channels = 4,
+ .powerdown_ltc = true,
+ },
+ [ID_LTC2616] = {
+ .shared_vref = true,
+ .internal_vref = 0,
+ .channels = ltc2617_channels,
+ .num_channels = 1,
+ .powerdown_ltc = true,
+ },
+ [ID_LTC2617] = {
+ .shared_vref = true,
+ .internal_vref = 0,
+ .channels = ltc2617_channels,
+ .num_channels = 2,
+ .powerdown_ltc = true,
+ },
+ [ID_LTC2619] = {
+ .shared_vref = false,
+ .internal_vref = 0,
+ .channels = ltc2617_channels,
+ .num_channels = 4,
+ .powerdown_ltc = true,
+ },
+ [ID_LTC2626] = {
+ .shared_vref = true,
+ .internal_vref = 0,
+ .channels = ltc2627_channels,
+ .num_channels = 1,
+ .powerdown_ltc = true,
+ },
+ [ID_LTC2627] = {
+ .shared_vref = true,
+ .internal_vref = 0,
+ .channels = ltc2627_channels,
+ .num_channels = 2,
+ .powerdown_ltc = true,
+ },
+ [ID_LTC2629] = {
+ .shared_vref = false,
+ .internal_vref = 0,
+ .channels = ltc2627_channels,
+ .num_channels = 4,
+ .powerdown_ltc = true,
+ },
};
static inline unsigned int ad5064_num_vref(struct ad5064_state *st)
@@ -669,6 +770,15 @@ static const struct i2c_device_id ad5064_i2c_ids[] = {
{"ad5669-1", ID_AD5669_1},
{"ad5669-2", ID_AD5669_2},
{"ad5669-3", ID_AD5669_2}, /* similar enough to ad5669-2 */
+ {"ltc2606", ID_LTC2606},
+ {"ltc2607", ID_LTC2607},
+ {"ltc2609", ID_LTC2609},
+ {"ltc2616", ID_LTC2616},
+ {"ltc2617", ID_LTC2617},
+ {"ltc2619", ID_LTC2619},
+ {"ltc2626", ID_LTC2626},
+ {"ltc2627", ID_LTC2627},
+ {"ltc2629", ID_LTC2629},
{}
};
MODULE_DEVICE_TABLE(i2c, ad5064_i2c_ids);
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v3 1/2] iio:ad5064: Structural changes to support LTC2617
2015-10-22 4:34 ` [PATCH v3 1/2] iio:ad5064: Structural changes to support LTC2617 Marc Andre
@ 2015-10-25 11:14 ` Jonathan Cameron
2015-10-25 11:18 ` Jonathan Cameron
0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Cameron @ 2015-10-25 11:14 UTC (permalink / raw)
To: Marc Andre; +Cc: knaack.h, lars, pmeerw, linux-iio
On 22/10/15 05:34, Marc Andre wrote:
> This patch makes minor structural changes to support specifics
> for LTC2617 DAC. This DAC requires different handling of the
> power down modes. The configuration to actually support the
> DAC will be submitted in a secondary patch.
>
> Adjust the DECLARE_AD5064_CHANNELS() macro to accept a new
> ext_info parameter. This allows to use different power down
> modes per DAC. (e.g. DAC only support 90kohm to ground)
>
> Add the chip_info parameter "powerdown_ltc". This parameter is
> used in the ad5064_sync_powerdown_mode() function to handle the
> power down command for LTC diffently. For those devices the
> power down command must be addressed to the channel.
>
> Signed-off-by: Marc Andre <marc.andre@netline.ch>
> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Really trivial point inline. If you find a formatting issue
(81 char line here) please fix it in a precursor patch rather than
as you happen to go by it. That makes for a trivial patch, but
then ensures there is no 'noise' cluttering up the real work.
Applied to the togreg branch of iio.git - initially pushed out as testing.
Note that due to my day job silly week, this missed the merge window for
this cycle. Sorry about that. Next pull request to Greg and hence hitting
linux next will be after rc1.
Jonathan
> ---
> drivers/iio/dac/ad5064.c | 67 +++++++++++++++++++++++++++---------------------
> 1 file changed, 38 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
> index 978f130..3bb0312 100644
> --- a/drivers/iio/dac/ad5064.c
> +++ b/drivers/iio/dac/ad5064.c
> @@ -50,10 +50,12 @@
> /**
> * struct ad5064_chip_info - chip specific information
> * @shared_vref: whether the vref supply is shared between channels
> - * @internal_vref: internal reference voltage. 0 if the chip has no internal
> - * vref.
> + * @internal_vref: internal reference voltage. 0 if the chip has no
> + internal vref.
I'm guessing this just tripped the 80 character limit. Ideally this would have
been a precursor patch as it has nothing to with the changes here.
> * @channel: channel specification
> * @num_channels: number of channels
> + * @powerdown_ltc: Use alternative power down addressing as required by
> + * ltc2617 and others.
> */
>
> struct ad5064_chip_info {
> @@ -61,6 +63,7 @@ struct ad5064_chip_info {
> unsigned long internal_vref;
> const struct iio_chan_spec *channels;
> unsigned int num_channels;
> + bool powerdown_ltc;
> };
>
> struct ad5064_state;
> @@ -136,15 +139,21 @@ static int ad5064_write(struct ad5064_state *st, unsigned int cmd,
> static int ad5064_sync_powerdown_mode(struct ad5064_state *st,
> const struct iio_chan_spec *chan)
> {
> - unsigned int val;
> + unsigned int val, address;
> int ret;
>
> - val = (0x1 << chan->address);
> + if (st->chip_info->powerdown_ltc) {
> + val = 0;
> + address = chan->address;
> + } else {
> + address = 0;
> + val = (0x1 << chan->address);
>
> - if (st->pwr_down[chan->channel])
> - val |= st->pwr_down_mode[chan->channel] << 8;
> + if (st->pwr_down[chan->channel])
> + val |= st->pwr_down_mode[chan->channel] << 8;
> + }
>
> - ret = ad5064_write(st, AD5064_CMD_POWERDOWN_DAC, 0, val, 0);
> + ret = ad5064_write(st, AD5064_CMD_POWERDOWN_DAC, address, val, 0);
>
> return ret;
> }
> @@ -295,7 +304,7 @@ static const struct iio_chan_spec_ext_info ad5064_ext_info[] = {
> { },
> };
>
> -#define AD5064_CHANNEL(chan, addr, bits, _shift) { \
> +#define AD5064_CHANNEL(chan, addr, bits, _shift, _ext_info) { \
> .type = IIO_VOLTAGE, \
> .indexed = 1, \
> .output = 1, \
> @@ -309,37 +318,37 @@ static const struct iio_chan_spec_ext_info ad5064_ext_info[] = {
> .storagebits = 16, \
> .shift = (_shift), \
> }, \
> - .ext_info = ad5064_ext_info, \
> + .ext_info = (_ext_info), \
> }
>
> -#define DECLARE_AD5064_CHANNELS(name, bits, shift) \
> +#define DECLARE_AD5064_CHANNELS(name, bits, shift, ext_info) \
> const struct iio_chan_spec name[] = { \
> - AD5064_CHANNEL(0, 0, bits, shift), \
> - AD5064_CHANNEL(1, 1, bits, shift), \
> - AD5064_CHANNEL(2, 2, bits, shift), \
> - AD5064_CHANNEL(3, 3, bits, shift), \
> - AD5064_CHANNEL(4, 4, bits, shift), \
> - AD5064_CHANNEL(5, 5, bits, shift), \
> - AD5064_CHANNEL(6, 6, bits, shift), \
> - AD5064_CHANNEL(7, 7, bits, shift), \
> + AD5064_CHANNEL(0, 0, bits, shift, ext_info), \
> + AD5064_CHANNEL(1, 1, bits, shift, ext_info), \
> + AD5064_CHANNEL(2, 2, bits, shift, ext_info), \
> + AD5064_CHANNEL(3, 3, bits, shift, ext_info), \
> + AD5064_CHANNEL(4, 4, bits, shift, ext_info), \
> + AD5064_CHANNEL(5, 5, bits, shift, ext_info), \
> + AD5064_CHANNEL(6, 6, bits, shift, ext_info), \
> + AD5064_CHANNEL(7, 7, bits, shift, ext_info), \
> }
>
> -#define DECLARE_AD5065_CHANNELS(name, bits, shift) \
> +#define DECLARE_AD5065_CHANNELS(name, bits, shift, ext_info) \
> const struct iio_chan_spec name[] = { \
> - AD5064_CHANNEL(0, 0, bits, shift), \
> - AD5064_CHANNEL(1, 3, bits, shift), \
> + AD5064_CHANNEL(0, 0, bits, shift, ext_info), \
> + AD5064_CHANNEL(1, 3, bits, shift, ext_info), \
> }
>
> -static DECLARE_AD5064_CHANNELS(ad5024_channels, 12, 8);
> -static DECLARE_AD5064_CHANNELS(ad5044_channels, 14, 6);
> -static DECLARE_AD5064_CHANNELS(ad5064_channels, 16, 4);
> +static DECLARE_AD5064_CHANNELS(ad5024_channels, 12, 8, ad5064_ext_info);
> +static DECLARE_AD5064_CHANNELS(ad5044_channels, 14, 6, ad5064_ext_info);
> +static DECLARE_AD5064_CHANNELS(ad5064_channels, 16, 4, ad5064_ext_info);
>
> -static DECLARE_AD5065_CHANNELS(ad5025_channels, 12, 8);
> -static DECLARE_AD5065_CHANNELS(ad5045_channels, 14, 6);
> -static DECLARE_AD5065_CHANNELS(ad5065_channels, 16, 4);
> +static DECLARE_AD5065_CHANNELS(ad5025_channels, 12, 8, ad5064_ext_info);
> +static DECLARE_AD5065_CHANNELS(ad5045_channels, 14, 6, ad5064_ext_info);
> +static DECLARE_AD5065_CHANNELS(ad5065_channels, 16, 4, ad5064_ext_info);
>
> -static DECLARE_AD5064_CHANNELS(ad5629_channels, 12, 4);
> -static DECLARE_AD5064_CHANNELS(ad5669_channels, 16, 0);
> +static DECLARE_AD5064_CHANNELS(ad5629_channels, 12, 4, ad5064_ext_info);
> +static DECLARE_AD5064_CHANNELS(ad5669_channels, 16, 0, ad5064_ext_info);
>
> static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {
> [ID_AD5024] = {
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 1/2] iio:ad5064: Structural changes to support LTC2617
2015-10-25 11:14 ` Jonathan Cameron
@ 2015-10-25 11:18 ` Jonathan Cameron
0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2015-10-25 11:18 UTC (permalink / raw)
To: Marc Andre; +Cc: knaack.h, lars, pmeerw, linux-iio
On 25/10/15 11:14, Jonathan Cameron wrote:
> On 22/10/15 05:34, Marc Andre wrote:
>> This patch makes minor structural changes to support specifics
>> for LTC2617 DAC. This DAC requires different handling of the
>> power down modes. The configuration to actually support the
>> DAC will be submitted in a secondary patch.
>>
>> Adjust the DECLARE_AD5064_CHANNELS() macro to accept a new
>> ext_info parameter. This allows to use different power down
>> modes per DAC. (e.g. DAC only support 90kohm to ground)
>>
>> Add the chip_info parameter "powerdown_ltc". This parameter is
>> used in the ad5064_sync_powerdown_mode() function to handle the
>> power down command for LTC diffently. For those devices the
>> power down command must be addressed to the channel.
>>
>> Signed-off-by: Marc Andre <marc.andre@netline.ch>
>> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
> Really trivial point inline. If you find a formatting issue
> (81 char line here) please fix it in a precursor patch rather than
> as you happen to go by it. That makes for a trivial patch, but
> then ensures there is no 'noise' cluttering up the real work.
>
> Applied to the togreg branch of iio.git - initially pushed out as testing.
> Note that due to my day job silly week, this missed the merge window for
> this cycle. Sorry about that. Next pull request to Greg and hence hitting
> linux next will be after rc1.
>
> Jonathan
Ah, I forgot the two fixes Lars sent on.
Those will need to hit first and work their way through to my upstream. This
might take a while unfortunately as Greg won't be taking fixes for the current
cycle now either so those will only go post rc1. Ah well, will be about
a month before these go in. Sometimes the cycles are rather unfortunate!
Jonathan
>> ---
>> drivers/iio/dac/ad5064.c | 67 +++++++++++++++++++++++++++---------------------
>> 1 file changed, 38 insertions(+), 29 deletions(-)
>>
>> diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
>> index 978f130..3bb0312 100644
>> --- a/drivers/iio/dac/ad5064.c
>> +++ b/drivers/iio/dac/ad5064.c
>> @@ -50,10 +50,12 @@
>> /**
>> * struct ad5064_chip_info - chip specific information
>> * @shared_vref: whether the vref supply is shared between channels
>> - * @internal_vref: internal reference voltage. 0 if the chip has no internal
>> - * vref.
>> + * @internal_vref: internal reference voltage. 0 if the chip has no
>> + internal vref.
> I'm guessing this just tripped the 80 character limit. Ideally this would have
> been a precursor patch as it has nothing to with the changes here.
>> * @channel: channel specification
>> * @num_channels: number of channels
>> + * @powerdown_ltc: Use alternative power down addressing as required by
>> + * ltc2617 and others.
>> */
>>
>> struct ad5064_chip_info {
>> @@ -61,6 +63,7 @@ struct ad5064_chip_info {
>> unsigned long internal_vref;
>> const struct iio_chan_spec *channels;
>> unsigned int num_channels;
>> + bool powerdown_ltc;
>> };
>>
>> struct ad5064_state;
>> @@ -136,15 +139,21 @@ static int ad5064_write(struct ad5064_state *st, unsigned int cmd,
>> static int ad5064_sync_powerdown_mode(struct ad5064_state *st,
>> const struct iio_chan_spec *chan)
>> {
>> - unsigned int val;
>> + unsigned int val, address;
>> int ret;
>>
>> - val = (0x1 << chan->address);
>> + if (st->chip_info->powerdown_ltc) {
>> + val = 0;
>> + address = chan->address;
>> + } else {
>> + address = 0;
>> + val = (0x1 << chan->address);
>>
>> - if (st->pwr_down[chan->channel])
>> - val |= st->pwr_down_mode[chan->channel] << 8;
>> + if (st->pwr_down[chan->channel])
>> + val |= st->pwr_down_mode[chan->channel] << 8;
>> + }
>>
>> - ret = ad5064_write(st, AD5064_CMD_POWERDOWN_DAC, 0, val, 0);
>> + ret = ad5064_write(st, AD5064_CMD_POWERDOWN_DAC, address, val, 0);
>>
>> return ret;
>> }
>> @@ -295,7 +304,7 @@ static const struct iio_chan_spec_ext_info ad5064_ext_info[] = {
>> { },
>> };
>>
>> -#define AD5064_CHANNEL(chan, addr, bits, _shift) { \
>> +#define AD5064_CHANNEL(chan, addr, bits, _shift, _ext_info) { \
>> .type = IIO_VOLTAGE, \
>> .indexed = 1, \
>> .output = 1, \
>> @@ -309,37 +318,37 @@ static const struct iio_chan_spec_ext_info ad5064_ext_info[] = {
>> .storagebits = 16, \
>> .shift = (_shift), \
>> }, \
>> - .ext_info = ad5064_ext_info, \
>> + .ext_info = (_ext_info), \
>> }
>>
>> -#define DECLARE_AD5064_CHANNELS(name, bits, shift) \
>> +#define DECLARE_AD5064_CHANNELS(name, bits, shift, ext_info) \
>> const struct iio_chan_spec name[] = { \
>> - AD5064_CHANNEL(0, 0, bits, shift), \
>> - AD5064_CHANNEL(1, 1, bits, shift), \
>> - AD5064_CHANNEL(2, 2, bits, shift), \
>> - AD5064_CHANNEL(3, 3, bits, shift), \
>> - AD5064_CHANNEL(4, 4, bits, shift), \
>> - AD5064_CHANNEL(5, 5, bits, shift), \
>> - AD5064_CHANNEL(6, 6, bits, shift), \
>> - AD5064_CHANNEL(7, 7, bits, shift), \
>> + AD5064_CHANNEL(0, 0, bits, shift, ext_info), \
>> + AD5064_CHANNEL(1, 1, bits, shift, ext_info), \
>> + AD5064_CHANNEL(2, 2, bits, shift, ext_info), \
>> + AD5064_CHANNEL(3, 3, bits, shift, ext_info), \
>> + AD5064_CHANNEL(4, 4, bits, shift, ext_info), \
>> + AD5064_CHANNEL(5, 5, bits, shift, ext_info), \
>> + AD5064_CHANNEL(6, 6, bits, shift, ext_info), \
>> + AD5064_CHANNEL(7, 7, bits, shift, ext_info), \
>> }
>>
>> -#define DECLARE_AD5065_CHANNELS(name, bits, shift) \
>> +#define DECLARE_AD5065_CHANNELS(name, bits, shift, ext_info) \
>> const struct iio_chan_spec name[] = { \
>> - AD5064_CHANNEL(0, 0, bits, shift), \
>> - AD5064_CHANNEL(1, 3, bits, shift), \
>> + AD5064_CHANNEL(0, 0, bits, shift, ext_info), \
>> + AD5064_CHANNEL(1, 3, bits, shift, ext_info), \
>> }
>>
>> -static DECLARE_AD5064_CHANNELS(ad5024_channels, 12, 8);
>> -static DECLARE_AD5064_CHANNELS(ad5044_channels, 14, 6);
>> -static DECLARE_AD5064_CHANNELS(ad5064_channels, 16, 4);
>> +static DECLARE_AD5064_CHANNELS(ad5024_channels, 12, 8, ad5064_ext_info);
>> +static DECLARE_AD5064_CHANNELS(ad5044_channels, 14, 6, ad5064_ext_info);
>> +static DECLARE_AD5064_CHANNELS(ad5064_channels, 16, 4, ad5064_ext_info);
>>
>> -static DECLARE_AD5065_CHANNELS(ad5025_channels, 12, 8);
>> -static DECLARE_AD5065_CHANNELS(ad5045_channels, 14, 6);
>> -static DECLARE_AD5065_CHANNELS(ad5065_channels, 16, 4);
>> +static DECLARE_AD5065_CHANNELS(ad5025_channels, 12, 8, ad5064_ext_info);
>> +static DECLARE_AD5065_CHANNELS(ad5045_channels, 14, 6, ad5064_ext_info);
>> +static DECLARE_AD5065_CHANNELS(ad5065_channels, 16, 4, ad5064_ext_info);
>>
>> -static DECLARE_AD5064_CHANNELS(ad5629_channels, 12, 4);
>> -static DECLARE_AD5064_CHANNELS(ad5669_channels, 16, 0);
>> +static DECLARE_AD5064_CHANNELS(ad5629_channels, 12, 4, ad5064_ext_info);
>> +static DECLARE_AD5064_CHANNELS(ad5669_channels, 16, 0, ad5064_ext_info);
>>
>> static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {
>> [ID_AD5024] = {
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 2/2] iio:ad5064: Add support for ltc2617 and similar devices
2015-10-22 4:34 ` [PATCH v3 2/2] iio:ad5064: Add support for ltc2617 and similar devices Marc Andre
@ 2015-10-25 11:19 ` Jonathan Cameron
2016-02-08 15:34 ` Lars-Peter Clausen
0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Cameron @ 2015-10-25 11:19 UTC (permalink / raw)
To: Marc Andre; +Cc: knaack.h, lars, pmeerw, linux-iio
On 22/10/15 05:34, Marc Andre wrote:
> The Linear Technology LTC2606, LTC2607, LTC2609, LTC2616, LTC2617,
> LTC2619, LTC2626, LTC2627 and LTC2629 devices are very similar
> to the AD5064 device.
>
> This patch adds support for those devices.
>
> Datasheet for LTC devices:
> LTC2606, LTC2616, LTC2626: http://www.linear.com/docs/6398
> LTC2607, LTC2617, LTC2627: http://www.linear.com/docs/8977
> LTC2709, LTC2619, LTC2629: http://www.linear.com/docs/8477
>
> Signed-off-by: Marc Andre <marc.andre@netline.ch>
> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Queued up for when the prerequisits make it in.
> ---
> Documentation/ABI/testing/sysfs-bus-iio | 1 +
> drivers/iio/dac/ad5064.c | 112 +++++++++++++++++++++++++++++++-
> 2 files changed, 112 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
> index 42d360f..3e8b778 100644
> --- a/Documentation/ABI/testing/sysfs-bus-iio
> +++ b/Documentation/ABI/testing/sysfs-bus-iio
> @@ -496,6 +496,7 @@ Description:
> 1kohm_to_gnd: connected to ground via an 1kOhm resistor,
> 6kohm_to_gnd: connected to ground via a 6kOhm resistor,
> 20kohm_to_gnd: connected to ground via a 20kOhm resistor,
> + 90kohm_to_gnd: connected to ground via a 90kOhm resistor,
> 100kohm_to_gnd: connected to ground via an 100kOhm resistor,
> 500kohm_to_gnd: connected to ground via a 500kOhm resistor,
> three_state: left floating.
> diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
> index 3bb0312..1b89625 100644
> --- a/drivers/iio/dac/ad5064.c
> +++ b/drivers/iio/dac/ad5064.c
> @@ -1,6 +1,8 @@
> /*
> * AD5024, AD5025, AD5044, AD5045, AD5064, AD5064-1, AD5065, AD5628, AD5629R,
> - * AD5648, AD5666, AD5668, AD5669R Digital to analog converters driver
> + * AD5648, AD5666, AD5668, AD5669R, LTC2606, LTC2607, LTC2609, LTC2616,
> + * LTC2617, LTC2619, LTC2626, LTC2627, LTC2629 Digital to analog converters
> + * driver
> *
> * Copyright 2011 Analog Devices Inc.
> *
> @@ -126,6 +128,15 @@ enum ad5064_type {
> ID_AD5668_2,
> ID_AD5669_1,
> ID_AD5669_2,
> + ID_LTC2606,
> + ID_LTC2607,
> + ID_LTC2609,
> + ID_LTC2616,
> + ID_LTC2617,
> + ID_LTC2619,
> + ID_LTC2626,
> + ID_LTC2627,
> + ID_LTC2629,
> };
>
> static int ad5064_write(struct ad5064_state *st, unsigned int cmd,
> @@ -164,6 +175,10 @@ static const char * const ad5064_powerdown_modes[] = {
> "three_state",
> };
>
> +static const char * const ltc2617_powerdown_modes[] = {
> + "90kohm_to_gnd",
> +};
> +
> static int ad5064_get_powerdown_mode(struct iio_dev *indio_dev,
> const struct iio_chan_spec *chan)
> {
> @@ -194,6 +209,13 @@ static const struct iio_enum ad5064_powerdown_mode_enum = {
> .set = ad5064_set_powerdown_mode,
> };
>
> +static const struct iio_enum ltc2617_powerdown_mode_enum = {
> + .items = ltc2617_powerdown_modes,
> + .num_items = ARRAY_SIZE(ltc2617_powerdown_modes),
> + .get = ad5064_get_powerdown_mode,
> + .set = ad5064_set_powerdown_mode,
> +};
> +
> static ssize_t ad5064_read_dac_powerdown(struct iio_dev *indio_dev,
> uintptr_t private, const struct iio_chan_spec *chan, char *buf)
> {
> @@ -304,6 +326,18 @@ static const struct iio_chan_spec_ext_info ad5064_ext_info[] = {
> { },
> };
>
> +static const struct iio_chan_spec_ext_info ltc2617_ext_info[] = {
> + {
> + .name = "powerdown",
> + .read = ad5064_read_dac_powerdown,
> + .write = ad5064_write_dac_powerdown,
> + .shared = IIO_SEPARATE,
> + },
> + IIO_ENUM("powerdown_mode", IIO_SEPARATE, <c2617_powerdown_mode_enum),
> + IIO_ENUM_AVAILABLE("powerdown_mode", <c2617_powerdown_mode_enum),
> + { },
> +};
> +
> #define AD5064_CHANNEL(chan, addr, bits, _shift, _ext_info) { \
> .type = IIO_VOLTAGE, \
> .indexed = 1, \
> @@ -350,6 +384,10 @@ static DECLARE_AD5065_CHANNELS(ad5065_channels, 16, 4, ad5064_ext_info);
> static DECLARE_AD5064_CHANNELS(ad5629_channels, 12, 4, ad5064_ext_info);
> static DECLARE_AD5064_CHANNELS(ad5669_channels, 16, 0, ad5064_ext_info);
>
> +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);
> +
> static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {
> [ID_AD5024] = {
> .shared_vref = false,
> @@ -458,6 +496,69 @@ static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {
> .channels = ad5669_channels,
> .num_channels = 8,
> },
> + [ID_LTC2606] = {
> + .shared_vref = true,
> + .internal_vref = 0,
> + .channels = ltc2607_channels,
> + .num_channels = 1,
> + .powerdown_ltc = true,
> + },
> + [ID_LTC2607] = {
> + .shared_vref = true,
> + .internal_vref = 0,
> + .channels = ltc2607_channels,
> + .num_channels = 2,
> + .powerdown_ltc = true,
> + },
> + [ID_LTC2609] = {
> + .shared_vref = false,
> + .internal_vref = 0,
> + .channels = ltc2607_channels,
> + .num_channels = 4,
> + .powerdown_ltc = true,
> + },
> + [ID_LTC2616] = {
> + .shared_vref = true,
> + .internal_vref = 0,
> + .channels = ltc2617_channels,
> + .num_channels = 1,
> + .powerdown_ltc = true,
> + },
> + [ID_LTC2617] = {
> + .shared_vref = true,
> + .internal_vref = 0,
> + .channels = ltc2617_channels,
> + .num_channels = 2,
> + .powerdown_ltc = true,
> + },
> + [ID_LTC2619] = {
> + .shared_vref = false,
> + .internal_vref = 0,
> + .channels = ltc2617_channels,
> + .num_channels = 4,
> + .powerdown_ltc = true,
> + },
> + [ID_LTC2626] = {
> + .shared_vref = true,
> + .internal_vref = 0,
> + .channels = ltc2627_channels,
> + .num_channels = 1,
> + .powerdown_ltc = true,
> + },
> + [ID_LTC2627] = {
> + .shared_vref = true,
> + .internal_vref = 0,
> + .channels = ltc2627_channels,
> + .num_channels = 2,
> + .powerdown_ltc = true,
> + },
> + [ID_LTC2629] = {
> + .shared_vref = false,
> + .internal_vref = 0,
> + .channels = ltc2627_channels,
> + .num_channels = 4,
> + .powerdown_ltc = true,
> + },
> };
>
> static inline unsigned int ad5064_num_vref(struct ad5064_state *st)
> @@ -669,6 +770,15 @@ static const struct i2c_device_id ad5064_i2c_ids[] = {
> {"ad5669-1", ID_AD5669_1},
> {"ad5669-2", ID_AD5669_2},
> {"ad5669-3", ID_AD5669_2}, /* similar enough to ad5669-2 */
> + {"ltc2606", ID_LTC2606},
> + {"ltc2607", ID_LTC2607},
> + {"ltc2609", ID_LTC2609},
> + {"ltc2616", ID_LTC2616},
> + {"ltc2617", ID_LTC2617},
> + {"ltc2619", ID_LTC2619},
> + {"ltc2626", ID_LTC2626},
> + {"ltc2627", ID_LTC2627},
> + {"ltc2629", ID_LTC2629},
> {}
> };
> MODULE_DEVICE_TABLE(i2c, ad5064_i2c_ids);
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 2/2] iio:ad5064: Add support for ltc2617 and similar devices
2015-10-25 11:19 ` Jonathan Cameron
@ 2016-02-08 15:34 ` Lars-Peter Clausen
0 siblings, 0 replies; 7+ messages in thread
From: Lars-Peter Clausen @ 2016-02-08 15:34 UTC (permalink / raw)
To: Jonathan Cameron, Marc Andre; +Cc: knaack.h, pmeerw, linux-iio
On 10/25/2015 12:19 PM, Jonathan Cameron wrote:
> On 22/10/15 05:34, Marc Andre wrote:
>> The Linear Technology LTC2606, LTC2607, LTC2609, LTC2616, LTC2617,
>> LTC2619, LTC2626, LTC2627 and LTC2629 devices are very similar
>> to the AD5064 device.
>>
>> This patch adds support for those devices.
>>
>> Datasheet for LTC devices:
>> LTC2606, LTC2616, LTC2626: http://www.linear.com/docs/6398
>> LTC2607, LTC2617, LTC2627: http://www.linear.com/docs/8977
>> LTC2709, LTC2619, LTC2629: http://www.linear.com/docs/8477
>>
>> Signed-off-by: Marc Andre <marc.andre@netline.ch>
>> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
> Queued up for when the prerequisits make it in.
I think this got somehow lost. Can you take a look at it again, thanks.
>> ---
>> Documentation/ABI/testing/sysfs-bus-iio | 1 +
>> drivers/iio/dac/ad5064.c | 112 +++++++++++++++++++++++++++++++-
>> 2 files changed, 112 insertions(+), 1 deletion(-)
>>
>> diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
>> index 42d360f..3e8b778 100644
>> --- a/Documentation/ABI/testing/sysfs-bus-iio
>> +++ b/Documentation/ABI/testing/sysfs-bus-iio
>> @@ -496,6 +496,7 @@ Description:
>> 1kohm_to_gnd: connected to ground via an 1kOhm resistor,
>> 6kohm_to_gnd: connected to ground via a 6kOhm resistor,
>> 20kohm_to_gnd: connected to ground via a 20kOhm resistor,
>> + 90kohm_to_gnd: connected to ground via a 90kOhm resistor,
>> 100kohm_to_gnd: connected to ground via an 100kOhm resistor,
>> 500kohm_to_gnd: connected to ground via a 500kOhm resistor,
>> three_state: left floating.
>> diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
>> index 3bb0312..1b89625 100644
>> --- a/drivers/iio/dac/ad5064.c
>> +++ b/drivers/iio/dac/ad5064.c
>> @@ -1,6 +1,8 @@
>> /*
>> * AD5024, AD5025, AD5044, AD5045, AD5064, AD5064-1, AD5065, AD5628, AD5629R,
>> - * AD5648, AD5666, AD5668, AD5669R Digital to analog converters driver
>> + * AD5648, AD5666, AD5668, AD5669R, LTC2606, LTC2607, LTC2609, LTC2616,
>> + * LTC2617, LTC2619, LTC2626, LTC2627, LTC2629 Digital to analog converters
>> + * driver
>> *
>> * Copyright 2011 Analog Devices Inc.
>> *
>> @@ -126,6 +128,15 @@ enum ad5064_type {
>> ID_AD5668_2,
>> ID_AD5669_1,
>> ID_AD5669_2,
>> + ID_LTC2606,
>> + ID_LTC2607,
>> + ID_LTC2609,
>> + ID_LTC2616,
>> + ID_LTC2617,
>> + ID_LTC2619,
>> + ID_LTC2626,
>> + ID_LTC2627,
>> + ID_LTC2629,
>> };
>>
>> static int ad5064_write(struct ad5064_state *st, unsigned int cmd,
>> @@ -164,6 +175,10 @@ static const char * const ad5064_powerdown_modes[] = {
>> "three_state",
>> };
>>
>> +static const char * const ltc2617_powerdown_modes[] = {
>> + "90kohm_to_gnd",
>> +};
>> +
>> static int ad5064_get_powerdown_mode(struct iio_dev *indio_dev,
>> const struct iio_chan_spec *chan)
>> {
>> @@ -194,6 +209,13 @@ static const struct iio_enum ad5064_powerdown_mode_enum = {
>> .set = ad5064_set_powerdown_mode,
>> };
>>
>> +static const struct iio_enum ltc2617_powerdown_mode_enum = {
>> + .items = ltc2617_powerdown_modes,
>> + .num_items = ARRAY_SIZE(ltc2617_powerdown_modes),
>> + .get = ad5064_get_powerdown_mode,
>> + .set = ad5064_set_powerdown_mode,
>> +};
>> +
>> static ssize_t ad5064_read_dac_powerdown(struct iio_dev *indio_dev,
>> uintptr_t private, const struct iio_chan_spec *chan, char *buf)
>> {
>> @@ -304,6 +326,18 @@ static const struct iio_chan_spec_ext_info ad5064_ext_info[] = {
>> { },
>> };
>>
>> +static const struct iio_chan_spec_ext_info ltc2617_ext_info[] = {
>> + {
>> + .name = "powerdown",
>> + .read = ad5064_read_dac_powerdown,
>> + .write = ad5064_write_dac_powerdown,
>> + .shared = IIO_SEPARATE,
>> + },
>> + IIO_ENUM("powerdown_mode", IIO_SEPARATE, <c2617_powerdown_mode_enum),
>> + IIO_ENUM_AVAILABLE("powerdown_mode", <c2617_powerdown_mode_enum),
>> + { },
>> +};
>> +
>> #define AD5064_CHANNEL(chan, addr, bits, _shift, _ext_info) { \
>> .type = IIO_VOLTAGE, \
>> .indexed = 1, \
>> @@ -350,6 +384,10 @@ static DECLARE_AD5065_CHANNELS(ad5065_channels, 16, 4, ad5064_ext_info);
>> static DECLARE_AD5064_CHANNELS(ad5629_channels, 12, 4, ad5064_ext_info);
>> static DECLARE_AD5064_CHANNELS(ad5669_channels, 16, 0, ad5064_ext_info);
>>
>> +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);
>> +
>> static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {
>> [ID_AD5024] = {
>> .shared_vref = false,
>> @@ -458,6 +496,69 @@ static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {
>> .channels = ad5669_channels,
>> .num_channels = 8,
>> },
>> + [ID_LTC2606] = {
>> + .shared_vref = true,
>> + .internal_vref = 0,
>> + .channels = ltc2607_channels,
>> + .num_channels = 1,
>> + .powerdown_ltc = true,
>> + },
>> + [ID_LTC2607] = {
>> + .shared_vref = true,
>> + .internal_vref = 0,
>> + .channels = ltc2607_channels,
>> + .num_channels = 2,
>> + .powerdown_ltc = true,
>> + },
>> + [ID_LTC2609] = {
>> + .shared_vref = false,
>> + .internal_vref = 0,
>> + .channels = ltc2607_channels,
>> + .num_channels = 4,
>> + .powerdown_ltc = true,
>> + },
>> + [ID_LTC2616] = {
>> + .shared_vref = true,
>> + .internal_vref = 0,
>> + .channels = ltc2617_channels,
>> + .num_channels = 1,
>> + .powerdown_ltc = true,
>> + },
>> + [ID_LTC2617] = {
>> + .shared_vref = true,
>> + .internal_vref = 0,
>> + .channels = ltc2617_channels,
>> + .num_channels = 2,
>> + .powerdown_ltc = true,
>> + },
>> + [ID_LTC2619] = {
>> + .shared_vref = false,
>> + .internal_vref = 0,
>> + .channels = ltc2617_channels,
>> + .num_channels = 4,
>> + .powerdown_ltc = true,
>> + },
>> + [ID_LTC2626] = {
>> + .shared_vref = true,
>> + .internal_vref = 0,
>> + .channels = ltc2627_channels,
>> + .num_channels = 1,
>> + .powerdown_ltc = true,
>> + },
>> + [ID_LTC2627] = {
>> + .shared_vref = true,
>> + .internal_vref = 0,
>> + .channels = ltc2627_channels,
>> + .num_channels = 2,
>> + .powerdown_ltc = true,
>> + },
>> + [ID_LTC2629] = {
>> + .shared_vref = false,
>> + .internal_vref = 0,
>> + .channels = ltc2627_channels,
>> + .num_channels = 4,
>> + .powerdown_ltc = true,
>> + },
>> };
>>
>> static inline unsigned int ad5064_num_vref(struct ad5064_state *st)
>> @@ -669,6 +770,15 @@ static const struct i2c_device_id ad5064_i2c_ids[] = {
>> {"ad5669-1", ID_AD5669_1},
>> {"ad5669-2", ID_AD5669_2},
>> {"ad5669-3", ID_AD5669_2}, /* similar enough to ad5669-2 */
>> + {"ltc2606", ID_LTC2606},
>> + {"ltc2607", ID_LTC2607},
>> + {"ltc2609", ID_LTC2609},
>> + {"ltc2616", ID_LTC2616},
>> + {"ltc2617", ID_LTC2617},
>> + {"ltc2619", ID_LTC2619},
>> + {"ltc2626", ID_LTC2626},
>> + {"ltc2627", ID_LTC2627},
>> + {"ltc2629", ID_LTC2629},
>> {}
>> };
>> MODULE_DEVICE_TABLE(i2c, ad5064_i2c_ids);
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-02-08 15:43 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-22 4:34 [PATCH v3 0/2] iio:ad5064: Add support for LTC2617 Marc Andre
2015-10-22 4:34 ` [PATCH v3 1/2] iio:ad5064: Structural changes to support LTC2617 Marc Andre
2015-10-25 11:14 ` Jonathan Cameron
2015-10-25 11:18 ` Jonathan Cameron
2015-10-22 4:34 ` [PATCH v3 2/2] iio:ad5064: Add support for ltc2617 and similar devices Marc Andre
2015-10-25 11:19 ` Jonathan Cameron
2016-02-08 15:34 ` Lars-Peter Clausen
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).