From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Janani Sunil <janani.sunil@analog.com>
Cc: "Lars-Peter Clausen" <lars@metafoo.de>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Philipp Zabel" <p.zabel@pengutronix.de>,
"Jonathan Corbet" <corbet@lwn.net>,
"Shuah Khan" <skhan@linuxfoundation.org>,
"Mark Brown" <broonie@kernel.org>,
"Marius Cristea" <marius.cristea@microchip.com>,
"Marcus Folkesson" <marcus.folkesson@gmail.com>,
"Kent Gustavsson" <kent@minoris.se>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
"Janani Sunil" <jan.sun97@gmail.com>,
linux-spi@vger.kernel.org, "Kent Gustavsson" <nedo80@gmail.com>
Subject: Re: [PATCH v6 5/5] iio: dac: Add AD5529R DAC driver support
Date: Wed, 30 Sep 2026 12:17:16 +0300 [thread overview]
Message-ID: <arzTnOTaL97GudZM@ashevche-desk.local> (raw)
In-Reply-To: <20260715-ad5529r-driver-v6-5-cfdf8b9f5ee3@analog.com>
On Wed, Jul 15, 2026 at 01:41:08PM +0200, Janani Sunil wrote:
> Add support for AD5529R 16-channel, 12/16 bit Digital to Analog Converter
> from Analog Devices.
>
> The device communicates over SPI and supports per-channel output range
> configuration. An optional external 4.096V reference can be used in
> place of the internal reference.
You haven't added a given tag, why?
In any case I have noticed that there are a number of (not so critical) issues
are still exists, so I have to withdraw my tag. But please, answer the above Q.
...
> +#include <linux/array_size.h>
> +#include <linux/bits.h>
> +#include <linux/delay.h>
> +#include <linux/dev_printk.h>
> +#include <linux/err.h>
> +#include <linux/errno.h>
The second one is not needed in this case.
> +#include <linux/iio/iio.h>
> +#include <linux/mod_devicetable.h>
No new code with this header. Uwe did some rework WRT this header.
> +#include <linux/module.h>
> +#include <linux/property.h>
> +#include <linux/regmap.h>
> +#include <linux/regulator/consumer.h>
> +#include <linux/reset.h>
> +#include <linux/spi/spi.h>
> +#include <linux/types.h>
> +#include <linux/units.h>
...
> +#define AD5529R_REG_INTERFACE_CONFIG_A 0x00
Use fixed-width values for all register offsets, e.g., here 0x000.
...
> +#define AD5529R_SPI_READ_FLAG 0x80
Isn't this a default in regmap SPI? Just asking, I don't remember by heart
the answer.
...
> +#define AD5529R_DAC_CHANNEL(chan) ((struct iio_chan_spec) { \
> + .type = IIO_VOLTAGE, \
> + .indexed = 1, \
> + .output = 1, \
> + .channel = (chan), \
> + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
> + BIT(IIO_CHAN_INFO_SCALE) | \
> + BIT(IIO_CHAN_INFO_OFFSET), \
> +})
Please, remove unneeded (outer) parentheses.
...
> +struct ad5529r_state {
> + struct spi_device *spi;
Not used. And the device pointer may be derived from regmap, so drop this.
> + const struct ad5529r_model_data *model_data;
> + struct regmap *regmap_8bit;
> + struct regmap *regmap_16bit;
> + struct iio_chan_spec channels[16];
> + unsigned int num_channels;
> + enum ad5529r_output_range output_range_idx[16];
> +};
...
> +static int ad5529r_reset(struct ad5529r_state *st)
> +{
So, basically here you can
struct regmap *map = ad5529r_get_regmap(st, AD5529R_REG_INTERFACE_CONFIG_A);
struct device *dev = regmap_get_device(regmap);
> + struct reset_control *rst;
> + int ret;
> +
> + rst = devm_reset_control_get_optional_exclusive(&st->spi->dev, NULL);
> + if (IS_ERR(rst))
> + return PTR_ERR(rst);
> +
> + if (rst) {
> + ret = reset_control_assert(rst);
> + if (ret)
> + return ret;
> +
> + ret = reset_control_deassert(rst);
> + if (ret)
> + return ret;
> + } else {
> + ret = regmap_write(st->regmap_8bit, AD5529R_REG_INTERFACE_CONFIG_A,
> + AD5529R_INTERFACE_CONFIG_A_SW_RESET);
> + if (ret)
> + return ret;
> + }
> +
> + /*
> + * Wait 10 ms for digital initialization to complete.
> + * Per datasheet, Interface Status A register NOT_READY_ERR bit is
> + * set if SPI transactions are attempted before digital initialization
> + * completes.
> + */
> + fsleep(10 * USEC_PER_MSEC);
> +
> + return regmap_write(st->regmap_8bit, AD5529R_REG_INTERFACE_CONFIG_A,
> + AD5529R_INTERFACE_CONFIG_A_SDO_ENABLE |
> + AD5529R_INTERFACE_CONFIG_A_ADDR_ASCENSION);
> +}
...
This is an unfinished review of some old submission. If anything, please check
it and update the driver either in a new round or consider followups.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-09-30 9:17 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 11:41 [PATCH v6 0/5] iio: dac: Add support for AD5529R DAC Janani Sunil
2026-07-15 11:41 ` [PATCH v6 1/5] spi: dt-bindings: Add spi-device-addr peripheral property Janani Sunil
2026-07-15 11:48 ` sashiko-bot
2026-07-15 13:09 ` Mark Brown
2026-07-15 13:29 ` Nuno Sá
2026-07-15 13:37 ` Mark Brown
2026-07-16 9:22 ` Nuno Sá
2026-07-16 12:28 ` Mark Brown
2026-07-16 17:06 ` Conor Dooley
2026-07-17 11:51 ` Mark Brown
2026-07-17 13:52 ` Nuno Sá
2026-07-19 2:10 ` Jonathan Cameron
2026-07-15 11:41 ` [PATCH v6 2/5] dt-bindings: iio: adc: microchip,mcp3564: Add spi-device-addr Janani Sunil
2026-07-15 11:50 ` sashiko-bot
2026-07-19 2:07 ` Jonathan Cameron
2026-07-15 11:41 ` [PATCH v6 3/5] dt-bindings: iio: adc: microchip,mcp3911: " Janani Sunil
2026-07-15 11:52 ` sashiko-bot
2026-07-19 2:08 ` Jonathan Cameron
2026-07-15 11:41 ` [PATCH v6 4/5] dt-bindings: iio: dac: Add AD5529R Janani Sunil
2026-07-15 11:52 ` sashiko-bot
2026-07-15 11:41 ` [PATCH v6 5/5] iio: dac: Add AD5529R DAC driver support Janani Sunil
2026-07-15 11:52 ` sashiko-bot
2026-07-15 22:22 ` Uwe Kleine-König
2026-07-19 2:19 ` Jonathan Cameron
2026-09-30 9:17 ` Andy Shevchenko [this message]
2026-09-30 13:51 ` Janani Sunil
2026-09-30 14:04 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=arzTnOTaL97GudZM@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jan.sun97@gmail.com \
--cc=janani.sunil@analog.com \
--cc=jic23@kernel.org \
--cc=kent@minoris.se \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-doc@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=marcus.folkesson@gmail.com \
--cc=marius.cristea@microchip.com \
--cc=nedo80@gmail.com \
--cc=nuno.sa@analog.com \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=skhan@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.