iio: temperature: ltc2983: support vdd regulator
authorNuno Sa <nuno.sa@analog.com>
Thu, 4 Apr 2024 08:58:18 +0000 (10:58 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 6 Apr 2024 15:49:24 +0000 (16:49 +0100)
Add support for the power supply regulator.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240404-ltc2983-misc-improv-v5-2-c1f58057fcea@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/temperature/ltc2983.c

index 3c4524d57b8e64edc36b516cfee2083b2d3b7ab6..24d19f3c7292742c64bd47e17d8d4fa384f95853 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/module.h>
 #include <linux/property.h>
 #include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
 #include <linux/spi/spi.h>
 
 #include <asm/byteorder.h>
@@ -1597,6 +1598,10 @@ static int ltc2983_probe(struct spi_device *spi)
        if (ret)
                return ret;
 
+       ret = devm_regulator_get_enable(&spi->dev, "vdd");
+       if (ret)
+               return ret;
+
        gpio = devm_gpiod_get_optional(&st->spi->dev, "reset", GPIOD_OUT_HIGH);
        if (IS_ERR(gpio))
                return PTR_ERR(gpio);