From: sashiko-bot@kernel.org
To: "Antoniu Miclaus" <antoniu.miclaus@analog.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 3/4] iio: adc: ade9000: add support for ADE9430
Date: Mon, 07 Sep 2026 10:26:59 +0000 [thread overview]
Message-ID: <20260907102659.DD0761F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260907101623.8730-4-antoniu.miclaus@analog.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The ADE9000_REG_DICOEFF configuration register is written after the DSP has been started, violating initialization requirements for existing devices.
- [Medium] The ADE9430 full-scale ADC codes are identical to the ADE9000 codes, contradicting the commit message claim that they are different.
--
commit 95855f12cd746ba14c4e360029b507dc042d8327
Author: Antoniu Miclaus <antoniu.miclaus@analog.com>
iio: adc: ade9000: add support for ADE9430
This commit adds support for the ADE9430, noting it is register compatible
with the ADE9000 but lacks the on-chip digital integrator and has slightly
different full-scale ADC codes.
> The ADE9430 is a polyphase energy metering device that is register
> compatible with the ADE9000. The differences relevant to the driver are
> the absence of the on-chip dip/swell detection, the absence of an on-chip
> digital integrator (the ADE9430 uses an external analog integrator for
> Rogowski coils, so the DICOEFF register does not exist) and slightly
> different full-scale ADC codes.
[Severity: Medium]
The commit message mentions that the ADE9430 has "slightly different
full-scale ADC codes", but looking at the newly added ade9430_chip_info
struct below, the rms_full_scale_codes, watt_full_scale_codes, and
pcf_full_scale_codes are identical to the ADE9000 codes.
> diff --git a/drivers/iio/adc/ade9000.c b/drivers/iio/adc/ade9000.c
> index 0f64bfb221da0..2f5fe016a82f3 100644
> --- a/drivers/iio/adc/ade9000.c
> +++ b/drivers/iio/adc/ade9000.c
[ ... ]
> @@ -689,6 +693,16 @@ static const struct ade9000_chip_info ade9078_chip_info = {
> .rms_full_scale_codes = 52866837,
> .watt_full_scale_codes = 20823646,
> .pcf_full_scale_codes = 74680000,
> + .has_digital_integrator = true,
> +};
> +
> +static const struct ade9000_chip_info ade9430_chip_info = {
> + .name = "ade9430",
> + .channels = ade9430_channels,
> + .num_channels = ARRAY_SIZE(ade9430_channels),
> + .rms_full_scale_codes = 52702092,
> + .watt_full_scale_codes = 20694066,
> + .pcf_full_scale_codes = 74532013,
> };
>
Are these the correct values for the ADE9430, or were they inadvertently
copied from the ADE9000 without being updated from the datasheet?
> @@ -704,7 +718,6 @@ static const struct reg_sequence ade9000_initialization_sequence[] = {
> { ADE9000_REG_EVENT_MASK, ADE9000_EVENT_DISABLE },
> { ADE9000_REG_WFB_CFG, ADE9000_WFB_CFG },
> { ADE9000_REG_VLEVEL, ADE9000_VLEVEL },
> - { ADE9000_REG_DICOEFF, ADE9000_DICOEFF },
> { ADE9000_REG_EGY_TIME, ADE9000_EGY_TIME },
> { ADE9000_REG_EP_CFG, ADE9000_EP_CFG },
> /* Clear all pending status bits by writing 1s */
> { ADE9000_REG_STATUS0, GENMASK(31, 0) },
> { ADE9000_REG_STATUS1, GENMASK(31, 0) },
> { ADE9000_REG_RUN, ADE9000_RUN_ON }
> };
[ ... ]
> @@ -1672,6 +1685,14 @@ static int ade9000_setup(struct ade9000_state *st)
> if (ret)
> return dev_err_probe(dev, ret, "Failed to write register sequence");
>
> + /* The ADE9430 has no on-chip digital integrator and lacks DICOEFF. */
> + if (st->info->has_digital_integrator) {
> + ret = regmap_write(st->regmap, ADE9000_REG_DICOEFF,
> + ADE9000_DICOEFF);
> + if (ret)
> + return dev_err_probe(dev, ret, "Failed to set DICOEFF\n");
> + }
> +
> fsleep(2000);
>
> return 0;
[Severity: High]
Does this change cause a regression for existing devices by writing the
DICOEFF register after the DSP has already been started?
Because ADE9000_REG_DICOEFF is removed from ade9000_initialization_sequence,
the multi-register sequence now concludes with setting ADE9000_REG_RUN to
ADE9000_RUN_ON without writing DICOEFF first.
Then, ade9000_setup() conditionally writes ADE9000_REG_DICOEFF after the
initialization sequence has already started the DSP. Could this lead to the
configuration being ignored or cause unpredictable calculations since it is
written while the DSP is running?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260907101623.8730-1-antoniu.miclaus@analog.com?part=3
next prev parent reply other threads:[~2026-09-07 10:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-07 10:16 [PATCH 0/4] iio: adc: ade9000: add ADE9430 support Antoniu Miclaus
2026-09-07 10:16 ` [PATCH 1/4] iio: adc: ade9000: fix ADE9000 full-scale RMS and PCF codes Antoniu Miclaus
2026-09-07 10:29 ` sashiko-bot
2026-09-07 10:16 ` [PATCH 2/4] dt-bindings: iio: adc: adi,ade9000: add adi,ade9430 compatible Antoniu Miclaus
2026-09-07 10:16 ` [PATCH 3/4] iio: adc: ade9000: add support for ADE9430 Antoniu Miclaus
2026-09-07 10:26 ` sashiko-bot [this message]
2026-09-13 22:19 ` Jonathan Cameron
2026-09-07 10:16 ` [PATCH 4/4] docs: iio: ade9000: document ADE9430 support Antoniu Miclaus
2026-09-13 22:20 ` Jonathan Cameron
2026-09-13 22:12 ` [PATCH 0/4] iio: adc: ade9000: add " Jonathan Cameron
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=20260907102659.DD0761F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=antoniu.miclaus@analog.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--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