]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iio: accel: bma220: turn power supplies on
authorPetre Rodan <petre.rodan@subdimension.ro>
Sun, 5 Oct 2025 13:12:18 +0000 (16:12 +0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 19 Oct 2025 10:59:19 +0000 (11:59 +0100)
Add devm_regulator_bulk_get_enable() to device probe().

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/accel/bma220_core.c

index 050282f20d903bb9ad299bff71c43e6cb8dc8260..31fbea971230d86e56a1555c2505fe32144cc936 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/pm.h>
+#include <linux/regulator/consumer.h>
 #include <linux/types.h>
 #include <linux/spi/spi.h>
 
@@ -231,6 +232,12 @@ static int bma220_init(struct spi_device *spi)
 {
        int ret;
        struct device *dev = &spi->dev;
+       static const char * const regulator_names[] = { "vddd", "vddio", "vdda" };
+
+       ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(regulator_names),
+                                            regulator_names);
+       if (ret)
+               return dev_err_probe(dev, ret, "Failed to get regulators\n");
 
        ret = bma220_read_reg(spi, BMA220_REG_ID);
        if (ret < 0)