xref: /linux/Documentation/hwmon/ina2xx.rst (revision f6aed68e8a2a646c78801f6c545f9c4db2f4e610)
17ebd8b66SMauro Carvalho ChehabKernel driver ina2xx
27ebd8b66SMauro Carvalho Chehab====================
37ebd8b66SMauro Carvalho Chehab
47ebd8b66SMauro Carvalho ChehabSupported chips:
57ebd8b66SMauro Carvalho Chehab
67ebd8b66SMauro Carvalho Chehab  * Texas Instruments INA219
77ebd8b66SMauro Carvalho Chehab
87ebd8b66SMauro Carvalho Chehab
97ebd8b66SMauro Carvalho Chehab    Prefix: 'ina219'
107ebd8b66SMauro Carvalho Chehab    Addresses: I2C 0x40 - 0x4f
117ebd8b66SMauro Carvalho Chehab
127ebd8b66SMauro Carvalho Chehab    Datasheet: Publicly available at the Texas Instruments website
137ebd8b66SMauro Carvalho Chehab
1449dc2fb0SAlexander A. Klimov	       https://www.ti.com/
157ebd8b66SMauro Carvalho Chehab
167ebd8b66SMauro Carvalho Chehab  * Texas Instruments INA220
177ebd8b66SMauro Carvalho Chehab
187ebd8b66SMauro Carvalho Chehab    Prefix: 'ina220'
197ebd8b66SMauro Carvalho Chehab
207ebd8b66SMauro Carvalho Chehab    Addresses: I2C 0x40 - 0x4f
217ebd8b66SMauro Carvalho Chehab
227ebd8b66SMauro Carvalho Chehab    Datasheet: Publicly available at the Texas Instruments website
237ebd8b66SMauro Carvalho Chehab
2449dc2fb0SAlexander A. Klimov	       https://www.ti.com/
257ebd8b66SMauro Carvalho Chehab
267ebd8b66SMauro Carvalho Chehab  * Texas Instruments INA226
277ebd8b66SMauro Carvalho Chehab
287ebd8b66SMauro Carvalho Chehab    Prefix: 'ina226'
297ebd8b66SMauro Carvalho Chehab
307ebd8b66SMauro Carvalho Chehab    Addresses: I2C 0x40 - 0x4f
317ebd8b66SMauro Carvalho Chehab
327ebd8b66SMauro Carvalho Chehab    Datasheet: Publicly available at the Texas Instruments website
337ebd8b66SMauro Carvalho Chehab
3449dc2fb0SAlexander A. Klimov	       https://www.ti.com/
357ebd8b66SMauro Carvalho Chehab
367ebd8b66SMauro Carvalho Chehab  * Texas Instruments INA230
377ebd8b66SMauro Carvalho Chehab
387ebd8b66SMauro Carvalho Chehab    Prefix: 'ina230'
397ebd8b66SMauro Carvalho Chehab
407ebd8b66SMauro Carvalho Chehab    Addresses: I2C 0x40 - 0x4f
417ebd8b66SMauro Carvalho Chehab
427ebd8b66SMauro Carvalho Chehab    Datasheet: Publicly available at the Texas Instruments website
437ebd8b66SMauro Carvalho Chehab
4449dc2fb0SAlexander A. Klimov	       https://www.ti.com/
457ebd8b66SMauro Carvalho Chehab
467ebd8b66SMauro Carvalho Chehab  * Texas Instruments INA231
477ebd8b66SMauro Carvalho Chehab
487ebd8b66SMauro Carvalho Chehab    Prefix: 'ina231'
497ebd8b66SMauro Carvalho Chehab
507ebd8b66SMauro Carvalho Chehab    Addresses: I2C 0x40 - 0x4f
517ebd8b66SMauro Carvalho Chehab
527ebd8b66SMauro Carvalho Chehab    Datasheet: Publicly available at the Texas Instruments website
537ebd8b66SMauro Carvalho Chehab
5449dc2fb0SAlexander A. Klimov	       https://www.ti.com/
557ebd8b66SMauro Carvalho Chehab
567ebd8b66SMauro Carvalho ChehabAuthor: Lothar Felten <lothar.felten@gmail.com>
577ebd8b66SMauro Carvalho Chehab
587ebd8b66SMauro Carvalho ChehabDescription
597ebd8b66SMauro Carvalho Chehab-----------
607ebd8b66SMauro Carvalho Chehab
617ebd8b66SMauro Carvalho ChehabThe INA219 is a high-side current shunt and power monitor with an I2C
627ebd8b66SMauro Carvalho Chehabinterface. The INA219 monitors both shunt drop and supply voltage, with
637ebd8b66SMauro Carvalho Chehabprogrammable conversion times and filtering.
647ebd8b66SMauro Carvalho Chehab
657ebd8b66SMauro Carvalho ChehabThe INA220 is a high or low side current shunt and power monitor with an I2C
667ebd8b66SMauro Carvalho Chehabinterface. The INA220 monitors both shunt drop and supply voltage.
677ebd8b66SMauro Carvalho Chehab
687ebd8b66SMauro Carvalho ChehabThe INA226 is a current shunt and power monitor with an I2C interface.
697ebd8b66SMauro Carvalho ChehabThe INA226 monitors both a shunt voltage drop and bus supply voltage.
707ebd8b66SMauro Carvalho Chehab
717ebd8b66SMauro Carvalho ChehabINA230 and INA231 are high or low side current shunt and power monitors
727ebd8b66SMauro Carvalho Chehabwith an I2C interface. The chips monitor both a shunt voltage drop and
737ebd8b66SMauro Carvalho Chehabbus supply voltage.
747ebd8b66SMauro Carvalho Chehab
757ebd8b66SMauro Carvalho ChehabThe shunt value in micro-ohms can be set via platform data or device tree at
767ebd8b66SMauro Carvalho Chehabcompile-time or via the shunt_resistor attribute in sysfs at run-time. Please
77*f6aed68eSMauro Carvalho Chehabrefer to the Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml for bindings
787ebd8b66SMauro Carvalho Chehabif the device tree is used.
797ebd8b66SMauro Carvalho Chehab
807ebd8b66SMauro Carvalho ChehabAdditionally ina226 supports update_interval attribute as described in
817ebd8b66SMauro Carvalho ChehabDocumentation/hwmon/sysfs-interface.rst. Internally the interval is the sum of
827ebd8b66SMauro Carvalho Chehabbus and shunt voltage conversion times multiplied by the averaging rate. We
837ebd8b66SMauro Carvalho Chehabdon't touch the conversion times and only modify the number of averages. The
847ebd8b66SMauro Carvalho Chehablower limit of the update_interval is 2 ms, the upper limit is 2253 ms.
857ebd8b66SMauro Carvalho ChehabThe actual programmed interval may vary from the desired value.
867ebd8b66SMauro Carvalho Chehab
877ebd8b66SMauro Carvalho ChehabGeneral sysfs entries
887ebd8b66SMauro Carvalho Chehab---------------------
897ebd8b66SMauro Carvalho Chehab
907ebd8b66SMauro Carvalho Chehab======================= ===============================
917ebd8b66SMauro Carvalho Chehabin0_input		Shunt voltage(mV) channel
927ebd8b66SMauro Carvalho Chehabin1_input		Bus voltage(mV) channel
937ebd8b66SMauro Carvalho Chehabcurr1_input		Current(mA) measurement channel
947ebd8b66SMauro Carvalho Chehabpower1_input		Power(uW) measurement channel
957ebd8b66SMauro Carvalho Chehabshunt_resistor		Shunt resistance(uOhm) channel
967ebd8b66SMauro Carvalho Chehab======================= ===============================
977ebd8b66SMauro Carvalho Chehab
987ebd8b66SMauro Carvalho ChehabSysfs entries for ina226, ina230 and ina231 only
997ebd8b66SMauro Carvalho Chehab------------------------------------------------
1007ebd8b66SMauro Carvalho Chehab
1017ebd8b66SMauro Carvalho Chehab======================= ====================================================
1025a56a39bSAlex Qiuin0_lcrit		Critical low shunt voltage
1035a56a39bSAlex Qiuin0_crit		Critical high shunt voltage
1045a56a39bSAlex Qiuin0_lcrit_alarm		Shunt voltage critical low alarm
1055a56a39bSAlex Qiuin0_crit_alarm		Shunt voltage critical high alarm
1065a56a39bSAlex Qiuin1_lcrit		Critical low bus voltage
1075a56a39bSAlex Qiuin1_crit		Critical high bus voltage
1085a56a39bSAlex Qiuin1_lcrit_alarm		Bus voltage critical low alarm
1095a56a39bSAlex Qiuin1_crit_alarm		Bus voltage critical high alarm
1105a56a39bSAlex Qiupower1_crit		Critical high power
1115a56a39bSAlex Qiupower1_crit_alarm	Power critical high alarm
1127ebd8b66SMauro Carvalho Chehabupdate_interval		data conversion time; affects number of samples used
1137ebd8b66SMauro Carvalho Chehab			to average results for shunt and bus voltages.
1147ebd8b66SMauro Carvalho Chehab======================= ====================================================
1155a56a39bSAlex Qiu
1165a56a39bSAlex Qiu.. note::
1175a56a39bSAlex Qiu
1185a56a39bSAlex Qiu   - Configure `shunt_resistor` before configure `power1_crit`, because power
1195a56a39bSAlex Qiu     value is calculated based on `shunt_resistor` set.
1205a56a39bSAlex Qiu   - Because of the underlying register implementation, only one `*crit` setting
1215a56a39bSAlex Qiu     and its `alarm` can be active. Writing to one `*crit` setting clears other
1225a56a39bSAlex Qiu     `*crit` settings and alarms. Writing 0 to any `*crit` setting clears all
1235a56a39bSAlex Qiu     `*crit` settings and alarms.
124