Skip to content

Commit 3e749ce

Browse files
jacmetgroeck
authored andcommitted
hwmon: (tmp102) add vcc regulator support
Make it optional for backwards compatibility. Signed-off-by: Peter Korsgaard <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 03abdce commit 3e749ce

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/hwmon/tmp102.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/device.h>
1717
#include <linux/jiffies.h>
1818
#include <linux/regmap.h>
19+
#include <linux/regulator/consumer.h>
1920
#include <linux/of.h>
2021

2122
#define DRIVER_NAME "tmp102"
@@ -204,6 +205,10 @@ static int tmp102_probe(struct i2c_client *client)
204205
return -ENODEV;
205206
}
206207

208+
err = devm_regulator_get_enable_optional(dev, "vcc");
209+
if (err < 0 && err != -ENODEV)
210+
return dev_err_probe(dev, err, "Failed to enable regulator\n");
211+
207212
tmp102 = devm_kzalloc(dev, sizeof(*tmp102), GFP_KERNEL);
208213
if (!tmp102)
209214
return -ENOMEM;

0 commit comments

Comments
 (0)