[PATCH 04/16] iio: frequency: ad9523: fix GPIO polarity handling

From: Nuno Sá

Date: Mon Nov 30 2026 - 12:37:56 EST


The PD, RESET and SYNC pins are all active low, but the driver handles
the GPIOs as if they were active high: it drives powerdown and sync
high to keep the device running, and drives reset low and then high to
reset it. This only works if the GPIOs are described as active high,
which is the opposite of what the hardware does.

Use logical values instead, so that the GPIOs can be described with
their real polarity: keep powerdown and sync de-asserted, and assert
reset before de-asserting it again.

There are no in-tree users of this driver, so nothing relies on the
inverted logic. Out of tree users need to flag the GPIOs as active low.

Signed-off-by: Nuno Sá <nuno.sa@xxxxxxxxxx>
---
drivers/iio/frequency/ad9523.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/frequency/ad9523.c b/drivers/iio/frequency/ad9523.c
index e6913ef36fb0..92bbe4d196b5 100644
--- a/drivers/iio/frequency/ad9523.c
+++ b/drivers/iio/frequency/ad9523.c
@@ -982,22 +982,22 @@ static int ad9523_probe(struct spi_device *spi)
return ret;

st->pwrdown_gpio = devm_gpiod_get_optional(dev, "powerdown",
- GPIOD_OUT_HIGH);
+ GPIOD_OUT_LOW);
if (IS_ERR(st->pwrdown_gpio))
return PTR_ERR(st->pwrdown_gpio);

st->reset_gpio = devm_gpiod_get_optional(dev, "reset",
- GPIOD_OUT_LOW);
+ GPIOD_OUT_HIGH);
if (IS_ERR(st->reset_gpio))
return PTR_ERR(st->reset_gpio);

if (st->reset_gpio) {
udelay(1);
- gpiod_direction_output(st->reset_gpio, 1);
+ gpiod_set_value_cansleep(st->reset_gpio, 0);
}

st->sync_gpio = devm_gpiod_get_optional(dev, "sync",
- GPIOD_OUT_HIGH);
+ GPIOD_OUT_LOW);
if (IS_ERR(st->sync_gpio))
return PTR_ERR(st->sync_gpio);


--
2.56.0