Skip to contentSkip to conversation

dt-bindings: iio: afe: current-sense-amplifier: Add io-channel-cells

PATCH Applied Primoz Fiser 4 participants 5 messages Sep 5, 2025 – Sep 11, 2025

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

PATCH v2 1/2 dt-bindings: iio: afe: current-sense-amplifier: Add io-channel-cells

The current-sense-amplifier is an IIO provider thus can be referenced by IIO consumers (via "io-channels" property in consumer device node). Such provider is required to describe number of cells used in phandle lookup with "io-channel-cells" property.

---
Changes in v2:
- refactor commit msg drop warnings introduced by commit #2
- drop Fixes: tag

Link to v1: https://lore.kernel.org/all/[email protected]/

 .../devicetree/bindings/iio/afe/current-sense-amplifier.yaml  | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.yaml +4 -0
index 527501c1d695..bcf4ddcfd13b 100644
@@ -24,6 +24,9 @@ properties:
     description: |
       Channel node of a voltage io-channel.
 
+  "#io-channel-cells":
+    const: 0
+
   sense-resistor-micro-ohms:
     description: The sense resistance.
 
@@ -46,6 +49,7 @@ examples:
   - |
     sysi {
         compatible = "current-sense-amplifier";
+        #io-channel-cells = <0>;
         io-channels = <&tiadc 0>;
 
         sense-resistor-micro-ohms = <20000>;
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 2/2 arm64: dts: freescale: imx93-phyboard-nash: Current sense via iio-hwmon

Commit 21179eae56de ("arm64: dts: freescale: imx93-phyboard-nash: Add current sense amplifier") added information about the current sensing circuitry found on the board. Now, lets provide current sense reading also via IIO-hwmon subsystem. This way, SoM current can be read directly via sysfs property more conveniently for the customers. No need for them to manually apply scaling factor calculations anymore.

---
Changes in v2:
- no changes

Link to v1: https://lore.kernel.org/all/[email protected]/

 arch/arm64/boot/dts/freescale/imx93-phyboard-nash.dts | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx93-phyboard-nash.dts +7 -1
index 71a0e9f270af..d05645f25bba 100644
@@ -27,8 +27,9 @@ chosen {
 		stdout-path = &lpuart1;
 	};
 
-	current-sense {
+	curr_sens: current-sense {
 		compatible = "current-sense-amplifier";
+		#io-channel-cells = <0>;
 		io-channels = <&adc1 1>;
 		sense-gain-div = <2>;
 		sense-gain-mult = <50>;
@@ -44,6 +45,11 @@ flexcan1_tc: can-phy0 {
 		standby-gpios = <&gpio4 16 GPIO_ACTIVE_HIGH>;
 	};
 
+	iio-hwmon {
+		compatible = "iio-hwmon";
+		io-channels = <&curr_sens 0>;
+	};
+
 	reg_usdhc2_vmmc: regulator-usdhc2 {
 		compatible = "regulator-fixed";
 		gpio = <&gpio3 7 GPIO_ACTIVE_HIGH>;
Signature · 1 line
2.34.1
Applied
#2 lore raw

Re: [PATCH v2 2/2] arm64: dts: freescale: imx93-phyboard-nash: Current sense via iio-hwmon

Quoted 8 lines · Primoz Fiser

Commit 21179eae56de ("arm64: dts: freescale: imx93-phyboard-nash: Add current sense amplifier") added information about the current sensing circuitry found on the board. Now, lets provide current sense reading also via IIO-hwmon subsystem. This way, SoM current can be read directly via sysfs property more conveniently for the customers. No need for them to manually apply scaling factor calculations anymore.

Applied, thanks!

Reviewed-by on v2 1/2
#3 lore raw
In reply to Primoz Fiser
Quoted 10 lines · Primoz Fiser

The current-sense-amplifier is an IIO provider thus can be referenced by IIO consumers (via "io-channels" property in consumer device node). Such provider is required to describe number of cells used in phandle lookup with "io-channel-cells" property.

---
Changes in v2:
- refactor commit msg drop warnings introduced by commit #2
- drop Fixes: tag

Best regards,
Krzysztof

maintainer Applied
#4 lore raw
Quoted 6 lines · On Fri, 5 Sep 2025 10:20:37 +0200 Krzysztof Kozlowski <[email protected]> wrote:
Quoted 5 lines · Primoz Fiser

The current-sense-amplifier is an IIO provider thus can be referenced by IIO consumers (via "io-channels" property in consumer device node). Such provider is required to describe number of cells used in phandle lookup with "io-channel-cells" property.

Quoted 7 lines
Quoted 5 lines

---
Changes in v2:
- refactor commit msg drop warnings introduced by commit #2
- drop Fixes: tag

Applied this patch to the togreg branch of iio.git.
I'll push that out as testing now because some other stuff on there will benefit from 0-day taking a first look at it.

Thanks,

Jonathan

Quoted 4 lines

Best regards,
Krzysztof