[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250910-bma220_improvements-v2-6-e23f4f2b9745@subdimension.ro>
Date: Wed, 10 Sep 2025 10:57:11 +0300
From: Petre Rodan <petre.rodan@...dimension.ro>
To: Jonathan Cameron <jic23@...nel.org>,
David Lechner <dlechner@...libre.com>,
Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>
Cc: Jonathan Cameron <Jonathan.Cameron@...wei.com>,
linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, Petre Rodan <petre.rodan@...dimension.ro>
Subject: [PATCH v2 06/14] iio: accel: bma220: add get regulator check
Add devm_regulator_bulk_get_enable() to device probe().
Signed-off-by: Petre Rodan <petre.rodan@...dimension.ro>
---
no change
---
drivers/iio/accel/bma220_core.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/iio/accel/bma220_core.c b/drivers/iio/accel/bma220_core.c
index 6bc2e5c3fb6cebd50209acbcc2d5340630c27cd1..b6f1374a9cca52966c1055113710061a7284cf5a 100644
--- a/drivers/iio/accel/bma220_core.c
+++ b/drivers/iio/accel/bma220_core.c
@@ -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>
@@ -205,6 +206,13 @@ static const struct iio_info bma220_info = {
static int bma220_init(struct spi_device *spi)
{
int ret;
+ static const char * const regulator_names[] = { "vddd", "vddio", "vdda" };
+
+ ret = devm_regulator_bulk_get_enable(&spi->dev,
+ ARRAY_SIZE(regulator_names),
+ regulator_names);
+ if (ret)
+ return dev_err_probe(&spi->dev, ret, "Failed to get regulators\n");
ret = bma220_read_reg(spi, BMA220_REG_ID);
if (ret != BMA220_CHIP_ID)
--
2.49.1
Powered by blists - more mailing lists