[PATCH 12/18] iio: adc: ad4170-4: Do not drive XTAL2 when using the internal clock

From: Janani Sunil

Date: Thu Dec 03 2026 - 10:21:58 EST


When no external clock is supplied through the clocks property,
ad4170_clock_select() selects CLOCKSEL = 01, which is the internal
oscillator with the clock output routed to the XTAL2 pin on AD4170-4, or
to the CLK pin on AD4190-4 and AD4195-4. That drives the pin at IOVDD
logic level even though nothing requested the clock output, and on
AD4170-4 conflicts with boards that populate a crystal across XTAL1 and
XTAL2 so that either clock source can be selected.

Select CLOCKSEL = 00, internal oscillator with no output, and leave
enabling the clock output to the clock provider.

Fixes: 4e5fde667782 ("iio: adc: ad4170-4: Add clock provider support")
Signed-off-by: Janani Sunil <janani.sunil@xxxxxxxxxx>
---
drivers/iio/adc/ad4170-4.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ad4170-4.c b/drivers/iio/adc/ad4170-4.c
index 1195fcbf176f..5ffc845266a2 100644
--- a/drivers/iio/adc/ad4170-4.c
+++ b/drivers/iio/adc/ad4170-4.c
@@ -2502,7 +2502,7 @@ static int ad4170_clock_select(struct iio_dev *indio_dev)
/* Use internal clock reference */
st->mclk_hz = AD4170_INT_CLOCK_16MHZ / st->chip->clock_div;
st->clock_ctrl |= FIELD_PREP(AD4170_CLOCK_CTRL_CLOCKSEL_MSK,
- AD4170_CLOCK_CTRL_CLOCKSEL_INT_OUT);
+ AD4170_CLOCK_CTRL_CLOCKSEL_INT);

if (!device_property_present(&st->spi->dev, "#clock-cells"))
return 0;

--
2.43.0