[PATCH v1 05/15] iio: adc: ad7768-1: set MOSI idle state to high

From: Jonathan Santos
Date: Tue Jan 07 2025 - 10:26:05 EST


All supported parts require that the MOSI line stays high
while in idle.

Configure SPI controller to set MOSI idle state to high.

Fixes: a5f8c7da3dbe ("iio: adc: Add AD7768-1 ADC basic support")
Signed-off-by: Jonathan Santos <Jonathan.Santos@xxxxxxxxxx>
---
drivers/iio/adc/ad7768-1.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c
index c3cf04311c40..463a28d09c2e 100644
--- a/drivers/iio/adc/ad7768-1.c
+++ b/drivers/iio/adc/ad7768-1.c
@@ -574,6 +574,15 @@ static int ad7768_probe(struct spi_device *spi)
return -ENOMEM;

st = iio_priv(indio_dev);
+ /*
+ * The ADC SDI line must be kept high when
+ * data is not being clocked out of the controller.
+ * Request the SPI controller to make MOSI idle high.
+ */
+ spi->mode |= SPI_MOSI_IDLE_HIGH;
+ ret = spi_setup(spi);
+ if (ret < 0)
+ return ret;
st->spi = spi;

st->vref = devm_regulator_get(&spi->dev, "vref");
--
2.34.1