Skip to content

Commit 6c5c796

Browse files
amiclausjic23
authored andcommitted
iio: adc: ad4851: add spi 3-wire support
Add support for 3-wire configuration within the driver. By default 4-wire configuration is used. Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250626104024.8645-2-antoniu.miclaus@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 533309a commit 6c5c796

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/iio/adc/ad4851.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -444,10 +444,12 @@ static int ad4851_setup(struct ad4851_state *st)
444444
if (ret)
445445
return ret;
446446

447-
ret = regmap_write(st->regmap, AD4851_REG_INTERFACE_CONFIG_A,
448-
AD4851_SDO_ENABLE);
449-
if (ret)
450-
return ret;
447+
if (!(st->spi->mode & SPI_3WIRE)) {
448+
ret = regmap_write(st->regmap, AD4851_REG_INTERFACE_CONFIG_A,
449+
AD4851_SDO_ENABLE);
450+
if (ret)
451+
return ret;
452+
}
451453

452454
ret = regmap_read(st->regmap, AD4851_REG_PRODUCT_ID_L, &product_id);
453455
if (ret)

0 commit comments

Comments
 (0)