diff options
author | Nuno Sá <nuno.sa@analog.com> | 2021-08-25 10:41:48 +0200 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2021-09-14 12:00:32 +0100 |
commit | 919726c9e0efc6dd6476095d37b3ba8e79566c75 (patch) | |
tree | c7e46d9a7fed5d27fdc3511095e02434d5f5c398 /drivers/iio/temperature | |
parent | 26df977a909f818b7d346b3990735513e7e0bf93 (diff) | |
download | lwn-919726c9e0efc6dd6476095d37b3ba8e79566c75.tar.gz lwn-919726c9e0efc6dd6476095d37b3ba8e79566c75.zip |
iio: ltc2983: add support for optional reset gpio
Check if an optional reset gpio is present and if so, make sure to reset
the device.
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210825084149.11587-1-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/temperature')
-rw-r--r-- | drivers/iio/temperature/ltc2983.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/iio/temperature/ltc2983.c b/drivers/iio/temperature/ltc2983.c index 3b4a0e60e605..22e6a26ce6b1 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 the device out of reset */ + usleep_range(1000, 1200); + gpiod_set_value_cansleep(gpio, 0); + } + ret = ltc2983_setup(st, true); if (ret) return ret; |