From: Petar Stepanovic <pstepanovic@axiado.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Akhila Kavi" <akavi@axiado.com>,
"Prasad Bolisetty" <pbolisetty@axiado.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Harshit Shah" <hshah@axiado.com>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/2] iio: adc: add Axiado SARADC driver
Date: Tue, 28 Jul 2026 08:58:10 +0200 [thread overview]
Message-ID: <de947dc3-6d02-43de-a9e5-7f1e950231b9@axiado.com> (raw)
In-Reply-To: <alnpMFK6_ZkdWlLi@ashevche-desk.local>
On 7/17/2026 10:34 AM, Andy Shevchenko wrote:
> ...
>
>> +struct axiado_saradc {
>> + struct regmap *regmap;
>> + struct clk *clk;
> Makes no sense to keep it here, your code takes the rate and uses that,
> I do not see how clk is being used right now. Perhaps you have plans
> for power management? But then add it when it's needed and being used.
Hi Andy, thanks for review.
Agreed. The clock is only used during probe to obtain its rate and calculate the conversion delay, so there is no need to keep it in the device structure. I will make it a local probe variable and remove `clk` from `struct axiado_saradc`.
>> + struct mutex lock; /* Serializes ADC conversions. */
>> + unsigned long clk_rate;
>> + int vref_uV;
>> +};
>> +
>> +static const struct regmap_config axiado_saradc_regmap_config = {
>> + .reg_bits = 32,
>> + .val_bits = 32,
>> + .reg_stride = 4,
>> + .max_register = AX_SARADC_DOUT_REG,
> No cache?
No cache is intentional. The registers represent transient control, status, and conversion data, so accesses should always go directly to the hardware. Since REGCACHE_NONE is the default, it is not specified explicitly.
> ...
>
>> + ret = regmap_read(info->regmap, AX_SARADC_DOUT_REG, ®val);
>> +
>> + /* Stop manual conversion */
>> + stop_ret = regmap_write(info->regmap, AX_SARADC_MANUAL_CTRL_REG, 0);
>> +
>> + if (ret)
>> + return ret;
>> + if (stop_ret)
>> + return stop_ret;
> Why do we care about stop error? Isn't it the best effort we can do?
Agreed. Stopping the manual conversion is a best-effort cleanup operation, and there is no useful recovery action if it fails. I will drop |stop_ret| and preserve only the result of regmap_read().
>
>> + *val = regval & GENMASK(AX_RESOLUTION_BITS - 1, 0);
> Is device responding always in native endianess?
The SARADC registers are little-endian. `regmap_read()` returns the register value in CPU endianness, so applying the mask directly is correct. I will explicitly set `.val_format_endian = REGMAP_ENDIAN_LITTLE` in the regmap configuration to document the hardware endianness.
Best regards,
Petar
next prev parent reply other threads:[~2026-07-28 6:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 5:53 [PATCH v4 0/2] iio: adc: Add Axiado SARADC driver Petar Stepanovic
2026-07-17 5:53 ` [PATCH v4 1/2] dt-bindings: iio: adc: add Axiado AX3000/AX3005 SARADC Petar Stepanovic
2026-07-17 5:53 ` [PATCH v4 2/2] iio: adc: add Axiado SARADC driver Petar Stepanovic
2026-07-17 8:34 ` Andy Shevchenko
2026-07-17 8:38 ` Andy Shevchenko
2026-07-18 1:40 ` Jonathan Cameron
2026-07-28 6:58 ` Petar Stepanovic [this message]
2026-08-10 7:32 ` Andy Shevchenko
2026-07-18 13:51 ` Uwe Kleine-König
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=de947dc3-6d02-43de-a9e5-7f1e950231b9@axiado.com \
--to=pstepanovic@axiado.com \
--cc=akavi@axiado.com \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=hshah@axiado.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=pbolisetty@axiado.com \
--cc=robh@kernel.org \
/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