From 3f39ac3ea15bac4bdda3d14a0551dade6d5020b9 Mon Sep 17 00:00:00 2001 From: Axel Haslam Date: Tue, 17 Sep 2024 10:30:15 +0200 Subject: [PATCH] iio: dac: ad5791: Add reset, clr and ldac gpios The ad7591 has reset, clr and ldac gpios, that might need to be controlled. Add them to the driver. Signed-off-by: Axel Haslam --- drivers/iio/dac/ad5791.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/iio/dac/ad5791.c b/drivers/iio/dac/ad5791.c index 75b549827e15a5..0e56e2f06cff9b 100644 --- a/drivers/iio/dac/ad5791.c +++ b/drivers/iio/dac/ad5791.c @@ -85,6 +85,9 @@ struct ad5791_state { struct spi_device *spi; struct regulator *reg_vdd; struct regulator *reg_vss; + struct gpio_desc *gpio_reset; + struct gpio_desc *gpio_clear; + struct gpio_desc *gpio_ldac; const struct ad5791_chip_info *chip_info; unsigned short vref_mv; unsigned int vref_neg_mv; @@ -377,6 +380,21 @@ static int ad5791_probe(struct spi_device *spi) neg_voltage_uv = ret; } + st->gpio_reset = devm_gpiod_get_optional(&spi->dev, "reset", + GPIOD_OUT_LOW); + if (IS_ERR(st->gpio_reset)) + return PTR_ERR(st->gpio_reset); + + st->gpio_clear = devm_gpiod_get_optional(&spi->dev, "clear", + GPIOD_OUT_LOW); + if (IS_ERR(st->gpio_clear)) + return PTR_ERR(st->gpio_clear); + + st->gpio_ldac = devm_gpiod_get_optional(&spi->dev, "ldac", + GPIOD_OUT_LOW); + if (IS_ERR(st->gpio_ldac)) + return PTR_ERR(st->gpio_ldac); + st->pwr_down = true; st->spi = spi;