Re: [PATCH v3 07/12] iio: dac: ad5686: add ldac gpio

From: David Lechner

Date: Sat Jun 20 2026 - 12:15:06 EST


On 6/16/26 3:21 AM, Rodrigo Alencar via B4 Relay wrote:
> From: Rodrigo Alencar <rodrigo.alencar@xxxxxxxxxx>
>
> If wired LDAC, should be held low when unused (pin is active-low), which

Would better match the implementation if this said "asserted" instead of
"held low" (code says GPIOD_OUT_HIGH which should be read as "asserted").

> 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@xxxxxxxxxx>
> ---
> drivers/iio/dac/ad5686.c | 6 ++++++
> drivers/iio/dac/ad5686.h | 3 +++
> 2 files changed, 9 insertions(+)
>
> diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
> index a48acedff51c..73105c197964 100644
> --- a/drivers/iio/dac/ad5686.c
> +++ b/drivers/iio/dac/ad5686.c
> @@ -12,6 +12,7 @@
> #include <linux/dev_printk.h>
> #include <linux/errno.h>
> #include <linux/export.h>
> +#include <linux/gpio/consumer.h>
> #include <linux/kstrtox.h>
> #include <linux/module.h>
> #include <linux/regulator/consumer.h>
> @@ -515,6 +516,11 @@ int ad5686_probe(struct device *dev,
> return dev_err_probe(dev, PTR_ERR(rstc),
> "Failed to get reset control\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");
> +
> reset_control_assert(rstc);
> fsleep(1); /* reset pulse: comfortably bigger than the spec */
> reset_control_deassert(rstc);
> diff --git a/drivers/iio/dac/ad5686.h b/drivers/iio/dac/ad5686.h
> index a06fe7d89305..f3110410d89b 100644
> --- a/drivers/iio/dac/ad5686.h
> +++ b/drivers/iio/dac/ad5686.h
> @@ -60,6 +60,7 @@ enum ad5686_regmap_type {
> AD5686_REGMAP,
> };
>
> +struct gpio_desc;
> struct ad5686_state;
>
> /**
> @@ -119,6 +120,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
> @@ -131,6 +133,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;
>