Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Petar Stepanovic" <pstepanovic@axiado.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v5 2/2] iio: adc: add Axiado SARADC driver
Date: Mon, 10 Aug 2026 14:58:30 +0000	[thread overview]
Message-ID: <20260810145831.457031F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260810-axiado-ax3000-ax3005-saradc-v5-2-bb0df3ecedaa@axiado.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The ADC conversion delay calculation ignores the configured sampling time (or oversampling), potentially causing premature reads.
--

--- Patch [2]: [PATCH v5 2/2] iio: adc: add Axiado SARADC driver ---
commit d29fd02ad40c12a8c4f338bf8bdde17a93221079
Author: Petar Stepanovic <pstepanovic@axiado.com>

iio: adc: add Axiado SARADC driver

Add support for the SARADC controller found on Axiado AX3000 and
AX3005 SoCs. The driver supports single-shot voltage reads through
the IIO subsystem.

> diff --git a/drivers/iio/adc/axiado_saradc.c b/drivers/iio/adc/axiado_saradc.c
> new file mode 100644
> index 0000000000000..daa98dd2f1761
> --- /dev/null
> +++ b/drivers/iio/adc/axiado_saradc.c

[ ... ]

> +static int axiado_saradc_conversion(struct axiado_saradc *info,
> +				    struct iio_chan_spec const *chan, int *val)
> +{
> +	unsigned long usecs;
> +	unsigned int regval;
> +	int ret;
> +
> +	guard(mutex)(&info->lock);
> +
> +	/* Select the channel to be used and trigger conversion */
> +	ret = regmap_write(info->regmap, AX_SARADC_MANUAL_CTRL_REG,
> +			   AX_SARADC_MANUAL_CTRL_ENABLE |
> +			   FIELD_PREP(AX_SARADC_MANUAL_CTRL_CH_SEL_MASK, chan->channel));
> +	if (ret)
> +		return ret;
> +
> +	/* Hardware requires 13 conversion cycles at clk_rate */
> +	usecs = DIV_ROUND_UP(AX_SARADC_CONV_CYCLES * USEC_PER_SEC,
> +			     info->clk_rate);
> +	fsleep(usecs + AX_SARADC_CONV_DELAY_MARGIN_US);

[Severity: Medium]
Does this wait time calculation need to account for the configured sampling
time?

In axiado_saradc_probe(), AX_SARADC_GLOBAL_CTRL_SAMPLE_MASK is configured to
AX_SARADC_GLOBAL_CTRL_SAMPLE_16 (which selects 16 samples). Calculating the
wait strictly as 13 conversion cycles seems to ignore the extra time needed
for these 16 samples.

At lower clock rates, could the sleep finish before the conversion actually
completes and lead to premature reads?

> +
> +	ret = regmap_read(info->regmap, AX_SARADC_DOUT_REG, &regval);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260810-axiado-ax3000-ax3005-saradc-v5-0-bb0df3ecedaa@axiado.com?part=2

  reply	other threads:[~2026-08-10 14:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-10 14:49 [PATCH v5 0/2] iio: adc: Add Axiado SARADC driver Petar Stepanovic
2026-08-10 14:49 ` [PATCH v5 1/2] dt-bindings: iio: adc: add Axiado AX3000/AX3005 SARADC Petar Stepanovic
2026-08-10 14:49 ` [PATCH v5 2/2] iio: adc: add Axiado SARADC driver Petar Stepanovic
2026-08-10 14:58   ` sashiko-bot [this message]
2026-08-10 18:27   ` 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=20260810145831.457031F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=pstepanovic@axiado.com \
    --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