]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/blob - Documentation/devicetree/bindings/iio/meter/ina3221.txt
8d4910280c86fcbdce89ad9ba373dc229752b6b7
[sojka/nv-tegra/linux-3.10.git] / Documentation / devicetree / bindings / iio / meter / ina3221.txt
1 DT binding document for INA3221 iio/meter driver.
2
3 Required properties:
4 - compatible: Must be "ti,ina3221x".
5 - reg: I2C slave address of device.
6
7 - ti,trigger-config: Trigger configuration for the device in trigger mode.
8 - ti,continuous-config:  Device configuration in continuous mode. In this mode
9         device will keep scanning the inputs.
10 - address-cells: Number of address in child node. Must be 1.
11 - size-cells: Size of address cell. Must be 0.
12
13 Optional sub-nodes:
14         Device has 3 input channels and channel specific information
15 is provided through the child node. Each channel will have different child
16 node. The channel number is identified by the reg properties on each of node.
17 Required subnode properties:
18 - reg: channel number. 0 for channel 0, 1 for channel 1 and 2 for channel 2.
19 - ti,rail-mae: Name of the channel in string.
20
21 Optional subnode properties:
22 - ti,current-warning-limit-ma: Cureent warning limit for the given channel.
23 - ti,current-critical-limit-ma: Current critical limit for the given channel.
24 - ti,shunt-resistor-mohm: Shunt register in milli ohm.
25
26 IIO channel properties:
27 It follows same mechanism for iio properties detailed on ../iio-bindings.txt
28 The iio cells size must be 1.
29         #io-channel-cells = <1>;
30 The ina3221 driver provides following monitoring:
31         voltage, current, current_trigger, power, power_trigger.
32         The sequence of index assigned in drivers are:
33                 voltage, current, current_trigger, power, power_trigger
34         The above monitoring is provided for channel 0, 1 and 2.
35 The sysfs are
36         in_voltage0_input, in_current0_input, in_current0_trigger_input
37         in_power0_input, in_power0_trigger_input
38         in_voltage1_input, in_current1_input, in_current1_trigger_input,
39         in_power1_input, in_power1_trigger_input
40         in_voltage2_input, in_current2_input, in_current2_trigger_input,
41         in_power2_input,in_power2_trigger_input
42 The channel index are in above sequence starting from 0.
43
44 To ease the DT entry, the macros are added in header dt-bindings/iio/meter/ina3221x.h
45 The Voltage/current/power macros are defines and can be use with INA3221_CHAN_INDEX to
46 get the proper index.
47 Example: For Channel 0, normal power it is INA3221_CHAN_INDEX(0, POWER, NORMAL)
48 for channel 2, normal current it is INA3221_CHAN_INDEX(2, CURRENT, NORMAL).
49
50 The typical macro for voltage/current and powers are:
51         INA3221_VOLTAGE, INA3221_CURRENT, INA3221_POWER
52 The typical macro for normal/trigger are INA3221_NORMAL and INA3221_TRIGGER.
53
54 The INA3221_CHAN_INDEX defined as:
55 #define INA3221_CHAN_INDEX(chan, type, add) (chan * 5 + INA3221_##type + INA3221_##add)
56
57 Example:
58         ina3221x@40 {
59                 compatible = "ti,ina3221x";
60                 reg = <0x40>;
61                 ti,trigger-config = <0x7003>;
62                 ti,continuous-config = <0x7c07>;
63                 #address-cells = <1>;
64                 #size-cells = <0>;
65                 #io-channel-cells = <1>;
66
67                 channel@0 {
68                         reg = <0x0>;
69                         ti,rail-name = "VDD_BAT";
70                         ti,current-warning-limit-ma = <8000>;
71                         ti,current-critical-limit-ma = <9000>;
72                         ti,shunt-resistor-mohm = <1>;
73                 };
74
75                 channel@1 {
76                         reg = <0x1>;
77                         ti,rail-name = "VDD_CPU";
78                         ti,shunt-resistor-mohm = <1>;
79                 };
80
81                 channel@2 {
82                         reg = <0x2>;
83                         ti,rail-name = "VDD_GPU";
84                         ti,shunt-resistor-mohm = <1>;
85                 };
86         };
87
88
89 clients {
90         io-channels = <&ina3221x INA3221_CHAN_INDEX(0, CURRENT, NORMAL)>;
91         io-channel-names = "battery-current"
92 }