- ti,current-critical-limit-ma: Current critical limit for the given channel.
- ti,shunt-resistor-mohm: Shunt register in milli ohm.
+IIO channel properties:
+It follows same mechanism for iio properties detailed on ../iio-bindings.txt
+The iio cells size must be 1.
+ #io-channel-cells = <1>;
+The ina3221 driver provides following monitoring:
+ voltage, current, current_trigger, power, power_trigger.
+ The sequence of index assigned in drivers are:
+ voltage, current, current_trigger, power, power_trigger
+ The above monitoring is provided for channel 0, 1 and 2.
+The sysfs are
+ in_voltage0_input, in_current0_input, in_current0_trigger_input
+ in_power0_input, in_power0_trigger_input
+ in_voltage1_input, in_current1_input, in_current1_trigger_input,
+ in_power1_input, in_power1_trigger_input
+ in_voltage2_input, in_current2_input, in_current2_trigger_input,
+ in_power2_input,in_power2_trigger_input
+The channel index are in above sequence starting from 0.
+
+To ease the DT entry, the macros are added in header dt-bindings/iio/meter/ina3221x.h
+The Voltage/current/power macros are defines and can be use with INA3221_CHAN_INDEX to
+get the proper index.
+Example: For Channel 0, normal power it is INA3221_CHAN_INDEX(0, POWER, NORMAL)
+for channel 2, normal current it is INA3221_CHAN_INDEX(2, CURRENT, NORMAL).
+
+The typical macro for voltage/current and powers are:
+ INA3221_VOLTAGE, INA3221_CURRENT, INA3221_POWER
+The typical macro for normal/trigger are INA3221_NORMAL and INA3221_TRIGGER.
+
+The INA3221_CHAN_INDEX defined as:
+#define INA3221_CHAN_INDEX(chan, type, add) (chan * 5 + INA3221_##type + INA3221_##add)
+
Example:
ina3221x@40 {
compatible = "ti,ina3221x";
ti,continuous-config = <0x7c07>;
#address-cells = <1>;
#size-cells = <0>;
+ #io-channel-cells = <1>;
channel@0 {
reg = <0x0>;
};
};
+
+clients {
+ io-channels = <&ina3221x INA3221_CHAN_INDEX(0, CURRENT, NORMAL)>;
+ io-channel-names = "battery-current"
+}
--- /dev/null
+/* This header provides constants for binding ti,ina3221x */
+
+#ifndef _DT_BINDINGS_IIO_METER_INA3221X_H
+#define _DT_BINDINGS_IIO_METER_INA3221X_H
+
+/* Channel numbers */
+#define INA3221_CHANNEL0 0
+#define INA3221_CHANNEL1 1
+#define INA3221_CHANNEL2 2
+
+/* Monitor type */
+#define INA3221_VOLTAGE 0
+#define INA3221_CURRENT 1
+#define INA3221_POWER 3
+
+/* Measurement technique normal/trigger */
+#define INA3221_NORMAL 0
+#define INA3221_TRIGGER 1
+
+/* To get the iio spec index */
+#define INA3221_CHAN_INDEX(chan, type, add) \
+ (chan * 5 + INA3221_##type + INA3221_##add)
+
+#endif