* iio:ad5064: Add support for LTC2617
@ 2015-10-15 9:12 Marc Andre
2015-10-15 9:12 ` [PATCH 1/2] iio:ad5064: Add support for ltc2617 and similar devices Marc Andre
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Marc Andre @ 2015-10-15 9:12 UTC (permalink / raw)
To: jic23; +Cc: knaack.h, lars, pmeerw, linux-iio, marc.andre
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.
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
Best regards,
Marc
[PATCH 1/2] iio:ad5064: Add support for ltc2617 and similar devices
[PATCH 2/2] iio:ad5064: Fix power down operation with LTC2617
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/2] iio:ad5064: Add support for ltc2617 and similar devices
2015-10-15 9:12 iio:ad5064: Add support for LTC2617 Marc Andre
@ 2015-10-15 9:12 ` Marc Andre
2015-10-15 9:12 ` [PATCH 2/2] iio:ad5064: Fix power down operation with LTC2617 Marc Andre
2015-10-15 10:30 ` iio:ad5064: Add support for LTC2617 Daniel Baluta
2 siblings, 0 replies; 10+ messages in thread
From: Marc Andre @ 2015-10-15 9:12 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 basic support for those devices.
Signed-off-by: Marc Andre <marc.andre@netline.ch>
---
drivers/iio/dac/ad5064.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 76 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
index 978f130..a76f4cf 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.
*
@@ -123,6 +125,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,
@@ -339,6 +350,7 @@ static DECLARE_AD5065_CHANNELS(ad5045_channels, 14, 6);
static DECLARE_AD5065_CHANNELS(ad5065_channels, 16, 4);
static DECLARE_AD5064_CHANNELS(ad5629_channels, 12, 4);
+static DECLARE_AD5064_CHANNELS(ltc2617_channels, 14, 2);
static DECLARE_AD5064_CHANNELS(ad5669_channels, 16, 0);
static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {
@@ -449,6 +461,60 @@ 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 = ad5669_channels,
+ .num_channels = 1,
+ },
+ [ID_LTC2607] = {
+ .shared_vref = true,
+ .internal_vref = 0,
+ .channels = ad5669_channels,
+ .num_channels = 2,
+ },
+ [ID_LTC2609] = {
+ .shared_vref = false,
+ .internal_vref = 0,
+ .channels = ad5669_channels,
+ .num_channels = 4,
+ },
+ [ID_LTC2616] = {
+ .shared_vref = true,
+ .internal_vref = 0,
+ .channels = ltc2617_channels,
+ .num_channels = 1,
+ },
+ [ID_LTC2617] = {
+ .shared_vref = true,
+ .internal_vref = 0,
+ .channels = ltc2617_channels,
+ .num_channels = 2,
+ },
+ [ID_LTC2619] = {
+ .shared_vref = false,
+ .internal_vref = 0,
+ .channels = ltc2617_channels,
+ .num_channels = 4,
+ },
+ [ID_LTC2626] = {
+ .shared_vref = true,
+ .internal_vref = 0,
+ .channels = ad5629_channels,
+ .num_channels = 1,
+ },
+ [ID_LTC2627] = {
+ .shared_vref = true,
+ .internal_vref = 0,
+ .channels = ad5629_channels,
+ .num_channels = 2,
+ },
+ [ID_LTC2629] = {
+ .shared_vref = false,
+ .internal_vref = 0,
+ .channels = ad5629_channels,
+ .num_channels = 4,
+ },
};
static inline unsigned int ad5064_num_vref(struct ad5064_state *st)
@@ -660,6 +726,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] 10+ messages in thread
* [PATCH 2/2] iio:ad5064: Fix power down operation with LTC2617
2015-10-15 9:12 iio:ad5064: Add support for LTC2617 Marc Andre
2015-10-15 9:12 ` [PATCH 1/2] iio:ad5064: Add support for ltc2617 and similar devices Marc Andre
@ 2015-10-15 9:12 ` Marc Andre
2015-10-15 10:27 ` Peter Meerwald
2015-10-15 10:30 ` iio:ad5064: Add support for LTC2617 Daniel Baluta
2 siblings, 1 reply; 10+ messages in thread
From: Marc Andre @ 2015-10-15 9:12 UTC (permalink / raw)
To: jic23; +Cc: knaack.h, lars, pmeerw, linux-iio, marc.andre
LTC2617 device (and the other devices from Linear Technology) have
a different behavior for power down than the Analog Device devices.
The command must be addressed with the right channel address. Also,
only a single power down mode (90k to ground) is available.
This patch adjusts the driver to handle the LTC case specifically.
I decided to implement the different power down modes as a
separate iio_ext_info structure. An alternative implementation
would be to set the iio_ext_info structure not const
and then adjust the enum in the probe() function based on a
chip_info setting. In my view this would be less ideal because
it uses more memory for the kernel.
The different addressing is handled with a flag in the chip_info
structure. Alternatively we could implement a copy of all
set_powerdown_...() functions. I think this is less nice.
Signed-off-by: Marc Andre <marc.andre@netline.ch>
---
drivers/iio/dac/ad5064.c | 120 ++++++++++++++++++++++++++++++++---------------
1 file changed, 82 insertions(+), 38 deletions(-)
diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
index a76f4cf..1b89625 100644
--- a/drivers/iio/dac/ad5064.c
+++ b/drivers/iio/dac/ad5064.c
@@ -1,8 +1,8 @@
/*
* AD5024, AD5025, AD5044, AD5045, AD5064, AD5064-1, AD5065, AD5628, AD5629R,
* AD5648, AD5666, AD5668, AD5669R, LTC2606, LTC2607, LTC2609, LTC2616,
- * LTC2617, LTC2619, LTC2626, LTC2627, LTC2629
- * Digital to analog converters driver
+ * LTC2617, LTC2619, LTC2626, LTC2627, LTC2629 Digital to analog converters
+ * driver
*
* Copyright 2011 Analog Devices Inc.
*
@@ -52,10 +52,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 {
@@ -63,6 +65,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;
@@ -147,15 +150,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;
}
@@ -166,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)
{
@@ -196,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)
{
@@ -306,7 +326,19 @@ static const struct iio_chan_spec_ext_info ad5064_ext_info[] = {
{ },
};
-#define AD5064_CHANNEL(chan, addr, bits, _shift) { \
+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, \
.output = 1, \
@@ -320,38 +352,41 @@ 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, 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_AD5065_CHANNELS(ad5025_channels, 12, 8);
-static DECLARE_AD5065_CHANNELS(ad5045_channels, 14, 6);
-static DECLARE_AD5065_CHANNELS(ad5065_channels, 16, 4);
+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(ad5629_channels, 12, 4);
-static DECLARE_AD5064_CHANNELS(ltc2617_channels, 14, 2);
-static DECLARE_AD5064_CHANNELS(ad5669_channels, 16, 0);
+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] = {
@@ -464,56 +499,65 @@ static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {
[ID_LTC2606] = {
.shared_vref = true,
.internal_vref = 0,
- .channels = ad5669_channels,
+ .channels = ltc2607_channels,
.num_channels = 1,
+ .powerdown_ltc = true,
},
[ID_LTC2607] = {
.shared_vref = true,
.internal_vref = 0,
- .channels = ad5669_channels,
+ .channels = ltc2607_channels,
.num_channels = 2,
+ .powerdown_ltc = true,
},
[ID_LTC2609] = {
.shared_vref = false,
.internal_vref = 0,
- .channels = ad5669_channels,
+ .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 = ad5629_channels,
+ .channels = ltc2627_channels,
.num_channels = 1,
+ .powerdown_ltc = true,
},
[ID_LTC2627] = {
.shared_vref = true,
.internal_vref = 0,
- .channels = ad5629_channels,
+ .channels = ltc2627_channels,
.num_channels = 2,
+ .powerdown_ltc = true,
},
[ID_LTC2629] = {
.shared_vref = false,
.internal_vref = 0,
- .channels = ad5629_channels,
+ .channels = ltc2627_channels,
.num_channels = 4,
+ .powerdown_ltc = true,
},
};
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] iio:ad5064: Fix power down operation with LTC2617
2015-10-15 9:12 ` [PATCH 2/2] iio:ad5064: Fix power down operation with LTC2617 Marc Andre
@ 2015-10-15 10:27 ` Peter Meerwald
0 siblings, 0 replies; 10+ messages in thread
From: Peter Meerwald @ 2015-10-15 10:27 UTC (permalink / raw)
To: Marc Andre; +Cc: jic23, knaack.h, lars, linux-iio
On Thu, 15 Oct 2015, Marc Andre wrote:
> LTC2617 device (and the other devices from Linear Technology) have
> a different behavior for power down than the Analog Device devices.
> The command must be addressed with the right channel address. Also,
> only a single power down mode (90k to ground) is available.
please update Documentation/ABI/testing/sysfs-bus-iio for the 90k_to_gnd
mode, out_voltageY_powerdown_mode
> This patch adjusts the driver to handle the LTC case specifically.
>
> I decided to implement the different power down modes as a
> separate iio_ext_info structure. An alternative implementation
> would be to set the iio_ext_info structure not const
> and then adjust the enum in the probe() function based on a
> chip_info setting. In my view this would be less ideal because
> it uses more memory for the kernel.
>
> The different addressing is handled with a flag in the chip_info
> structure. Alternatively we could implement a copy of all
> set_powerdown_...() functions. I think this is less nice.
>
> Signed-off-by: Marc Andre <marc.andre@netline.ch>
> ---
> drivers/iio/dac/ad5064.c | 120 ++++++++++++++++++++++++++++++++---------------
> 1 file changed, 82 insertions(+), 38 deletions(-)
>
> diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
> index a76f4cf..1b89625 100644
> --- a/drivers/iio/dac/ad5064.c
> +++ b/drivers/iio/dac/ad5064.c
> @@ -1,8 +1,8 @@
> /*
> * AD5024, AD5025, AD5044, AD5045, AD5064, AD5064-1, AD5065, AD5628, AD5629R,
> * AD5648, AD5666, AD5668, AD5669R, LTC2606, LTC2607, LTC2609, LTC2616,
> - * LTC2617, LTC2619, LTC2626, LTC2627, LTC2629
> - * Digital to analog converters driver
> + * LTC2617, LTC2619, LTC2626, LTC2627, LTC2629 Digital to analog converters
> + * driver
> *
> * Copyright 2011 Analog Devices Inc.
> *
> @@ -52,10 +52,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 {
> @@ -63,6 +65,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;
> @@ -147,15 +150,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;
> }
> @@ -166,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)
> {
> @@ -196,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)
> {
> @@ -306,7 +326,19 @@ static const struct iio_chan_spec_ext_info ad5064_ext_info[] = {
> { },
> };
>
> -#define AD5064_CHANNEL(chan, addr, bits, _shift) { \
> +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, \
> .output = 1, \
> @@ -320,38 +352,41 @@ 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, 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_AD5065_CHANNELS(ad5025_channels, 12, 8);
> -static DECLARE_AD5065_CHANNELS(ad5045_channels, 14, 6);
> -static DECLARE_AD5065_CHANNELS(ad5065_channels, 16, 4);
> +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(ad5629_channels, 12, 4);
> -static DECLARE_AD5064_CHANNELS(ltc2617_channels, 14, 2);
> -static DECLARE_AD5064_CHANNELS(ad5669_channels, 16, 0);
> +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] = {
> @@ -464,56 +499,65 @@ static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {
> [ID_LTC2606] = {
> .shared_vref = true,
> .internal_vref = 0,
> - .channels = ad5669_channels,
> + .channels = ltc2607_channels,
> .num_channels = 1,
> + .powerdown_ltc = true,
> },
> [ID_LTC2607] = {
> .shared_vref = true,
> .internal_vref = 0,
> - .channels = ad5669_channels,
> + .channels = ltc2607_channels,
> .num_channels = 2,
> + .powerdown_ltc = true,
> },
> [ID_LTC2609] = {
> .shared_vref = false,
> .internal_vref = 0,
> - .channels = ad5669_channels,
> + .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 = ad5629_channels,
> + .channels = ltc2627_channels,
> .num_channels = 1,
> + .powerdown_ltc = true,
> },
> [ID_LTC2627] = {
> .shared_vref = true,
> .internal_vref = 0,
> - .channels = ad5629_channels,
> + .channels = ltc2627_channels,
> .num_channels = 2,
> + .powerdown_ltc = true,
> },
> [ID_LTC2629] = {
> .shared_vref = false,
> .internal_vref = 0,
> - .channels = ad5629_channels,
> + .channels = ltc2627_channels,
> .num_channels = 4,
> + .powerdown_ltc = true,
> },
> };
>
>
--
Peter Meerwald
+43-664-2444418 (mobile)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: iio:ad5064: Add support for LTC2617
2015-10-15 9:12 iio:ad5064: Add support for LTC2617 Marc Andre
2015-10-15 9:12 ` [PATCH 1/2] iio:ad5064: Add support for ltc2617 and similar devices Marc Andre
2015-10-15 9:12 ` [PATCH 2/2] iio:ad5064: Fix power down operation with LTC2617 Marc Andre
@ 2015-10-15 10:30 ` Daniel Baluta
2015-10-15 12:31 ` Marc Andre
2 siblings, 1 reply; 10+ messages in thread
From: Daniel Baluta @ 2015-10-15 10:30 UTC (permalink / raw)
To: Marc Andre
Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
Peter Meerwald, linux-iio@vger.kernel.org
On Thu, Oct 15, 2015 at 12:12 PM, Marc Andre <marc.andre@netline.ch> wrote:
> 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.
>
> 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
Please add this links to the commit message of 1/2 patch. Cover
letter will most likely be lost in the linux-iio list archives.
^ permalink raw reply [flat|nested] 10+ messages in thread
* iio:ad5064: Add support for LTC2617
2015-10-15 10:30 ` iio:ad5064: Add support for LTC2617 Daniel Baluta
@ 2015-10-15 12:31 ` Marc Andre
2015-10-15 12:31 ` [PATCH v2 1/2] iio:ad5064: Add support for ltc2617 and similar devices Marc Andre
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Marc Andre @ 2015-10-15 12:31 UTC (permalink / raw)
To: jic23; +Cc: knaack.h, lars, pmeerw, linux-iio, marc.andre
I've updated the patches according to the feedback of Peter and Daniel.
- Added datasheet links to the description of patch 1/2.
- Added 90kohm_to_gnd to ABI documentation sysfs-bus-iio
**** 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 v2 1/2] iio:ad5064: Add support for ltc2617 and similar devices
[PATCH v2 2/2] iio:ad5064: Fix power down operation with LTC2617
Best Regards,
Marc
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/2] iio:ad5064: Add support for ltc2617 and similar devices
2015-10-15 12:31 ` Marc Andre
@ 2015-10-15 12:31 ` Marc Andre
2015-10-15 12:31 ` [PATCH v2 2/2] iio:ad5064: Fix power down operation with LTC2617 Marc Andre
2015-10-19 11:17 ` iio:ad5064: Add support for LTC2617 Lars-Peter Clausen
2 siblings, 0 replies; 10+ messages in thread
From: Marc Andre @ 2015-10-15 12:31 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 basic 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>
---
drivers/iio/dac/ad5064.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 76 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
index 978f130..a76f4cf 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.
*
@@ -123,6 +125,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,
@@ -339,6 +350,7 @@ static DECLARE_AD5065_CHANNELS(ad5045_channels, 14, 6);
static DECLARE_AD5065_CHANNELS(ad5065_channels, 16, 4);
static DECLARE_AD5064_CHANNELS(ad5629_channels, 12, 4);
+static DECLARE_AD5064_CHANNELS(ltc2617_channels, 14, 2);
static DECLARE_AD5064_CHANNELS(ad5669_channels, 16, 0);
static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {
@@ -449,6 +461,60 @@ 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 = ad5669_channels,
+ .num_channels = 1,
+ },
+ [ID_LTC2607] = {
+ .shared_vref = true,
+ .internal_vref = 0,
+ .channels = ad5669_channels,
+ .num_channels = 2,
+ },
+ [ID_LTC2609] = {
+ .shared_vref = false,
+ .internal_vref = 0,
+ .channels = ad5669_channels,
+ .num_channels = 4,
+ },
+ [ID_LTC2616] = {
+ .shared_vref = true,
+ .internal_vref = 0,
+ .channels = ltc2617_channels,
+ .num_channels = 1,
+ },
+ [ID_LTC2617] = {
+ .shared_vref = true,
+ .internal_vref = 0,
+ .channels = ltc2617_channels,
+ .num_channels = 2,
+ },
+ [ID_LTC2619] = {
+ .shared_vref = false,
+ .internal_vref = 0,
+ .channels = ltc2617_channels,
+ .num_channels = 4,
+ },
+ [ID_LTC2626] = {
+ .shared_vref = true,
+ .internal_vref = 0,
+ .channels = ad5629_channels,
+ .num_channels = 1,
+ },
+ [ID_LTC2627] = {
+ .shared_vref = true,
+ .internal_vref = 0,
+ .channels = ad5629_channels,
+ .num_channels = 2,
+ },
+ [ID_LTC2629] = {
+ .shared_vref = false,
+ .internal_vref = 0,
+ .channels = ad5629_channels,
+ .num_channels = 4,
+ },
};
static inline unsigned int ad5064_num_vref(struct ad5064_state *st)
@@ -660,6 +726,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] 10+ messages in thread
* [PATCH v2 2/2] iio:ad5064: Fix power down operation with LTC2617
2015-10-15 12:31 ` Marc Andre
2015-10-15 12:31 ` [PATCH v2 1/2] iio:ad5064: Add support for ltc2617 and similar devices Marc Andre
@ 2015-10-15 12:31 ` Marc Andre
2015-10-19 11:17 ` iio:ad5064: Add support for LTC2617 Lars-Peter Clausen
2 siblings, 0 replies; 10+ messages in thread
From: Marc Andre @ 2015-10-15 12:31 UTC (permalink / raw)
To: jic23; +Cc: knaack.h, lars, pmeerw, linux-iio, marc.andre
LTC2617 device (and the other devices from Linear Technology) have
a different behavior for power down than the Analog Device devices.
The command must be addressed with the right channel address. Also,
only a single power down mode (90k to ground) is available.
This patch adjusts the driver to handle the LTC case specifically.
I decided to implement the different power down modes as a
separate iio_ext_info structure. An alternative implementation
would be to set the iio_ext_info structure not const
and then adjust the enum in the probe() function based on a
chip_info setting. In my view this would be less ideal because
it uses more memory for the kernel.
The different addressing is handled with a flag in the chip_info
structure. Alternatively we could implement a copy of all
set_powerdown_...() functions. I think this is less nice.
I've added the new setting 90kohm_to_gnd to the ABI sysfs-bus-iio
documentation.
Signed-off-by: Marc Andre <marc.andre@netline.ch>
---
Documentation/ABI/testing/sysfs-bus-iio | 1 +
drivers/iio/dac/ad5064.c | 120 ++++++++++++++++++++++----------
2 files changed, 83 insertions(+), 38 deletions(-)
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 a76f4cf..1b89625 100644
--- a/drivers/iio/dac/ad5064.c
+++ b/drivers/iio/dac/ad5064.c
@@ -1,8 +1,8 @@
/*
* AD5024, AD5025, AD5044, AD5045, AD5064, AD5064-1, AD5065, AD5628, AD5629R,
* AD5648, AD5666, AD5668, AD5669R, LTC2606, LTC2607, LTC2609, LTC2616,
- * LTC2617, LTC2619, LTC2626, LTC2627, LTC2629
- * Digital to analog converters driver
+ * LTC2617, LTC2619, LTC2626, LTC2627, LTC2629 Digital to analog converters
+ * driver
*
* Copyright 2011 Analog Devices Inc.
*
@@ -52,10 +52,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 {
@@ -63,6 +65,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;
@@ -147,15 +150,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;
}
@@ -166,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)
{
@@ -196,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)
{
@@ -306,7 +326,19 @@ static const struct iio_chan_spec_ext_info ad5064_ext_info[] = {
{ },
};
-#define AD5064_CHANNEL(chan, addr, bits, _shift) { \
+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, \
.output = 1, \
@@ -320,38 +352,41 @@ 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, 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_AD5065_CHANNELS(ad5025_channels, 12, 8);
-static DECLARE_AD5065_CHANNELS(ad5045_channels, 14, 6);
-static DECLARE_AD5065_CHANNELS(ad5065_channels, 16, 4);
+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(ad5629_channels, 12, 4);
-static DECLARE_AD5064_CHANNELS(ltc2617_channels, 14, 2);
-static DECLARE_AD5064_CHANNELS(ad5669_channels, 16, 0);
+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] = {
@@ -464,56 +499,65 @@ static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {
[ID_LTC2606] = {
.shared_vref = true,
.internal_vref = 0,
- .channels = ad5669_channels,
+ .channels = ltc2607_channels,
.num_channels = 1,
+ .powerdown_ltc = true,
},
[ID_LTC2607] = {
.shared_vref = true,
.internal_vref = 0,
- .channels = ad5669_channels,
+ .channels = ltc2607_channels,
.num_channels = 2,
+ .powerdown_ltc = true,
},
[ID_LTC2609] = {
.shared_vref = false,
.internal_vref = 0,
- .channels = ad5669_channels,
+ .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 = ad5629_channels,
+ .channels = ltc2627_channels,
.num_channels = 1,
+ .powerdown_ltc = true,
},
[ID_LTC2627] = {
.shared_vref = true,
.internal_vref = 0,
- .channels = ad5629_channels,
+ .channels = ltc2627_channels,
.num_channels = 2,
+ .powerdown_ltc = true,
},
[ID_LTC2629] = {
.shared_vref = false,
.internal_vref = 0,
- .channels = ad5629_channels,
+ .channels = ltc2627_channels,
.num_channels = 4,
+ .powerdown_ltc = true,
},
};
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: iio:ad5064: Add support for LTC2617
2015-10-15 12:31 ` Marc Andre
2015-10-15 12:31 ` [PATCH v2 1/2] iio:ad5064: Add support for ltc2617 and similar devices Marc Andre
2015-10-15 12:31 ` [PATCH v2 2/2] iio:ad5064: Fix power down operation with LTC2617 Marc Andre
@ 2015-10-19 11:17 ` Lars-Peter Clausen
2015-10-20 5:59 ` Marc Andre
2 siblings, 1 reply; 10+ messages in thread
From: Lars-Peter Clausen @ 2015-10-19 11:17 UTC (permalink / raw)
To: Marc Andre, jic23; +Cc: knaack.h, pmeerw, linux-iio
On 10/15/2015 02:31 PM, Marc Andre wrote:
> I've updated the patches according to the feedback of Peter and Daniel.
> - Added datasheet links to the description of patch 1/2.
> - Added 90kohm_to_gnd to ABI documentation sysfs-bus-iio
>
Looks good to me. You can add
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
I'd prefer though if you change the order of the patches. Patch 1 refactor
the macros so you can specify the ext_info. Patch 2 add support for the LTC
devices, this way we don't end up with a intermediate step where power-down
is broken.
Another thing, if you send a new version of a patch series, don't send it as
a response to the old series. Things tend to get lost that way in nested
threads.
> **** 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 v2 1/2] iio:ad5064: Add support for ltc2617 and similar devices
> [PATCH v2 2/2] iio:ad5064: Fix power down operation with LTC2617
>
> Best Regards,
> Marc
> --
> 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] 10+ messages in thread
* Re: iio:ad5064: Add support for LTC2617
2015-10-19 11:17 ` iio:ad5064: Add support for LTC2617 Lars-Peter Clausen
@ 2015-10-20 5:59 ` Marc Andre
0 siblings, 0 replies; 10+ messages in thread
From: Marc Andre @ 2015-10-20 5:59 UTC (permalink / raw)
To: Lars-Peter Clausen, jic23; +Cc: knaack.h, pmeerw, linux-iio
On 19.10.2015 13:17, Lars-Peter Clausen wrote:
> On 10/15/2015 02:31 PM, Marc Andre wrote:
>> I've updated the patches according to the feedback of Peter and Daniel.
>> - Added datasheet links to the description of patch 1/2.
>> - Added 90kohm_to_gnd to ABI documentation sysfs-bus-iio
>>
> Looks good to me. You can add
>
> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
>
> I'd prefer though if you change the order of the patches. Patch 1 refactor
> the macros so you can specify the ext_info. Patch 2 add support for the LTC
> devices, this way we don't end up with a intermediate step where power-down
> is broken.
I will do that, but I am currently traveling on a business trip, I will
send it towards the end of the week. I assume I can put the Acked-by on
as long as the code doesn't change.
>> **** 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 v2 1/2] iio:ad5064: Add support for ltc2617 and similar devices
>> [PATCH v2 2/2] iio:ad5064: Fix power down operation with LTC2617
>>
>> Best Regards,
>> Marc
>> --
>> 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
>>
> --
> 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
--
Marc André, André-Netline
eBusiness-Solutions
André-Netline
Könizstr. 161
CH-3097 Liebefeld
Tel. 031 974 16 66
Fax: 031 974 16 65
marc.andre@netline.ch
http://www.netline.ch
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-10-20 5:59 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-15 9:12 iio:ad5064: Add support for LTC2617 Marc Andre
2015-10-15 9:12 ` [PATCH 1/2] iio:ad5064: Add support for ltc2617 and similar devices Marc Andre
2015-10-15 9:12 ` [PATCH 2/2] iio:ad5064: Fix power down operation with LTC2617 Marc Andre
2015-10-15 10:27 ` Peter Meerwald
2015-10-15 10:30 ` iio:ad5064: Add support for LTC2617 Daniel Baluta
2015-10-15 12:31 ` Marc Andre
2015-10-15 12:31 ` [PATCH v2 1/2] iio:ad5064: Add support for ltc2617 and similar devices Marc Andre
2015-10-15 12:31 ` [PATCH v2 2/2] iio:ad5064: Fix power down operation with LTC2617 Marc Andre
2015-10-19 11:17 ` iio:ad5064: Add support for LTC2617 Lars-Peter Clausen
2015-10-20 5:59 ` Marc Andre
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).