[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vd386P9xM_+wLahp6B_XwYVq1AZxaFQeWvZ2pnk-tFGHA@mail.gmail.com>
Date: Mon, 10 Jul 2023 10:36:53 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Kim Seer Paller <kimseer.paller@...log.com>
Cc: jic23@...nel.org, lars@...afoo.de, lgirdwood@...il.com,
broonie@...nel.org, Michael.Hennerich@...log.com, robh@...nel.org,
krzysztof.kozlowski@...aro.org, conor+dt@...nel.org,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org
Subject: Re: [PATCH v9 2/2] iio: adc: max14001: New driver
On Mon, Jul 10, 2023 at 7:27 AM Kim Seer Paller
<kimseer.paller@...log.com> wrote:
>
> The MAX14001 is configurable, isolated 10-bit ADCs for multi-range
> binary inputs.
...
> V8 -> V9: Changed SPI buffer data types to __le16,
Why?
...
> + __le16 spi_tx_buffer __aligned(IIO_DMA_MINALIGN);
> + __le16 spi_rx_buffer;
...
> + /*
> + * Prepare SPI transmit buffer 16 bit-value to big-endian format and
> + * reverses bit order to align with the LSB-first input on SDI port.
reverse
> + */
> + st->spi_tx_buffer = bitrev16(cpu_to_be16(FIELD_PREP(MAX14001_ADDR_MASK,
> + reg_addr)));
...
> + /*
> + * Convert received 16-bit value from big-endian to little-endian format
> + * and reverses bit order.
reverse
> + */
> + *data = bitrev16(be16_to_cpu(st->spi_rx_buffer));
...
> + /*
> + * Prepare SPI transmit buffer 16 bit-value to big-endian format and
> + * reverses bit order to align with the LSB-first input on SDI port.
reverse
> + */
> + st->spi_tx_buffer = bitrev16(cpu_to_be16(
> + FIELD_PREP(MAX14001_ADDR_MASK, reg_addr) |
> + FIELD_PREP(MAX14001_SET_WRITE_BIT, 1) |
> + FIELD_PREP(MAX14001_DATA_MASK, data)));
Obviously it's incorrect now even more than before.
The types are defined as __le, while ops are against __be.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists