Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Antoniu Miclaus" <antoniu.miclaus@analog.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH 1/4] iio: adc: ade9000: fix ADE9000 full-scale RMS and PCF codes
Date: Mon, 07 Sep 2026 10:29:54 +0000	[thread overview]
Message-ID: <20260907102955.142B01F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260907101623.8730-2-antoniu.miclaus@analog.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The driver defines `ADE9000_ST1_CROSSING_DEPTH` as 25, which limits the bitmap iteration in the IRQ handler, causing `ADE9000_ST1_DIPC_BIT` (bit index 25) to be silently ignored and never cleared.
--

commit 656c536a824cd57c69e995fb40cb1db36bf309ee
Author: Antoniu Miclaus <antoniu.miclaus@analog.com>

iio: adc: ade9000: fix ADE9000 full-scale RMS and PCF codes

The ADE9000 chip_info uses full-scale codes that do not match the datasheet.
This commit corrects the RMS and PCF full-scale codes to the values from the
ADE9000 datasheet, fixing a 0.3% reading error on the affected channels.

> diff --git a/drivers/iio/adc/ade9000.c b/drivers/iio/adc/ade9000.c
> index fd1362a980523..0f64bfb221da0 100644
> --- a/drivers/iio/adc/ade9000.c
> +++ b/drivers/iio/adc/ade9000.c
> @@ -677,9 +677,9 @@ static const struct ade9000_chip_info ade9000_chip_info = {
>  	.name = "ade9000",
>  	.channels = ade9000_channels,
>  	.num_channels = ARRAY_SIZE(ade9000_channels),
> -	.rms_full_scale_codes = 52866837,
> +	.rms_full_scale_codes = 52702092,
>  	.watt_full_scale_codes = 20694066,
> -	.pcf_full_scale_codes = 74770000,
> +	.pcf_full_scale_codes = 74532013,
>  };

[Severity: High]
This is a pre-existing issue, but I noticed a potential problem in
ade9000_irq1_thread() with how it handles the interrupts bitmap:

drivers/iio/adc/ade9000.c:ade9000_irq1_thread() {
...
	bitmap_from_arr32(interrupt_bits, &interrupts, ADE9000_ST1_CROSSING_DEPTH);
	for_each_set_bit_from(bit, interrupt_bits,
			      ADE9000_ST1_CROSSING_DEPTH) {
...
}

Since ADE9000_ST1_CROSSING_DEPTH is defined as 25, will this restrict the loop
bounds to bits 0-24, causing bit 25 (ADE9000_ST1_DIPC_BIT) to be completely
ignored?

If userspace enables the DIPC event and the threshold condition is met, bit 25
would be set in ADE9000_REG_STATUS1 asserting the IRQ. Because the handler
skips bit 25, the interrupt status bit is never cleared. Would this result in
an interrupt storm since the hardware register uses write-1-to-clear logic?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260907101623.8730-1-antoniu.miclaus@analog.com?part=1

  reply	other threads:[~2026-09-07 10:29 UTC|newest]

Thread overview: 7+ 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 [this message]
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
2026-09-07 10:16 ` [PATCH 4/4] docs: iio: ade9000: document ADE9430 support Antoniu Miclaus

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=20260907102955.142B01F00A3A@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