From: sashiko-bot@kernel.org
To: "Rodrigo Alencar" <rodrigo.alencar@analog.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v8 10/17] iio: frequency: ad9910: initial driver implementation
Date: Tue, 14 Jul 2026 12:29:46 +0000 [thread overview]
Message-ID: <20260714122946.ECAB41F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260714-ad9910-iio-driver-v8-10-36939c3c07d2@analog.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] State check in `ad9910_sw_powerdown_set` masks partial hardware failures.
- [Medium] Software state `st->data.output_current_uA` is updated before hardware write and not reverted on error.
- [Medium] The `adi,refclk-out-drive-strength` property is ignored if the PLL is disabled, preventing valid hardware configurations.
--
--- Patch [10]: [PATCH v8 10/17] iio: frequency: ad9910: initial driver implementation ---
commit fa8ede19ae75d86e6b54bd272809bde5cbcf3f66
Author: Rodrigo Alencar <rodrigo.alencar@analog.com>
Subject: iio: frequency: ad9910: initial driver implementation
Add the core AD9910 DDS driver infrastructure with single tone mode support.
This includes SPI register access, profile management via GPIO pins, PLL/DAC
configuration from firmware properties, and single tone frequency/phase/amplitude
control through IIO attributes.
> diff --git a/drivers/iio/frequency/ad9910.c b/drivers/iio/frequency/ad9910.c
> new file mode 100644
> index 0000000000000..b41b011af2812
> --- /dev/null
> +++ b/drivers/iio/frequency/ad9910.c
[ ... ]
> +static int ad9910_set_dac_current(struct ad9910_state *st, u32 val_uA,
> + bool update)
> +{
> + u32 code;
> +
> + /* FSC = (86.4 / Rset) * (1 + CODE/96) where Rset = 10k ohms */
> + val_uA = clamp(val_uA, AD9910_DAC_IOUT_MIN_uA, AD9910_DAC_IOUT_MAX_uA);
> + code = DIV_ROUND_CLOSEST(val_uA - AD9910_DAC_IOUT_MIN_uA, 90);
> + st->data.output_current_uA = AD9910_DAC_IOUT_MIN_uA + code * 90;
[Severity: Medium]
If ad9910_reg32_write() fails due to an SPI error, the hardware state isn't
updated. However, since st->data.output_current_uA was already modified, won't
subsequent reads (e.g., IIO_CHAN_INFO_SCALE) return this cached value instead
of the actual hardware configuration?
> +
> + return ad9910_reg32_write(st, AD9910_REG_AUX_DAC, code, update);
> +}
[ ... ]
> +static inline bool ad9910_sw_powerdown_get(struct ad9910_state *st)
> +{
> + return FIELD_GET(AD9910_CFR1_SW_POWER_DOWN_MSK,
> + st->reg[AD9910_REG_CFR1].val32) ? true : false;
> +}
> +
> +static int ad9910_sw_powerdown_set(struct ad9910_state *st, bool enable)
> +{
> + int ret;
> +
> + if (ad9910_sw_powerdown_get(st) == enable)
> + return 0;
[Severity: Medium]
If the previous powerdown sequence failed after writing SW1 but before writing
SW0 due to an SPI error, ad9910_sw_powerdown_get() will still return true
because one of the masked bits is set.
Will this early return prevent subsequent calls from attempting to recover and
complete the powerdown sequence?
> +
> + /*
> + * When powering down, the DAC and AUX_DAC (SW1) must be powered down
> + * first, as they require an I/O update to take effect. The opposite is
[ ... ]
> +static int ad9910_parse_fw(struct ad9910_state *st)
> +{
> + static const char * const refclk_out_drv0[] = {
> + "disabled", "low", "medium", "high",
> + };
> + struct device *dev = &st->spi->dev;
> + const char *prop;
> + u32 tmp;
> + int ret;
> +
> + st->data.pll_enabled = device_property_read_bool(dev, "adi,pll-enable");
> + if (st->data.pll_enabled) {
> + prop = "adi,charge-pump-current-microamp";
> + if (device_property_present(dev, prop)) {
> + ret = device_property_read_u32(dev, prop, &tmp);
> + if (ret)
> + return dev_err_probe(dev, ret, "property read: %s\n", prop);
> +
> + if (tmp < AD9910_ICP_MIN_uA || tmp > AD9910_ICP_MAX_uA)
> + return dev_err_probe(dev, -ERANGE,
> + "invalid charge pump current %u\n", tmp);
> + } else {
> + tmp = AD9910_ICP_MIN_uA;
> + }
> + st->data.pll_charge_pump_current = tmp;
> +
> + prop = "adi,refclk-out-drive-strength";
> + if (device_property_present(dev, prop)) {
[Severity: Medium]
Is it intentional that adi,refclk-out-drive-strength is only parsed when the
PLL is enabled?
The hardware appears to support routing and buffering the reference clock
output regardless of whether the internal PLL is enabled. If a device tree
omits adi,pll-enable but provides adi,refclk-out-drive-strength, won't this
property be ignored entirely?
> + ret = device_property_match_property_string(dev, prop,
> + refclk_out_drv0,
> + ARRAY_SIZE(refclk_out_drv0));
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260714-ad9910-iio-driver-v8-0-36939c3c07d2@analog.com?part=10
next prev parent reply other threads:[~2026-07-14 12:29 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 11:02 [PATCH v8 00/17] AD9910 Direct Digital Synthesizer Rodrigo Alencar via B4 Relay
2026-07-14 11:02 ` [PATCH v8 01/17] iio: ABI: add attributes for altcurrent channels Rodrigo Alencar via B4 Relay
2026-07-14 11:14 ` sashiko-bot
2026-07-14 11:02 ` [PATCH v8 02/17] iio: ABI: raw, scale and offset for frequency/phase channels Rodrigo Alencar via B4 Relay
2026-07-14 11:25 ` sashiko-bot
2026-07-14 11:02 ` [PATCH v8 03/17] iio: ABI: add parent entry for iio channels Rodrigo Alencar via B4 Relay
2026-07-14 11:02 ` [PATCH v8 04/17] iio: add IIO_FREQUENCY channel type Rodrigo Alencar via B4 Relay
2026-07-14 11:02 ` [PATCH v8 05/17] iio: core: support 64-bit register through debugfs Rodrigo Alencar via B4 Relay
2026-07-14 11:02 ` [PATCH v8 06/17] iio: core: create local __iio_chan_prefix_emit() for reuse Rodrigo Alencar via B4 Relay
2026-07-14 11:46 ` Andy Shevchenko
2026-07-14 11:02 ` [PATCH v8 07/17] iio: test: add kunit tests for channel prefix naming generation Rodrigo Alencar via B4 Relay
2026-07-14 12:12 ` sashiko-bot
2026-07-14 11:02 ` [PATCH v8 08/17] iio: core: add hierarchical channel relationships Rodrigo Alencar via B4 Relay
2026-07-14 11:02 ` [PATCH v8 09/17] dt-bindings: iio: frequency: add ad9910 Rodrigo Alencar via B4 Relay
2026-07-14 11:02 ` [PATCH v8 10/17] iio: frequency: ad9910: initial driver implementation Rodrigo Alencar via B4 Relay
2026-07-14 12:29 ` sashiko-bot [this message]
2026-07-14 11:02 ` [PATCH v8 11/17] iio: frequency: ad9910: add basic parallel port support Rodrigo Alencar via B4 Relay
2026-07-14 11:02 ` [PATCH v8 12/17] iio: frequency: ad9910: add digital ramp generator support Rodrigo Alencar via B4 Relay
2026-07-14 11:02 ` [PATCH v8 13/17] iio: frequency: ad9910: add RAM mode support Rodrigo Alencar via B4 Relay
2026-07-14 13:17 ` sashiko-bot
2026-07-14 11:02 ` [PATCH v8 14/17] iio: frequency: ad9910: add output shift keying support Rodrigo Alencar via B4 Relay
2026-07-14 11:02 ` [PATCH v8 15/17] iio: frequency: ad9910: show channel priority in debugfs Rodrigo Alencar via B4 Relay
2026-07-14 11:02 ` [PATCH v8 16/17] iio: ABI: add docs for ad9910 sysfs and debugfs entries Rodrigo Alencar via B4 Relay
2026-07-14 11:02 ` [PATCH v8 17/17] docs: iio: add documentation for ad9910 driver Rodrigo Alencar via B4 Relay
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=20260714122946.ECAB41F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=rodrigo.alencar@analog.com \
--cc=sashiko-reviews@lists.linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox