[PATCH 19/22] iio: dac: ad5686: add ldac gpio

Rodrigo Alencar via B4 Relay
2026-04-22T14:46:25Z

From: Rodrigo Alencar <rodrigo.alencar@analog.com>

If wired LADC, should be held low when unused (pin is active-low), which
allows for synchronous DAC updates. This will be used to update all the
channels at the same time when adding buffer support.

Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
---
drivers/iio/dac/ad5686.c | 5 +++++
drivers/iio/dac/ad5686.h | 3 +++
2 files changed, 8 insertions(+)

diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
index f239880d1cc7..d37b4902766f 100644
--- a/drivers/iio/dac/ad5686.c
+++ b/drivers/iio/dac/ad5686.c
@@ -551,6 +551,11 @@ int ad5686_probe(struct device *dev,
return dev_err_probe(dev, PTR_ERR(rstc),
"Failed to get reset controller\n");

+ st->ldac_gpio = devm_gpiod_get_optional(dev, "ldac", GPIOD_OUT_HIGH);
+ if (IS_ERR(st->ldac_gpio))
+ return dev_err_probe(dev, PTR_ERR(st->ldac_gpio),
+ "Failed to get LDAC GPIO\n");
+
/* Set all the power down mode for all channels to 1K pulldown */
st->pwr_down_mode = ~0U;
st->pwr_down_mask = ~0U;
diff --git a/drivers/iio/dac/ad5686.h b/drivers/iio/dac/ad5686.h
index e2ed0a2a8ac9..3b7460178632 100644
--- a/drivers/iio/dac/ad5686.h
+++ b/drivers/iio/dac/ad5686.h
@@ -9,6 +9,7 @@
#define __DRIVERS_IIO_DAC_AD5686_H__

#include <linux/bits.h>
+#include <linux/gpio/consumer.h>
#include <linux/mutex.h>
#include <linux/types.h>

@@ -123,6 +124,7 @@ extern const struct ad5686_chip_info ad5679r_chip_info;
* @dev: device instance
* @chip_info: chip model specific constants, available modes etc
* @ops: bus specific operations
+ * @ldac_gpio: LDAC pin GPIO descriptor
* @vref_mv: actual reference voltage used
* @pwr_down_mask: power down mask
* @pwr_down_mode: current power down mode
@@ -134,6 +136,7 @@ struct ad5686_state {
struct device *dev;
const struct ad5686_chip_info *chip_info;
const struct ad5686_bus_ops *ops;
+ struct gpio_desc *ldac_gpio;
unsigned short vref_mv;
unsigned int pwr_down_mask;
unsigned int pwr_down_mode;

--
2.43.0