Skip to contentSkip to conversation

hwmon: add INA209 driver

RFC New Ira Snyder 1 participant 1 message Oct 16, 2008

Subsystems (2)
lore
Share & tools
lore

Ira Snyder

author
#0 lore raw

RFC 1/1 hwmon: add INA209 driver

Add Linux support for the Texas Intstruments / Burr Brown INA209 voltage / current / power monitor I2C interface.

---

This driver is definitely not ready for inclusion, however, I hope there aren't too many mistakes.

The biggest problem is the calibration register, whose value is used to calculate the power and current values, as well as their maximum range. Without programming the appropriate value, the registers are meaningless. I currently added a sysfs node so the value could be set easily. However, I hardcoded the meanings of the power and current registers using a calibration value of 4096, which is appropriate for my board.

I'm looking for suggestions here :)

Other than that, I think everything should be in pretty good shape.

 Documentation/hwmon/ina209 |   83 ++++++
 drivers/hwmon/Kconfig      |   11 +
 drivers/hwmon/Makefile     |    1 +
 drivers/hwmon/ina209.c     |  598 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 693 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/hwmon/ina209
 create mode 100644 drivers/hwmon/ina209.c
Documentation/hwmon/ina209 new file +82 -0
new file mode 100644
index 0000000..97936e4
@@ -0,0 +1,83 @@
+Kernel driver ina209
+==========+
+Supported chips:
+  * Burr-Brown / Texas Instruments INA209
+    Prefix: 'ina209'
+    Addresses scanned: 0x40-0x4f
+    Datasheet:
+        http://www.ti.com/lit/gpn/ina209
+
+Author: Paul Hays <[email protected]>
+Author: Ira W. Snyder <[email protected]>
+
+
+Description
+-----------
+
+The Burr-Brown INA209 monitors voltage and current on the high side
+of a D.C. power supply. It can perform measurements and calculations
+in the background to supply readings at any time. It includes a
+programmable calibration multiplier to scale the displayed current
+and power values.
+
+
+Sysfs entries
+-------------
+
+The INA209 chip is highly configurable both via hardwiring and via
+the I2C bus. See the datasheet for details.
+
+This tries to expose most monitoring features of the hardware via
+sysfs. It does not support every feature of this chip.
+
+
+calibration		calibration register, see remarks below
+
+in0_input		shunt voltage (mV)
+in0_input_highest	shunt voltage historical maximum reading (mV)
+in0_input_lowest	shunt voltage historical minimum reading (mV)
+in0_max			shunt voltage max alarm limit (mV)
+in0_min			shunt voltage min alarm limit (mV)
+in0_crit_max		shunt voltage crit max alarm limit (mV)
+in0_crit_min		shunt voltage crit min alarm limit (mV)
+in0_max_alarm		shunt voltage max alarm limit exceeded
+in0_min_alarm		shunt voltage min alarm limit exceeded
+in0_crit_max_alarm	shunt voltage crit max alarm limit exceeded
+in0_crit_min_alarm	shunt voltage crit min alarm limit exceeded
+
+in1_input		bus voltage (mV)
+in1_input_highest	bus voltage historical maximum reading (mV)
+in1_input_lowest	bus voltage historical minimum reading (mV)
+in1_max			bus voltage max alarm limit (mV)
+in1_min			bus voltage min alarm limit (mV)
+in1_crit_max		bus voltage crit max alarm limit (mV)
+in1_crit_min		bus voltage crit min alarm limit (mV)
+in1_max_alarm		bus voltage max alarm limit exceeded
+in1_min_alarm		bus voltage min alarm limit exceeded
+in1_crit_max_alarm	bus voltage crit max alarm limit exceeded
+in1_crit_min_alarm	bus voltage crit min alarm limit exceeded
+
+power1_input		power measurement (uW)
+power1_input_highest	power historical maximum reading (uW)
+power1_max		power max alarm limit (uW)
+power1_crit		power crit alarm limit (uW)
+power1_alarm		power max alarm limit exceeded
+power1_crit_alarm	power crit alarm limit exceeded
+
+curr1_input		current measurement (mA)
+
+
+General Remarks
+---------------
+
+You will need to write the correct value to the calibration register
+for this chip to function properly. TI provides a Windows-only tool
+that will calculate the values for you. The datasheet has the specifics
+on the calculation. You can follow along with pen and paper to get the
+correct value for your calibration register.
+
+Application information in the datasheet shows 10 Ohm resistors
+in series with the sensing inputs to filter noise and for
+transient protection. Experience shows that they also degrade
+accuracy.
drivers/hwmon/Kconfig +11 -0
index d402e8d..47cd73c 100644
@@ -836,6 +836,17 @@ config SENSORS_APPLESMC
 	  Say Y here if you have an applicable laptop and want to experience
 	  the awesome power of applesmc.
 
+config SENSORS_INA209
+	tristate "TI / Burr Brown INA209"
+	depends on I2C && EXPERIMENTAL
+	default n
+	help
+	  If you say yes here you get support for the TI / Burr Brown INA209
+	  voltage / current / power monitor I2C interface.
+
+	  This driver can also be built as a module. If so, the module will
+	  be called ina209.
+
 config HWMON_DEBUG_CHIP
 	bool "Hardware Monitoring Chip debugging messages"
 	default n
drivers/hwmon/Makefile +1 -0
index 950134a..c148c06 100644
@@ -45,6 +45,7 @@ obj-$(CONFIG_SENSORS_HDAPS)	+= hdaps.o
 obj-$(CONFIG_SENSORS_I5K_AMB)	+= i5k_amb.o
 obj-$(CONFIG_SENSORS_IBMAEM)	+= ibmaem.o
 obj-$(CONFIG_SENSORS_IBMPEX)	+= ibmpex.o
+obj-$(CONFIG_SENSORS_INA209)	+= ina209.o
 obj-$(CONFIG_SENSORS_IT87)	+= it87.o
 obj-$(CONFIG_SENSORS_K8TEMP)	+= k8temp.o
 obj-$(CONFIG_SENSORS_LM63)	+= lm63.o
drivers/hwmon/ina209.c new file +598 -0

598 lines not on this page · raw message

Signature · 7 lines
1.5.4.3


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors