lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260203-iio-ad8366-update-v3-8-5d5636b5181a@analog.com>
Date: Tue, 03 Feb 2026 11:24:14 +0000
From: Rodrigo Alencar via B4 Relay <devnull+rodrigo.alencar.analog.com@...nel.org>
To: linux-kernel@...r.kernel.org, linux-iio@...r.kernel.org, 
 devicetree@...r.kernel.org
Cc: Michael Hennerich <Michael.Hennerich@...log.com>, 
 Lars-Peter Clausen <lars@...afoo.de>, Jonathan Cameron <jic23@...nel.org>, 
 David Lechner <dlechner@...libre.com>, Andy Shevchenko <andy@...nel.org>, 
 Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, 
 Conor Dooley <conor+dt@...nel.org>, 
 Rodrigo Alencar <rodrigo.alencar@...log.com>
Subject: [PATCH v3 8/9] iio: amplifiers: ad8366: consume enable gpio

From: Rodrigo Alencar <rodrigo.alencar@...log.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). Also, add a comment explaining
that even though chips like HMC271A has a reset gpio, this
driver previously considered the reset pin for parts that
don't actually have a reset gpio, so it might have been
used to enable/power the device.

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

diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad8366.c
index dc2fe94c53cd..92865ab96ade 100644
--- a/drivers/iio/amplifiers/ad8366.c
+++ b/drivers/iio/amplifiers/ad8366.c
@@ -204,7 +204,7 @@ static const struct iio_chan_spec ad8366_channels[] = {
 
 static int ad8366_probe(struct spi_device *spi)
 {
-	struct gpio_desc *reset_gpio;
+	struct gpio_desc *reset_gpio, *enable_gpio;
 	struct iio_dev *indio_dev;
 	struct ad8366_state *st;
 	int ret;
@@ -226,11 +226,22 @@ static int ad8366_probe(struct spi_device *spi)
 	st->spi = spi;
 	st->info = spi_get_device_match_data(spi);
 
+	/*
+	 * Previously, this driver considered the reset gpio for some devices
+	 * that don't actually have a reset pin, which could have been wired
+	 * up to the enable pin instead, so some users might be relying on this
+	 * to turn the chip on rather than reset it.
+	 */
 	reset_gpio = devm_gpiod_get_optional(&spi->dev, "reset", GPIOD_OUT_HIGH);
 	if (IS_ERR(reset_gpio))
 		return dev_err_probe(&spi->dev, PTR_ERR(reset_gpio),
 				     "Failed to get reset GPIO\n");
 
+	enable_gpio = devm_gpiod_get_optional(&spi->dev, "enable", GPIOD_OUT_HIGH);
+	if (IS_ERR(enable_gpio))
+		return dev_err_probe(&spi->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



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ