From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Primoz Fiser <primoz.fiser@norik.com>
Cc: Haibo Chen <haibo.chen@nxp.com>,
Jonathan Cameron <jic23@kernel.org>,
David Lechner <dlechner@baylibre.com>,
Nuno Sa <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>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
linux-iio@vger.kernel.org, imx@lists.linux.dev,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, upstream@lists.phytec.de,
andrej.picej@norik.com
Subject: Re: [PATCH 2/2] iio: adc: imx93: Make calibration parameters configurable
Date: Thu, 10 Jul 2025 15:20:04 +0300 [thread overview]
Message-ID: <aG-v9IxJ-XAxmnyh@smile.fi.intel.com> (raw)
In-Reply-To: <42dd658e-555a-43f7-a7bf-e5365d508f4a@norik.com>
On Thu, Jul 10, 2025 at 12:23:58PM +0200, Primoz Fiser wrote:
> On 10. 07. 25 11:22, Andy Shevchenko wrote:
> > On Thu, Jul 10, 2025 at 09:39:04AM +0200, Primoz Fiser wrote:
...
> >> + ret = device_property_read_u32(adc->dev, "nxp,calib-avg-en", &val);
> >> + if (!ret) {
> >> + if (val != 0 && val != 1) {
> >> + dev_err(adc->dev, "invalid nxp,calib-avg-en: %d\n", val);
> >> + return -EINVAL;
> >> + }
> >> + reg = val;
> >> + mcr &= ~IMX93_ADC_MCR_AVGEN_MASK;
> >> + mcr |= FIELD_PREP(IMX93_ADC_MCR_AVGEN_MASK, reg);
> >> + }
> >
> > Please, since it's optional, do other way around.
> >
> > val = $DEFAUTL;
> > device_property_read_u32(adc->dev, "nxp,calib-avg-en", &val);
> > FIELD_MODIFY(...)
> >
> > Similar approach may be used for the other properties.
>
> OK, I guess I could implement it like you suggested to explicitly set
> the default parameter values.
>
> But in current implementation MCR values are read at the beginning of
> imx93_adc_calibration(), meaning calibration parameters are register POR
> defaults. With you suggestion, we put defaults in software rather than
> reading them from the hw directly.
I see, then you need to read, do FIELD_GET()/device_property_read()/FIELD_MODIFY().
You got the idea.
...
> > Please, factor out this to the function, so we won't see the direct IO in the
> > ->probe().
>
> Sorry I don't understand this part.
>
> What do you mean by factoring out this writel()?
>
> Do you perhaps suggest to implement function
> imx93_adc_configure_calibration() and put all our changes into it?
>
> But we are already in imx93_adc_calibration() which is separate from
> probe().
Ah, sorry for the mistakenly read the function name. Ignore this comment.
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2025-07-10 12:20 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-10 7:39 [PATCH 0/2] Make i.MX 93 ADC calibration params configurable Primoz Fiser
2025-07-10 7:39 ` [PATCH 1/2] dt-bindings: iio: adc: imx93: Add calibration properties Primoz Fiser
2025-07-10 15:33 ` Frank Li
2025-07-10 15:46 ` David Lechner
2025-07-13 15:02 ` Jonathan Cameron
2025-07-14 5:56 ` Primoz Fiser
2025-07-14 16:11 ` Nuno Sá
2025-07-15 5:46 ` Primoz Fiser
2025-07-19 11:49 ` Jonathan Cameron
2025-07-21 9:38 ` Peng Fan
2025-07-21 9:09 ` Bough Chen
2025-07-24 15:18 ` Jonathan Cameron
2025-08-07 4:37 ` Primoz Fiser
2025-08-07 9:26 ` Bough Chen
2025-07-10 7:39 ` [PATCH 2/2] iio: adc: imx93: Make calibration parameters configurable Primoz Fiser
2025-07-10 9:22 ` Andy Shevchenko
2025-07-10 10:23 ` Primoz Fiser
2025-07-10 12:20 ` Andy Shevchenko [this message]
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=aG-v9IxJ-XAxmnyh@smile.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=andrej.picej@norik.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=festevam@gmail.com \
--cc=haibo.chen@nxp.com \
--cc=imx@lists.linux.dev \
--cc=jic23@kernel.org \
--cc=kernel@pengutronix.de \
--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=primoz.fiser@norik.com \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=upstream@lists.phytec.de \
/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
all inboxes | Powered by JetHome®