[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241124-ds2482-add-reg-v3-1-806df39c9454@gmail.com>
Date: Sun, 24 Nov 2024 17:21:35 +0100
From: Kryštof Černý via B4 Relay <devnull+cleverline1mc.gmail.com@...nel.org>
To: Krzysztof Kozlowski <krzk@...nel.org>, Rob Herring <robh@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Stefan Wahren <stefan.wahren@...rgebyte.com>
Cc: Ben Gardner <bgardner@...tec.com>, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org,
Kryštof Černý <cleverline1mc@...il.com>
Subject: [PATCH v3 1/3] w1: ds2482: Add regulator support
From: Kryštof Černý <cleverline1mc@...il.com>
Adds a support for attaching a supply regulator.
Signed-off-by: Kryštof Černý <cleverline1mc@...il.com>
---
drivers/w1/masters/ds2482.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/w1/masters/ds2482.c b/drivers/w1/masters/ds2482.c
index a2ecbb863c57f38bffc8e3cd463db1940e603179..4cb05d00cb6743abc5699583f591ef9b5339b44e 100644
--- a/drivers/w1/masters/ds2482.c
+++ b/drivers/w1/masters/ds2482.c
@@ -15,6 +15,7 @@
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/delay.h>
+#include <linux/regulator/consumer.h>
#include <linux/w1.h>
@@ -445,6 +446,7 @@ static int ds2482_probe(struct i2c_client *client)
int err = -ENODEV;
int temp1;
int idx;
+ int ret;
if (!i2c_check_functionality(client->adapter,
I2C_FUNC_SMBUS_WRITE_BYTE_DATA |
@@ -457,6 +459,12 @@ static int ds2482_probe(struct i2c_client *client)
goto exit;
}
+ ret = devm_regulator_get_enable(&client->dev, "vcc");
+ if (ret) {
+ dev_err(&client->dev, "Fail to enable regulator\n");
+ return ret;
+ }
+
data->client = client;
i2c_set_clientdata(client, data);
--
2.39.5
Powered by blists - more mailing lists