All of lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH] iio: adis: set GPIO reset pin direction
@ 2021-07-06  9:29 Antti Keränen
  2021-07-07  8:18 ` Lars-Peter Clausen
  2021-07-07  8:36 ` Sa, Nuno
  0 siblings, 2 replies; 16+ messages in thread
From: Antti Keränen @ 2021-07-06  9:29 UTC (permalink / raw)
  To: linux-iio
  Cc: Antti Keränen, Hannu Hartikainen, Lars-Peter Clausen,
	Michael Hennerich, Nuno Sa, Jonathan Cameron

Use GPIOD_OUT_LOW instead of GPIOD_ASIS as the reset pin needs to be an
active low output pin.

Suggested-by: Hannu Hartikainen <hannu@hrtk.in>
Signed-off-by: Antti Keränen <detegr@rbx.email>
---
The documentation of GPIO consumer interface states:

Be aware that there is no default direction for GPIOs. Therefore,
**using a GPIO without setting its direction first is illegal and will
result in undefined behavior!**

Therefore the direction of the reset GPIO pin should be set as output.

 drivers/iio/imu/adis.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c
index 319b64b2fd88..7f13b3763732 100644
--- a/drivers/iio/imu/adis.c
+++ b/drivers/iio/imu/adis.c
@@ -415,7 +415,7 @@ int __adis_initial_startup(struct adis *adis)
 	int ret;
 
 	/* check if the device has rst pin low */
-	gpio = devm_gpiod_get_optional(&adis->spi->dev, "reset", GPIOD_ASIS);
+	gpio = devm_gpiod_get_optional(&adis->spi->dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(gpio))
 		return PTR_ERR(gpio);
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-07-17 17:39 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06  9:29 [RESEND PATCH] iio: adis: set GPIO reset pin direction Antti Keränen
2021-07-07  8:18 ` Lars-Peter Clausen
2021-07-07  8:36 ` Sa, Nuno
2021-07-07 11:53   ` Hannu Hartikainen
2021-07-07 12:25     ` Lars-Peter Clausen
2021-07-07 13:30       ` Hannu Hartikainen
2021-07-08  9:54         ` [PATCH v2] " Antti Keränen
2021-07-08 10:05           ` Sa, Nuno
2021-07-10 17:35           ` Jonathan Cameron
2021-07-13 17:53           ` Jonathan Cameron
2021-07-14 10:04             ` Antti Keränen
2021-07-14 12:40               ` Jonathan Cameron
2021-07-14 18:25                 ` Antti Keränen
2021-07-17 17:41                   ` Jonathan Cameron
2021-07-07 12:32     ` [RESEND PATCH] " Sa, Nuno
2021-07-07 12:32   ` Lars-Peter Clausen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.