From: Peter Korsgaard <peter@korsgaard.com>
To: Jean Delvare <jdelvare@suse.com>, Guenter Roeck <linux@roeck-us.net>
Cc: Peter Korsgaard <peter@korsgaard.com>,
linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] hwmon: (tmp102): add vcc regulator support
Date: Thu, 17 Apr 2025 20:04:26 +0200 [thread overview]
Message-ID: <20250417180426.3872314-2-peter@korsgaard.com> (raw)
In-Reply-To: <20250417180426.3872314-1-peter@korsgaard.com>
Make it optional for backwards compatibility.
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
drivers/hwmon/tmp102.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c
index 8af44a33055f3..a02daa496c9c4 100644
--- a/drivers/hwmon/tmp102.c
+++ b/drivers/hwmon/tmp102.c
@@ -16,6 +16,7 @@
#include <linux/device.h>
#include <linux/jiffies.h>
#include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
#include <linux/of.h>
#define DRIVER_NAME "tmp102"
@@ -204,6 +205,10 @@ static int tmp102_probe(struct i2c_client *client)
return -ENODEV;
}
+ err = devm_regulator_get_enable_optional(dev, "vcc");
+ if (err < 0 && err != -ENODEV)
+ return dev_err_probe(dev, err, "Failed to enable regulator\n");
+
tmp102 = devm_kzalloc(dev, sizeof(*tmp102), GFP_KERNEL);
if (!tmp102)
return -ENOMEM;
--
2.39.5
next prev parent reply other threads:[~2025-04-17 18:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-17 18:04 [PATCH 1/2] dt-bindings: hwmon: ti,tmp102: document optional V+ supply property Peter Korsgaard
2025-04-17 18:04 ` Peter Korsgaard [this message]
2025-04-23 14:17 ` [PATCH 2/2] hwmon: (tmp102): add vcc regulator support Guenter Roeck
2025-04-22 13:26 ` [PATCH 1/2] dt-bindings: hwmon: ti,tmp102: document optional V+ supply property Rob Herring
2025-04-22 13:31 ` Peter Korsgaard
2025-04-23 14:03 ` Rob Herring (Arm)
2025-04-23 14:17 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250417180426.3872314-2-peter@korsgaard.com \
--to=peter@korsgaard.com \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox