Re: [PATCH 1/2] iio: ltc2983: add support for optional reset gpio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 20, 2021 at 9:53 AM Nuno Sá <nuno.sa@xxxxxxxxxx> wrote:
>
> Check if an optional reset gpio is present and if so, make sure to reset
> the device.
>

Just one note/question inline.

> Signed-off-by: Nuno Sá <nuno.sa@xxxxxxxxxx>
> ---
>  drivers/iio/temperature/ltc2983.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/drivers/iio/temperature/ltc2983.c b/drivers/iio/temperature/ltc2983.c
> index 3b4a0e60e605..37903e9fb90f 100644
> --- a/drivers/iio/temperature/ltc2983.c
> +++ b/drivers/iio/temperature/ltc2983.c
> @@ -1470,6 +1470,7 @@ static int ltc2983_probe(struct spi_device *spi)
>  {
>         struct ltc2983_data *st;
>         struct iio_dev *indio_dev;
> +       struct gpio_desc *gpio;
>         const char *name = spi_get_device_id(spi)->name;
>         int ret;
>
> @@ -1494,6 +1495,16 @@ static int ltc2983_probe(struct spi_device *spi)
>         if (ret)
>                 return ret;
>
> +       gpio = devm_gpiod_get_optional(&st->spi->dev, "reset", GPIOD_OUT_HIGH);
> +       if (IS_ERR(gpio))
> +               return PTR_ERR(gpio);
> +
> +       if (gpio) {
> +               /* bring device out of reset */
> +               usleep_range(1000, 1005);
> +               gpiod_set_value_cansleep(gpio, 0);

Datasheet mentions that it takes up to 100 ms for the device to fully start-up.
It also mentions that the (command) status register will be
unavailable to the user before this point.
Page 16, Conversion State Details section, second paragraph.

I think there should probably be a sleep here of 100 ms.

Other than that change looks good.

> +       }
> +
>         ret = ltc2983_setup(st, true);
>         if (ret)
>                 return ret;
> --
> 2.33.0
>




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux