Skip to contentSkip to conversation

Add an initial DT binding doc for ina3221

PATCH Superseded Nicolin Chen 1 participant 4 messages Sep 21, 2018

Subsystems (3)

v2 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add an initial DT binding doc for ina3221

This series adds a initial DT binding doc for ina3221. It defines a child node to describe the input source of each ina3221 channel. Then it changes the driver to handle the information properly.

Changelog
v1->v2:
* Redefined DT bindings (detail in PATCH-1)
* Changed the driver code accordingly (detail in PATCH-2)

 .../devicetree/bindings/hwmon/ina3221.txt     |  38 ++++++
 Documentation/hwmon/ina3221                   |   1 +
 drivers/hwmon/ina3221.c                       | 126 ++++++++++++++++--
 3 files changed, 155 insertions(+), 10 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/hwmon/ina3221.txt
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/2 dt-bindings: hwmon: Add ina3221 documentation

Texas Instruments INA3221 is a triple-channel shunt and bus voltage monitor. This patch adds a DT binding doc for it.

---
Changelog
v1->v2:
* Dropped channel name properties
* Added child node definitions.
* * Added shunt resistor property in the child node
* * Added status property to indicate connection status
* * Changed to use child node name as the label of input source

 .../devicetree/bindings/hwmon/ina3221.txt     | 38 +++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/ina3221.txt
Documentation/devicetree/bindings/hwmon/ina3221.txt new file +38 -0
new file mode 100644
index 000000000000..02a2ffbb7c3f
@@ -0,0 +1,38 @@
+ina3221 properties
+
+1) ina3221 node
+  Required properties:
+  - compatible: Must be "ti,ina3221"
+  - reg: I2C address
+
+  = The node contains optional child nodes for three channels =
+  = Each child node describes the information of input source =
+
+  Example:
+
+  ina3221@40 {
+          compatible = "ti,ina3221";
+          reg = <0x40>;
+          [ child node definitions... ]
+  };
+
+2) child nodes
+  The names of child nodes should indicate input source names
+
+  Required properties:
+  - input-id: Must be 1, 2 or 3
+
+  Optional properties:
+  - shunt-resistor: Shunt resistor value in micro-Ohm
+  - status: Should be "disabled" if no input source
+
+  Example:
+
+  input1 {
+          input-id = <0x1>;
+          status = "disabled";
+  };
+  VDD_GPU {
+          input-id = <0x2>;
+          shunt-resistor = <5>;
+  };
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH v2 1/2] dt-bindings: hwmon: Add ina3221 documentation

Found two mistakes at this doc, sending v3.

Review line 2

Quoted 4 lines · Nicolin Chen

+++ b/Documentation/devicetree/bindings/hwmon/ina3221.txt

(quoted diff) +2 -0
@@ -0,0 +1,38 @@
+ina3221 properties
+

Should be a description of the doc.

Documentation/devicetree/bindings/hwmon/ina3221.txt line 37

Quoted 2 lines
Documentation/devicetree/bindings/hwmon/ina3221.txt new file +2 -0
+  VDD_GPU {
+          shunt-resistor = <5>;

Should be <5000>.

#3 lore raw

PATCH v2 2/2 hwmon: ina3221: Read channel input source info from DT

In reply to Nicolin Chen

From: Nicolin Chen <[email protected]>

An ina3221 chip has three input ports. Each port is used to measure the voltage and current of its input source.

The DT binding now has defined bindings for their input sources, so the driver should read these information and handle accordingly.

This patch adds a new structure of input source specific information including input source label, shunt resistor value and its connection status. It exposes these labels via sysfs and also disables those channels where there's no input source being connected.

---
Changelog
v1->v2:
* Added a structure for input source corresponding to DT bindings
* Moved shunt resistor value to the structure
* Defined in[123]_label sysfs nodes instead of name[123]_input
* Updated probe() function to get information from DT
* Updated ina3221 hwmon documentation for the labels
* Dropped dynamical group definition to keep all groups as they were
* * Will send an incremental patch later apart from this DT binding series

 Documentation/hwmon/ina3221 |   1 +
 drivers/hwmon/ina3221.c     | 126 +++++++++++++++++++++++++++++++++---
 2 files changed, 117 insertions(+), 10 deletions(-)
Documentation/hwmon/ina3221 +1 -0
index 0ff74854cb2e..2726038be5bd 100644
@@ -22,6 +22,7 @@ Sysfs entries
 -------------
 
 in[123]_input           Bus voltage(mV) channels
+in[123]_label           Voltage channel labels
 curr[123]_input         Current(mA) measurement channels
 shunt[123]_resistor     Shunt resistance(uOhm) channels
 curr[123]_crit          Critical alert current(mA) setting, activates the
drivers/hwmon/ina3221.c +116 -10

231 lines not on this page · raw message

Signature · 1 line
2.17.1