Skip to contentSkip to conversation

Add i2c chip driver for INA209 power monitor

PATCH New Paul Hays 1 participant 1 message Feb 10, 2008

Subsystems (2)
lore
Share & tools
lore

Paul Hays

author
#0 lore raw

PATCH 1/1 Add i2c chip driver for INA209 power monitor

For your consideration, this adds Linux support for the Texas Instruments / Burr-Brown INA209 power monitoring chip with i2c interface. (As far as I know, this isn't used like a sensor on any mainboard; I use it in a solar power system.)

The driver works in kernel 2.6.20-voyage (http://linux.voyage.hk)
on a WRAP sbc from PC Engines (http://www.pcengines.ch).

Kernel 2.6.24 also built without incident after this patch.

--

Documentation/i2c/chips/ina209 +70 -0
diff -Naur -X b/Documentation/dontdiff a/Documentation/i2c/chips/ina209 b/Documentation/i2c/chips/ina209
@@ -0,0 +1,70 @@
+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]>
+
+
+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.
+
+The driver simply exposes the registers of an INA209 via sysfs as
+decimal integers. Some registers (marked "bits" here) contain various
+bit fields, and others use configurable scaling.  (I found it convenient
+to process all of the values in userspace with friendly Perl scripts.)
+
+configuration				bits
+status			read only,	bits
+status_mask				bits
+shunt_v			read only
+bus_v			read only
+power			read only
+bus_current		read only
+shunt_v_pos_peak
+shunt_v_neg_peak
+bus_v_max_peak
+bus_v_min_peak
+power_peak
+shunt_v_pos_warn
+shunt_v_neg_warn
+power_warn
+bus_over_v_warn
+bus_under_v_warn
+power_over_limit
+bus_over_v_over_limit
+bus_under_v_over_limit
+critical_dac_pos
+critical_dac_neg
+calibration
+
+
+General Remarks
+---------------
+
+The layouts of values in some registers surprised me; read
+that datasheet very closely.
+
+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/i2c/chips/ina209.c +334 -0

334 lines not on this page · raw message

drivers/i2c/chips/Kconfig +11 -0
diff -Naur -X b/Documentation/dontdiff a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
@@ -125,4 +125,15 @@
 	  This driver can also be built as a module.  If so, the module
 	  will be called max6875.
 
+config SENSORS_INA209
+	tristate "Burr-Brown / Texas Instruments INA509 (EXPERIMENTAL)"
+	depends on I2C && EXPERIMENTAL
+	help
+	  If you say yes here you get support for the Burr-Brown / TI INA509
+	  chip for monitoring voltage, current, and power. Enter N unless
+          you are sure your system uses this chip (very few do use it).
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called ina209.
+
 endmenu
drivers/i2c/chips/Makefile +1 -0
diff -Naur -X b/Documentation/dontdiff a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
@@ -10,6 +10,7 @@
 obj-$(CONFIG_SENSORS_PCA9539)	+= pca9539.o
 obj-$(CONFIG_SENSORS_PCF8574)	+= pcf8574.o
 obj-$(CONFIG_SENSORS_PCF8591)	+= pcf8591.o
+obj-$(CONFIG_SENSORS_INA209)	+= ina209.o
 obj-$(CONFIG_ISP1301_OMAP)	+= isp1301_omap.o
 obj-$(CONFIG_TPS65010)		+= tps65010.o
 

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