xref: /OK3568_Linux_fs/kernel/Documentation/hwmon/ina2xx.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunKernel driver ina2xx
2*4882a593Smuzhiyun====================
3*4882a593Smuzhiyun
4*4882a593SmuzhiyunSupported chips:
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun  * Texas Instruments INA219
7*4882a593Smuzhiyun
8*4882a593Smuzhiyun
9*4882a593Smuzhiyun    Prefix: 'ina219'
10*4882a593Smuzhiyun    Addresses: I2C 0x40 - 0x4f
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun    Datasheet: Publicly available at the Texas Instruments website
13*4882a593Smuzhiyun
14*4882a593Smuzhiyun	       https://www.ti.com/
15*4882a593Smuzhiyun
16*4882a593Smuzhiyun  * Texas Instruments INA220
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun    Prefix: 'ina220'
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun    Addresses: I2C 0x40 - 0x4f
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun    Datasheet: Publicly available at the Texas Instruments website
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun	       https://www.ti.com/
25*4882a593Smuzhiyun
26*4882a593Smuzhiyun  * Texas Instruments INA226
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun    Prefix: 'ina226'
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun    Addresses: I2C 0x40 - 0x4f
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun    Datasheet: Publicly available at the Texas Instruments website
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun	       https://www.ti.com/
35*4882a593Smuzhiyun
36*4882a593Smuzhiyun  * Texas Instruments INA230
37*4882a593Smuzhiyun
38*4882a593Smuzhiyun    Prefix: 'ina230'
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun    Addresses: I2C 0x40 - 0x4f
41*4882a593Smuzhiyun
42*4882a593Smuzhiyun    Datasheet: Publicly available at the Texas Instruments website
43*4882a593Smuzhiyun
44*4882a593Smuzhiyun	       https://www.ti.com/
45*4882a593Smuzhiyun
46*4882a593Smuzhiyun  * Texas Instruments INA231
47*4882a593Smuzhiyun
48*4882a593Smuzhiyun    Prefix: 'ina231'
49*4882a593Smuzhiyun
50*4882a593Smuzhiyun    Addresses: I2C 0x40 - 0x4f
51*4882a593Smuzhiyun
52*4882a593Smuzhiyun    Datasheet: Publicly available at the Texas Instruments website
53*4882a593Smuzhiyun
54*4882a593Smuzhiyun	       https://www.ti.com/
55*4882a593Smuzhiyun
56*4882a593SmuzhiyunAuthor: Lothar Felten <lothar.felten@gmail.com>
57*4882a593Smuzhiyun
58*4882a593SmuzhiyunDescription
59*4882a593Smuzhiyun-----------
60*4882a593Smuzhiyun
61*4882a593SmuzhiyunThe INA219 is a high-side current shunt and power monitor with an I2C
62*4882a593Smuzhiyuninterface. The INA219 monitors both shunt drop and supply voltage, with
63*4882a593Smuzhiyunprogrammable conversion times and filtering.
64*4882a593Smuzhiyun
65*4882a593SmuzhiyunThe INA220 is a high or low side current shunt and power monitor with an I2C
66*4882a593Smuzhiyuninterface. The INA220 monitors both shunt drop and supply voltage.
67*4882a593Smuzhiyun
68*4882a593SmuzhiyunThe INA226 is a current shunt and power monitor with an I2C interface.
69*4882a593SmuzhiyunThe INA226 monitors both a shunt voltage drop and bus supply voltage.
70*4882a593Smuzhiyun
71*4882a593SmuzhiyunINA230 and INA231 are high or low side current shunt and power monitors
72*4882a593Smuzhiyunwith an I2C interface. The chips monitor both a shunt voltage drop and
73*4882a593Smuzhiyunbus supply voltage.
74*4882a593Smuzhiyun
75*4882a593SmuzhiyunThe shunt value in micro-ohms can be set via platform data or device tree at
76*4882a593Smuzhiyuncompile-time or via the shunt_resistor attribute in sysfs at run-time. Please
77*4882a593Smuzhiyunrefer to the Documentation/devicetree/bindings/hwmon/ina2xx.txt for bindings
78*4882a593Smuzhiyunif the device tree is used.
79*4882a593Smuzhiyun
80*4882a593SmuzhiyunAdditionally ina226 supports update_interval attribute as described in
81*4882a593SmuzhiyunDocumentation/hwmon/sysfs-interface.rst. Internally the interval is the sum of
82*4882a593Smuzhiyunbus and shunt voltage conversion times multiplied by the averaging rate. We
83*4882a593Smuzhiyundon't touch the conversion times and only modify the number of averages. The
84*4882a593Smuzhiyunlower limit of the update_interval is 2 ms, the upper limit is 2253 ms.
85*4882a593SmuzhiyunThe actual programmed interval may vary from the desired value.
86*4882a593Smuzhiyun
87*4882a593SmuzhiyunGeneral sysfs entries
88*4882a593Smuzhiyun---------------------
89*4882a593Smuzhiyun
90*4882a593Smuzhiyun======================= ===============================
91*4882a593Smuzhiyunin0_input		Shunt voltage(mV) channel
92*4882a593Smuzhiyunin1_input		Bus voltage(mV) channel
93*4882a593Smuzhiyuncurr1_input		Current(mA) measurement channel
94*4882a593Smuzhiyunpower1_input		Power(uW) measurement channel
95*4882a593Smuzhiyunshunt_resistor		Shunt resistance(uOhm) channel
96*4882a593Smuzhiyun======================= ===============================
97*4882a593Smuzhiyun
98*4882a593SmuzhiyunSysfs entries for ina226, ina230 and ina231 only
99*4882a593Smuzhiyun------------------------------------------------
100*4882a593Smuzhiyun
101*4882a593Smuzhiyun======================= ====================================================
102*4882a593Smuzhiyunin0_lcrit		Critical low shunt voltage
103*4882a593Smuzhiyunin0_crit		Critical high shunt voltage
104*4882a593Smuzhiyunin0_lcrit_alarm		Shunt voltage critical low alarm
105*4882a593Smuzhiyunin0_crit_alarm		Shunt voltage critical high alarm
106*4882a593Smuzhiyunin1_lcrit		Critical low bus voltage
107*4882a593Smuzhiyunin1_crit		Critical high bus voltage
108*4882a593Smuzhiyunin1_lcrit_alarm		Bus voltage critical low alarm
109*4882a593Smuzhiyunin1_crit_alarm		Bus voltage critical high alarm
110*4882a593Smuzhiyunpower1_crit		Critical high power
111*4882a593Smuzhiyunpower1_crit_alarm	Power critical high alarm
112*4882a593Smuzhiyunupdate_interval		data conversion time; affects number of samples used
113*4882a593Smuzhiyun			to average results for shunt and bus voltages.
114*4882a593Smuzhiyun======================= ====================================================
115*4882a593Smuzhiyun
116*4882a593Smuzhiyun.. note::
117*4882a593Smuzhiyun
118*4882a593Smuzhiyun   - Configure `shunt_resistor` before configure `power1_crit`, because power
119*4882a593Smuzhiyun     value is calculated based on `shunt_resistor` set.
120*4882a593Smuzhiyun   - Because of the underlying register implementation, only one `*crit` setting
121*4882a593Smuzhiyun     and its `alarm` can be active. Writing to one `*crit` setting clears other
122*4882a593Smuzhiyun     `*crit` settings and alarms. Writing 0 to any `*crit` setting clears all
123*4882a593Smuzhiyun     `*crit` settings and alarms.
124