From: sashiko-bot@kernel.org
To: Prabhakar <prabhakar.csengg@gmail.com>
Cc: conor+dt@kernel.org, wsa+renesas@sang-engineering.com,
devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH 2/8] iio: adc: rzt2h: Wait for the analog part to stop after a forced stop
Date: Tue, 29 Sep 2026 12:51:37 +0000 [thread overview]
Message-ID: <20260929125137.996AD1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260929124248.237032-3-prabhakar.mahadev-lad.rj@bp.renesas.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] iio: adc: rzt2h: missing MMIO flush before ndelay() in rzt2h_adc_stop()
--
commit 1a5e9531ca2dbd42c2e42cbda9b1697ed221201c
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
iio: adc: rzt2h: Wait for the analog part to stop after a forced stop
When ADCSR.ADST is cleared to forcibly stop a conversion, the analog part
of the A/D converter can take up to 2 ADCLK cycles to stop operating. This
commit adds a delay after clearing the bit to ensure the hardware stops
before reconfiguring it.
> diff --git a/drivers/iio/adc/rzt2h_adc.c b/drivers/iio/adc/rzt2h_adc.c
> index 8ba7b0fde8a19..d53888730f003 100644
> --- a/drivers/iio/adc/rzt2h_adc.c
> +++ b/drivers/iio/adc/rzt2h_adc.c
[ ... ]
> @@ -124,6 +126,13 @@ static void rzt2h_adc_stop(struct rzt2h_adc *adc)
> reg &= ~(RZT2H_ADCSR_ADIE_MASK | RZT2H_ADCSR_ADST_MASK);
>
> writew(reg, adc->base + RZT2H_ADCSR_REG);
> +
> + /*
> + * When a conversion is forcibly stopped, the analog part of the A/D
> + * converter takes up to 2 ADCLK cycles to stop operating.
> + */
> + ndelay(DIV_ROUND_UP_ULL((u64)RZT2H_ADC_STOP_CYCLES * NSEC_PER_SEC,
> + adc->adclk_rate));
[Severity: Medium]
Will this short delay complete before the write has actually reached the ADC
hardware?
Since writew() is a posted write on ARM architectures, the CPU does not block
until the transaction reaches the peripheral. Because ndelay() is called
immediately afterward and the delay is very short, the CPU might finish
waiting before the stop command even arrives at the ADC hardware.
Does this need a dummy readback (e.g., readw()) to flush the write buffer
before calling ndelay(), to guarantee the stop command has arrived before
timing the 2 ADCLK cycles?
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260929124248.237032-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=2
next prev parent reply other threads:[~2026-09-29 12:51 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 12:42 [PATCH 0/8] Add ADC support for RZ/V2H(P) and RZ/V2N SoCs Prabhakar
2026-09-29 12:42 ` [PATCH 1/8] dt-bindings: iio: adc: renesas,r9a09g077-adc: Add RZ/V2H(P) and RZ/V2N support Prabhakar
2026-09-29 12:42 ` [PATCH 2/8] iio: adc: rzt2h: Wait for the analog part to stop after a forced stop Prabhakar
2026-09-29 12:51 ` sashiko-bot [this message]
2026-09-30 9:23 ` Andy Shevchenko
2026-09-30 16:45 ` Lad, Prabhakar
2026-09-29 12:42 ` [PATCH 3/8] iio: adc: rzt2h: Add chip-specific configuration Prabhakar
2026-09-30 9:26 ` Andy Shevchenko
2026-09-30 16:59 ` Lad, Prabhakar
2026-09-29 12:42 ` [PATCH 4/8] iio: adc: rzt2h: Add optional reset support Prabhakar
2026-09-29 12:58 ` sashiko-bot
2026-10-09 11:38 ` Lad, Prabhakar
2026-09-29 12:42 ` [PATCH 5/8] iio: adc: rzt2h: Prepare for SoCs without sample state registers Prabhakar
2026-09-29 12:42 ` [PATCH 6/8] iio: adc: rzt2h: Prepare for SoCs with different ADC info Prabhakar
2026-09-29 12:42 ` [PATCH 7/8] iio: adc: rzt2h: Use scan type for ADC scale Prabhakar
2026-09-30 9:28 ` Andy Shevchenko
2026-09-30 17:03 ` Lad, Prabhakar
2026-09-29 12:42 ` [PATCH 8/8] iio: adc: rzt2h: Add support for RZ/V2H(P) SoC Prabhakar
2026-09-30 9:35 ` Andy Shevchenko
2026-09-30 17:14 ` Lad, Prabhakar
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=20260929125137.996AD1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=prabhakar.csengg@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wsa+renesas@sang-engineering.com \
/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