2021-07-08 10:00:20

by Antti Keränen

[permalink] [raw]
Subject: [PATCH v2] iio: adis: set GPIO reset pin direction

Set reset pin direction to output as the reset pin needs to be an active
low output pin.

Co-developed-by: Hannu Hartikainen <[email protected]>
Signed-off-by: Hannu Hartikainen <[email protected]>
Signed-off-by: Antti Keränen <[email protected]>
---
Removed unnecessary toggling of the pin as requested by Lars-Peter. I
missed out on the conversation, but I agree this is better.

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

diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c
index 319b64b2fd88..f8b7837d8b8f 100644
--- a/drivers/iio/imu/adis.c
+++ b/drivers/iio/imu/adis.c
@@ -415,12 +415,11 @@ 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_HIGH);
if (IS_ERR(gpio))
return PTR_ERR(gpio);

if (gpio) {
- gpiod_set_value_cansleep(gpio, 1);
msleep(10);
/* bring device out of reset */
gpiod_set_value_cansleep(gpio, 0);
--
2.32.0


2021-07-08 10:08:14

by Nuno Sa

[permalink] [raw]
Subject: RE: [PATCH v2] iio: adis: set GPIO reset pin direction



> -----Original Message-----
> From: Antti Keränen <[email protected]>
> Sent: Thursday, July 8, 2021 11:54 AM
> To: [email protected]
> Cc: Antti Keränen <[email protected]>; Hannu Hartikainen
> <[email protected]>; Lars-Peter Clausen <[email protected]>; Hennerich,
> Michael <[email protected]>; Sa, Nuno
> <[email protected]>; Jonathan Cameron <[email protected]>;
> open list <[email protected]>
> Subject: [PATCH v2] iio: adis: set GPIO reset pin direction
>
> Set reset pin direction to output as the reset pin needs to be an active
> low output pin.
>
> Co-developed-by: Hannu Hartikainen <[email protected]>
> Signed-off-by: Hannu Hartikainen <[email protected]>
> Signed-off-by: Antti Keränen <[email protected]>
> ---
> Removed unnecessary toggling of the pin as requested by Lars-Peter. I
> missed out on the conversation, but I agree this is better.
>
> drivers/iio/imu/adis.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c
> index 319b64b2fd88..f8b7837d8b8f 100644
> --- a/drivers/iio/imu/adis.c
> +++ b/drivers/iio/imu/adis.c
> @@ -415,12 +415,11 @@ 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_HIGH);
> if (IS_ERR(gpio))
> return PTR_ERR(gpio);
>
> if (gpio) {
> - gpiod_set_value_cansleep(gpio, 1);
> msleep(10);
> /* bring device out of reset */
> gpiod_set_value_cansleep(gpio, 0);
> --

Reviewed-by: Nuno Sá <[email protected]>


Thanks!

- Nuno Sá

2021-07-10 17:34:23

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH v2] iio: adis: set GPIO reset pin direction

On Thu, 8 Jul 2021 12:54:29 +0300
Antti Keränen <[email protected]> wrote:

> Set reset pin direction to output as the reset pin needs to be an active
> low output pin.
>
> Co-developed-by: Hannu Hartikainen <[email protected]>
> Signed-off-by: Hannu Hartikainen <[email protected]>
> Signed-off-by: Antti Keränen <[email protected]>

Hi Antti,

For future reference (in IIO anyway as not all maintainers agree on this!)
please don't send a v2 in reply to v1. It gets lots if anyone is using
a threaded email client as it's buried deep. If I'd not been following
the discussion I'd probably have missed this.

Seems correct to me, but will leave on list a few more days as rc1 isn't
out yet so I don't have a good based to start collecting fixes on a the
moment.

Jonathan

> ---
> Removed unnecessary toggling of the pin as requested by Lars-Peter. I
> missed out on the conversation, but I agree this is better.
>
> drivers/iio/imu/adis.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c
> index 319b64b2fd88..f8b7837d8b8f 100644
> --- a/drivers/iio/imu/adis.c
> +++ b/drivers/iio/imu/adis.c
> @@ -415,12 +415,11 @@ 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_HIGH);
> if (IS_ERR(gpio))
> return PTR_ERR(gpio);
>
> if (gpio) {
> - gpiod_set_value_cansleep(gpio, 1);
> msleep(10);
> /* bring device out of reset */
> gpiod_set_value_cansleep(gpio, 0);

2021-07-13 17:52:37

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH v2] iio: adis: set GPIO reset pin direction

On Thu, 8 Jul 2021 12:54:29 +0300
Antti Keränen <[email protected]> wrote:

> Set reset pin direction to output as the reset pin needs to be an active
> low output pin.
>
> Co-developed-by: Hannu Hartikainen <[email protected]>
> Signed-off-by: Hannu Hartikainen <[email protected]>
> Signed-off-by: Antti Keränen <[email protected]>

So this sits on the boundary of whether it is a fix or not.
Do we want this to go into rc1 + stable?

If so a fixes tag would be great.

Thanks,

Jonathan

> ---
> Removed unnecessary toggling of the pin as requested by Lars-Peter. I
> missed out on the conversation, but I agree this is better.
>
> drivers/iio/imu/adis.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c
> index 319b64b2fd88..f8b7837d8b8f 100644
> --- a/drivers/iio/imu/adis.c
> +++ b/drivers/iio/imu/adis.c
> @@ -415,12 +415,11 @@ 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_HIGH);
> if (IS_ERR(gpio))
> return PTR_ERR(gpio);
>
> if (gpio) {
> - gpiod_set_value_cansleep(gpio, 1);
> msleep(10);
> /* bring device out of reset */
> gpiod_set_value_cansleep(gpio, 0);

2021-07-14 10:09:21

by Antti Keränen

[permalink] [raw]
Subject: Re: [PATCH v2] iio: adis: set GPIO reset pin direction

On Tue, Jul 13, 2021 at 06:53:11PM +0100, Jonathan Cameron wrote:
> So this sits on the boundary of whether it is a fix or not.
> Do we want this to go into rc1 + stable?

I'm not familiar enough with kernel development to give any opinions of
where this should go, but I would say this is a fix as the current code
won't work with certain hardware configurations.

> If so a fixes tag would be great.

This would mean a v3 patch with fixes tag included into the commit
message, right?

--
Antti

2021-07-14 12:44:39

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH v2] iio: adis: set GPIO reset pin direction

On Wed, 14 Jul 2021 13:04:45 +0300
Antti Ker?nen <[email protected]> wrote:

> On Tue, Jul 13, 2021 at 06:53:11PM +0100, Jonathan Cameron wrote:
> > So this sits on the boundary of whether it is a fix or not.
> > Do we want this to go into rc1 + stable?
>
> I'm not familiar enough with kernel development to give any opinions of
> where this should go, but I would say this is a fix as the current code
> won't work with certain hardware configurations.
>
> > If so a fixes tag would be great.
>
> This would mean a v3 patch with fixes tag included into the commit
> message, right?
>

Send the fixes tag in reply to this and I'll make sure it's added.
No need to bother with a v3 for just that.

Thanks,

Jonathan

2021-07-14 18:29:42

by Antti Keränen

[permalink] [raw]
Subject: Re: [PATCH v2] iio: adis: set GPIO reset pin direction

On Wed, Jul 14, 2021 at 01:40:05PM +0100, Jonathan Cameron wrote:
> Send the fixes tag in reply to this and I'll make sure it's added.
> No need to bother with a v3 for just that.

Fixes: ecb010d44108 ("iio: imu: adis: Refactor adis_initial_startup")

--
Antti

2021-07-17 17:40:09

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH v2] iio: adis: set GPIO reset pin direction

On Wed, 14 Jul 2021 21:25:07 +0300
Antti Keränen <[email protected]> wrote:

> On Wed, Jul 14, 2021 at 01:40:05PM +0100, Jonathan Cameron wrote:
> > Send the fixes tag in reply to this and I'll make sure it's added.
> > No need to bother with a v3 for just that.
>
> Fixes: ecb010d44108 ("iio: imu: adis: Refactor adis_initial_startup")
Great.

Applied to the fixes-togreg branch of iio.git and marked for stable.

Thanks,

Jonathan

>