Linux IIO development
 help / color / mirror / Atom feed
From: David Lechner <dlechner@baylibre.com>
To: Marcelo Schmitt <marcelo.schmitt@analog.com>,
	linux-iio@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: jic23@kernel.org, lars@metafoo.de, Michael.Hennerich@analog.com,
	corbet@lwn.net, marcelo.schmitt1@gmail.com
Subject: Re: [PATCH v2 1/5] iio: adc: ad400: Set transfer bits_per_word to have data in CPU endianness
Date: Thu, 20 Mar 2025 15:43:00 -0500	[thread overview]
Message-ID: <4fb5329f-be34-4d98-b34e-2da4e035f44c@baylibre.com> (raw)
In-Reply-To: <930560a0d0ca7af597d4ad901422bc9ba3fc6a79.1742394806.git.marcelo.schmitt@analog.com>

On 3/19/25 9:57 AM, Marcelo Schmitt wrote:
> When SPI `bits_per_word` is not set, SPI transfers default 8-bit word size
> and ADC data gets stored in big-endian format in memory. Because of that,
> the IIO driver requests ADC data to be rearranged from BE to CPU
> endianness. However, with `bits_per_word` set to the number of ADC
> precision bits, transfers use larger word sizes that get stored in
> 'in-memory wordsizes' and can be read in CPU endianness.
> 
> Use proper `bits_per_word` size for SPI transfers thus saving the driver
> from requesting endianness conversions. With that, shifting the buffer
> data is also no longer needed. This change has no impact on IIO device
> functionality.
> 
> Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
> ---

This is a breaking change. Some SPI controllers, like RPi can only do 8-bit
transfers, so this driver would stop working on those platforms. Also, if
anyone made software already that depended on the big-endian ordering without
checking the scan_type attribute, it would break that software.

I would leave this as-is (drop this patch) and just make it:

	.endianness = _offl ? IIO_CPU : IIO_BE,

in the next patch.

  reply	other threads:[~2025-03-20 20:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-19 14:56 [PATCH v2 0/5] iio: adc: ad4000: Add SPI offload support Marcelo Schmitt
2025-03-19 14:57 ` [PATCH v2 1/5] iio: adc: ad400: Set transfer bits_per_word to have data in CPU endianness Marcelo Schmitt
2025-03-20 20:43   ` David Lechner [this message]
2025-03-21 19:07     ` Marcelo Schmitt
2025-03-19 14:57 ` [PATCH v2 2/5] iio: adc: ad4000: Add support for SPI offload Marcelo Schmitt
2025-03-20 20:47   ` David Lechner
2025-03-21 19:54     ` Marcelo Schmitt
2025-03-21 20:11       ` David Lechner
2025-03-19 14:57 ` [PATCH v2 3/5] Documentation: iio: ad4000: Add new supported parts Marcelo Schmitt
2025-03-20 20:47   ` David Lechner
2025-03-19 14:57 ` [PATCH v2 4/5] Documentation: iio: ad4000: Add IIO Device characteristics section Marcelo Schmitt
2025-03-20 20:47   ` David Lechner
2025-03-19 14:58 ` [PATCH v2 5/5] Documentation: iio: ad4000: Describe offload support Marcelo Schmitt
2025-03-20 20:48   ` David Lechner

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=4fb5329f-be34-4d98-b34e-2da4e035f44c@baylibre.com \
    --to=dlechner@baylibre.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=corbet@lwn.net \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.schmitt1@gmail.com \
    --cc=marcelo.schmitt@analog.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