Skip to content

Commit

Permalink
iio: dac: ad5791: Add reset, clr and ldac gpios
Browse files Browse the repository at this point in the history
The ad7591 has reset, clr and ldac gpios, that might need to be
controlled. Add them to the driver.

Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
  • Loading branch information
ahaslam2 committed Oct 15, 2024
1 parent 6ebc008 commit 3f39ac3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions drivers/iio/dac/ad5791.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 3f39ac3

Please sign in to comment.