Skip to contentSkip to conversation

dt-bindings: hwmon: ti,tmp102: document optional V+ supply property

PATCH Applied Peter Korsgaard 3 participants 7 messages Apr 17, 2025 – Apr 23, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 dt-bindings: hwmon: ti,tmp102: document optional V+ supply property

TMP102 is powered by its V+ supply, document it. The property is called "vcc-supply" since the plus sign (+) is not a valid property character.

---
 Documentation/devicetree/bindings/hwmon/ti,tmp102.yaml | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/hwmon/ti,tmp102.yaml +4 -0
index 7e5b62a0215dd..4c89448eba0dc 100644
@@ -23,6 +23,9 @@ properties:
   "#thermal-sensor-cells":
     const: 1
 
+  vcc-supply:
+    description: Power supply for tmp102
+
 required:
   - compatible
   - reg
@@ -42,6 +45,7 @@ examples:
             reg = <0x48>;
             interrupt-parent = <&gpio7>;
             interrupts = <16 IRQ_TYPE_LEVEL_LOW>;
+            vcc-supply = <&supply>;
             #thermal-sensor-cells = <1>;
         };
     };
Signature · 1 line
2.39.5
#1 lore raw

PATCH 2/2 hwmon: (tmp102): add vcc regulator support

Make it optional for backwards compatibility.

---
 drivers/hwmon/tmp102.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/hwmon/tmp102.c +5 -0
index 8af44a33055f3..a02daa496c9c4 100644
@@ -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;
Signature · 1 line
2.39.5
maintainer
#3 lore raw
In reply to Peter Korsgaard
Quoted 2 lines · Peter Korsgaard

TMP102 is powered by its V+ supply, document it. The property is called "vcc-supply" since the plus sign (+) is not a valid property character.

Wouldn't "vplus-supply" or "vp-supply" work?

Quoted 31 lines
---
 Documentation/devicetree/bindings/hwmon/ti,tmp102.yaml | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/hwmon/ti,tmp102.yaml +4 -0
index 7e5b62a0215dd..4c89448eba0dc 100644
@@ -23,6 +23,9 @@ properties:
   "#thermal-sensor-cells":
     const: 1
 
+  vcc-supply:
+    description: Power supply for tmp102
+
 required:
   - compatible
   - reg
@@ -42,6 +45,7 @@ examples:
             reg = <0x48>;
             interrupt-parent = <&gpio7>;
             interrupts = <16 IRQ_TYPE_LEVEL_LOW>;
+            vcc-supply = <&supply>;
             #thermal-sensor-cells = <1>;
         };
     };
Signature · 1 line
2.39.5
#4 lore raw
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Rob" == Rob Herring <[email protected]> writes:

Quoted 2 lines · Peter Korsgaard

TMP102 is powered by its V+ supply, document it. The property is called "vcc-supply" since the plus sign (+) is not a valid property character.

Wouldn't "vplus-supply" or "vp-supply" work?

It could, but gcc-supply is what we use for the very similar tmp108 binding, so I think it makes sense to use that here for consistency as well:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=699383466851e3fb8284e1eefeed78ec30989b3b

Signature · 1 line
Bye, Peter Korsgaard