[PATCH v4 10/11] iio: amplifiers: ad8366: consume enable gpio

Rodrigo Alencar via B4 Relay
2026-02-10T19:42:18Z

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

Some parts may consume enable GPIO to enable serial mode
(HMC1119's and HMC792A P/S pin) or powerup the device
(e.g. ADA4961's PWUP pin).

Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
---
drivers/iio/amplifiers/ad8366.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad8366.c
index 79fb3119d794..b828b4be7b6e 100644
--- a/drivers/iio/amplifiers/ad8366.c
+++ b/drivers/iio/amplifiers/ad8366.c
@@ -204,6 +204,7 @@ static const struct iio_chan_spec ad8366_channels[] = {
static int ad8366_probe(struct spi_device *spi)
{
struct device *dev = &spi->dev;
+ struct gpio_desc *enable_gpio;
struct reset_control *rstc;
struct iio_dev *indio_dev;
struct ad8366_state *st;
@@ -231,6 +232,11 @@ static int ad8366_probe(struct spi_device *spi)
return dev_err_probe(dev, PTR_ERR(rstc),
"Failed to get reset controller\n");

+ enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_HIGH);
+ if (IS_ERR(enable_gpio))
+ return dev_err_probe(dev, PTR_ERR(enable_gpio),
+ "Failed to get enable GPIO\n");
+
indio_dev->name = spi_get_device_id(spi)->name;
indio_dev->info = &ad8366_info;
indio_dev->modes = INDIO_DIRECT_MODE;

--
2.43.0