[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240923-veml6035-v2-5-58c72a0df31c@gmail.com>
Date: Mon, 23 Sep 2024 00:17:53 +0200
From: Javier Carrasco <javier.carrasco.cruz@...il.com>
To: Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Rishi Gupta <gupt21@...il.com>
Cc: linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Javier Carrasco <javier.carrasco.cruz@...il.com>
Subject: [PATCH v2 05/10] iio: light: veml6030: add support for a regulator
Use the device managed function from the regulator API to get and enable
a regulator powering the device.
Use "vdd" as the ID to account for the provided name in the datasheet.
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@...il.com>
---
drivers/iio/light/veml6030.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/iio/light/veml6030.c b/drivers/iio/light/veml6030.c
index ccabd4c844e4..89c98bfc5191 100644
--- a/drivers/iio/light/veml6030.c
+++ b/drivers/iio/light/veml6030.c
@@ -14,6 +14,7 @@
#include <linux/regmap.h>
#include <linux/interrupt.h>
#include <linux/pm_runtime.h>
+#include <linux/regulator/consumer.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/events.h>
@@ -807,6 +808,11 @@ static int veml6030_probe(struct i2c_client *client)
data->client = client;
data->regmap = regmap;
+ ret = devm_regulator_get_enable(&client->dev, "vdd");
+ if (ret)
+ return dev_err_probe(&client->dev, ret,
+ "failed to enable regulator\n");
+
indio_dev->name = "veml6030";
indio_dev->channels = veml6030_channels;
indio_dev->num_channels = ARRAY_SIZE(veml6030_channels);
--
2.43.0
Powered by blists - more mailing lists