public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Olivier Moysan <olivier.moysan@foss.st.com>
Cc: <fabrice.gasnier@foss.st.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Nuno Sa <nuno.sa@analog.com>, <linux-iio@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-stm32@st-md-mailman.stormreply.com>,
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v4 8/8] iio: adc: stm32-dfsdm: add scaling support to dfsdm
Date: Sun, 7 Jul 2024 16:21:44 +0100	[thread overview]
Message-ID: <20240707162144.19ffc0eb@jic23-huawei> (raw)
In-Reply-To: <20240704155338.2387858-9-olivier.moysan@foss.st.com>

On Thu, 4 Jul 2024 17:53:36 +0200
Olivier Moysan <olivier.moysan@foss.st.com> wrote:

> Add scaling support to STM32 DFSDM.
> 
> When used in an analog context, a DFSDM filter typically converts the data
> from a sigma delta modulator. The IIO device associated to the DFSDM
> filter provides these data as raw data.
> The IIO device can provide scaling information (voltage and offset) to
> allow conversion of raw data into physical values.
> 
> With the new binding based on IIO backend framework, the sigma delta
> modulators are defined as backends providing scaling information.
> 
> The scaling is not supported with legacy binding.
> 
> Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
> Acked-by: Nuno Sa <nuno.sa@analog.com>

One really minor thing inline.

Jonathan

> @@ -1278,7 +1308,14 @@ static int stm32_dfsdm_read_raw(struct iio_dev *indio_dev,
>  				int *val2, long mask)
>  {
>  	struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
> -	int ret;
> +
> +	struct stm32_dfsdm_filter *fl = &adc->dfsdm->fl_list[adc->fl_id];
> +	struct stm32_dfsdm_filter_osr *flo = &fl->flo[fl->fast];
> +	u32 max = flo->max << (flo->lshift - chan->scan_type.shift);
> +	int ret, idx = chan->scan_index;
Trivial but I've been grumping at others about this today so you get it too ;)
Don't mix declarations that include assignments with ones that don't.
It isn't good for general readability.
	int idx = chan->scan_index;
	int ret;

I'm not interested in patches to 'fix' this in other code, but nice to not
introduce more cases in new code.

> +
> +	if (flo->lshift < chan->scan_type.shift)
> +		max = flo->max >> (chan->scan_type.shift - flo->lshift);
>  
>  	switch (mask) {
>  	case IIO_CHAN_INFO_RAW:


      reply	other threads:[~2024-07-07 15:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-04 15:53 [PATCH v4 0/8] iio: adc: dfsdm: add scaling support Olivier Moysan
2024-07-04 15:53 ` [PATCH v4 4/8] dt-bindings: iio: dfsdm: move to backend framework Olivier Moysan
2024-07-08 17:08   ` Rob Herring
2024-07-04 15:53 ` [PATCH v4 6/8] iio: adc: stm32-dfsdm: adopt generic channels bindings Olivier Moysan
2024-07-07 15:18   ` Jonathan Cameron
2024-07-04 15:53 ` [PATCH v4 8/8] iio: adc: stm32-dfsdm: add scaling support to dfsdm Olivier Moysan
2024-07-07 15:21   ` Jonathan Cameron [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=20240707162144.19ffc0eb@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=alexandre.torgue@foss.st.com \
    --cc=fabrice.gasnier@foss.st.com \
    --cc=lars@metafoo.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=olivier.moysan@foss.st.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