Skip to contentSkip to conversation

Add support for INA3221 Triple Current/Voltage Monitors

PATCH Superseded Andrew F. Davis 1 participant 3 messages May 31, 2016

Subsystems (3)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover Add support for INA3221 Triple Current/Voltage Monitors

Hello all,

This series adds support for the INA3221 Triple Current/Voltage Monitor.

Changes from v3:
- minor fixups from comments
- rebased on v4.7-rc1

Changes from v2:
- changed alarms to work on current
- added of_match_table
- other small fixups/typos

Changes from v1:
- rearranged and renumbered sysfs enteries
- added reading alert bits to sysfs
- removed internal power calculation
- added DT setting of shunt resistors
- various other minor fixups

Thanks,
Andrew

Andrew F. Davis (2):
hwmon: Define binding for the INA3221 hwmon driver
hwmon: Add support for INA3221 Triple Current/Voltage Monitors

 .../devicetree/bindings/hwmon/ina3221.txt          |  19 +
 Documentation/hwmon/ina3221                        |  35 ++
 drivers/hwmon/Kconfig                              |  11 +
 drivers/hwmon/Makefile                             |   1 +
 drivers/hwmon/ina3221.c                            | 451 +++++++++++++++++++++
 5 files changed, 517 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/ina3221.txt
 create mode 100644 Documentation/hwmon/ina3221
 create mode 100644 drivers/hwmon/ina3221.c
Signature · 1 line
2.8.3
#1 lore raw

PATCH v4 1/2 hwmon: Define binding for the INA3221 hwmon driver

Define a binding for the INA3221 Triple Current/Voltage Monitor.

---
 Documentation/devicetree/bindings/hwmon/ina3221.txt | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/ina3221.txt
Documentation/devicetree/bindings/hwmon/ina3221.txt new file +19 -0
new file mode 100644
index 0000000..8ec908b
@@ -0,0 +1,19 @@
+Texas Instruments INA3221 Triple I2C Current/Voltage Monitor
+
+Required properties:
+ - compatible		: Should be "ti,ina3221".
+ - reg			: I2C address of the device.
+
+Optional properties:
+ - shunt-resistors	: Shunt resistor values in micro-Ohms for each channel.
+
+Example:
+
+&i2c {
+	hw_monitor@40 {
+		compatible = "ti,ina3221";
+		reg = <0x40>;
+
+		shunt-resistors = <1000>, <2000>, <500>;
+	};
+};
Signature · 1 line
2.8.3
#2 lore raw

PATCH v4 2/2 hwmon: Add support for INA3221 Triple Current/Voltage Monitors

In reply to Andrew F. Davis

Add support for the the INA3221 26v capable, Triple channel, Bi-Directional, Zero-Drift, Low-/High-Side, Current/Voltage Monitor with I2C interface.

---
 Documentation/hwmon/ina3221 |  35 ++++
 drivers/hwmon/Kconfig       |  11 ++
 drivers/hwmon/Makefile      |   1 +
 drivers/hwmon/ina3221.c     | 451 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 498 insertions(+)
 create mode 100644 Documentation/hwmon/ina3221
 create mode 100644 drivers/hwmon/ina3221.c
Documentation/hwmon/ina3221 new file +35 -0
new file mode 100644
index 0000000..0ff7485
@@ -0,0 +1,35 @@
+Kernel driver ina3221
+=====================
+
+Supported chips:
+  * Texas Instruments INA3221
+    Prefix: 'ina3221'
+    Addresses: I2C 0x40 - 0x43
+    Datasheet: Publicly available at the Texas Instruments website
+               http://www.ti.com/
+
+Author: Andrew F. Davis <[email protected]>
+
+Description
+-----------
+
+The Texas Instruments INA3221 monitors voltage, current, and power on the high
+side of up to three D.C. power supplies. The INA3221 monitors both shunt drop
+and supply voltage, with programmable conversion times and averaging, current
+and power are calculated host-side from these.
+
+Sysfs entries
+-------------
+
+in[123]_input           Bus voltage(mV) channels
+curr[123]_input         Current(mA) measurement channels
+shunt[123]_resistor     Shunt resistance(uOhm) channels
+curr[123]_crit          Critical alert current(mA) setting, activates the
+                          corresponding alarm when the respective current
+                          is above this value
+curr[123]_crit_alarm    Critical alert current limit exceeded
+curr[123]_max           Warning alert current(mA) setting, activates the
+                          corresponding alarm when the respective current
+                          average is above this value.
+curr[123]_max_alarm     Warning alert current limit exceeded
+in[456]_input           Shunt voltage(uV) for channels 1, 2, and 3 respectively
drivers/hwmon/Kconfig +11 -0
index ff94007..e924d16 100644
@@ -1514,6 +1514,17 @@ config SENSORS_INA2XX
 	  This driver can also be built as a module.  If so, the module
 	  will be called ina2xx.
 
+config SENSORS_INA3221
+	tristate "Texas Instruments INA3221 Triple Power Monitor"
+	depends on I2C
+	select REGMAP_I2C
+	help
+	  If you say yes here you get support for  the TI INA3221 Triple Power
+	  Monitor.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called ina3221.
+
 config SENSORS_TC74
 	tristate "Microchip TC74"
 	depends on I2C
drivers/hwmon/Makefile +1 -0
index 2ef5b7c..91da96a 100644
@@ -77,6 +77,7 @@ obj-$(CONFIG_SENSORS_IBMPOWERNV)+= ibmpowernv.o
 obj-$(CONFIG_SENSORS_IIO_HWMON) += iio_hwmon.o
 obj-$(CONFIG_SENSORS_INA209)	+= ina209.o
 obj-$(CONFIG_SENSORS_INA2XX)	+= ina2xx.o
+obj-$(CONFIG_SENSORS_INA3221)	+= ina3221.o
 obj-$(CONFIG_SENSORS_IT87)	+= it87.o
 obj-$(CONFIG_SENSORS_JC42)	+= jc42.o
 obj-$(CONFIG_SENSORS_JZ4740)	+= jz4740-hwmon.o
drivers/hwmon/ina3221.c new file +451 -0

451 lines not on this page · raw message

Signature · 1 line
2.8.3