iio: adc: ad7949: enable use with non 14/16-bit controllers
authorLiam Beguin <lvb@xiphos.com>
Sun, 15 Aug 2021 21:33:06 +0000 (17:33 -0400)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Tue, 14 Sep 2021 11:00:30 +0000 (12:00 +0100)
commit0b2a740b424e68e346e3797eaa7c155575ae7c14
tree5fc5e501e5ac27d201cddcf512a155ce3b034765
parent595a0590f4fbcb39d73a7c55c79a7e7921ec1614
iio: adc: ad7949: enable use with non 14/16-bit controllers

This driver supports devices with 14-bit and 16-bit sample sizes.
This implies different SPI transfer lengths which are not always handled
properly by some SPI controllers.

To work around this limitation, define a big endian buffer used to split
the buffer into two 8-bit messages in the event that the controller
doesn't support 14-bit or 16-bit transfers.
A separate buffer is introduced here to avoid performing operations on
types of different endianness.

Since all transfers use the same bits_per_word value, move that logic to
the probe function, and let transfers default to the value defined in
the struct spi_device.

Signed-off-by: Liam Beguin <lvb@xiphos.com>
Link: https://lore.kernel.org/r/20210815213309.2847711-3-liambeguin@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ad7949.c