blob: 199b5c0857f8c41cb211ffc5c5826fe04b29c10d [file] [log] [blame]
Subbaraman Narayanamurthy6accb262016-03-14 16:41:16 -07001Qualcomm Techonologies, Inc. QPNP PMIC Fuel Gauge Gen3 Device
2
3QPNP PMIC FG Gen3 device provides interface to the clients to read properties
4related to the battery. Its main function is to retrieve the State of Charge
5(SOC), in percentage scale representing the amount of charge left in the
6battery.
7
8=======================
9Required Node Structure
10=======================
11
12FG Gen3 device must be described in two levels of device nodes. The first
13level describes the FG Gen3 device. The second level describes one or more
14peripherals managed by FG Gen3 driver. All the peripheral specific parameters
15such as base address, interrupts etc., should be under second level node.
16
17====================================
18First Level Node - FG Gen3 device
19====================================
20
21- compatible
22 Usage: required
23 Value type: <string>
24 Definition: Should be "qcom,fg-gen3".
25
26- qcom,pmic-revid
27 Usage: required
28 Value type: <phandle>
29 Definition: Should specify the phandle of PMIC revid module. This is
30 used to identify the PMIC subtype.
31
32- io-channels
33- io-channel-names
34 Usage: required
35 Value type: <phandle>
36 Definition: For details about IIO bindings see:
37 Documentation/devicetree/bindings/iio/iio-bindings.txt
38
39- qcom,fg-cutoff-voltage
40 Usage: optional
41 Value type: <u32>
42 Definition: The voltage (in mV) where the fuel gauge will steer the SOC
43 to be zero. For example, if the cutoff voltage is set to
44 3400mv, the fuel gauge will try to count SoC so that the
45 battery SOC will be 0 when it is 3400mV. If this property
46 is not specified, then the default value used will be
47 3200mV.
48
49- qcom,fg-empty-voltage
50 Usage: optional
51 Value type: <u32>
52 Definition: The voltage threshold (in mV) based on which the empty soc
53 interrupt will be triggered. When the empty soc interrupt
54 fires, battery soc will be set to 0 and the userspace will
55 be notified via the power supply framework. The userspace
56 will read 0% soc and immediately shutdown. If this property
57 is not specified, then the default value used will be
58 3100mV.
59
60- qcom,fg-vbatt-low-thr
61 Usage: optional
62 Value type: <u32>
63 Definition: The voltage threshold (in mV) which upon set will be used
64 for configuring the low battery voltage threshold.
65
66- qcom,fg-chg-term-current
67 Usage: optional
68 Value type: <u32>
69 Definition: Battery current (in mA) at which the fuel gauge will issue
70 an end of charge if the charger is configured to use the
71 fuel gauge ADC for end of charge detection. If this
72 property is not specified, then the default value used
73 will be 100mA.
74
75- qcom,fg-sys-term-current
76 Usage: optional
77 Value type: <u32>
78 Definition: Battery current (in mA) at which the fuel gauge will try to
79 scale towards 100%. When the charge current goes above this
80 the SOC should be at 100%. If this property is not
Subbaraman Narayanamurthy4bf3ce22016-09-19 11:17:59 -070081 specified, then the default value used will be -125mA.
82 This value has to be specified in negative values for
83 the charging current.
Subbaraman Narayanamurthy6accb262016-03-14 16:41:16 -070084
85- qcom,fg-delta-soc-thr
86 Usage: optional
87 Value type: <u32>
88 Definition: Percentage of monotonic SOC increase upon which the delta
89 SOC interrupt will be triggered. If this property is not
90 specified, then the default value will be 1.
91
92- qcom,fg-recharge-soc-thr
93 Usage: optional
94 Value type: <u32>
95 Definition: Percentage of monotonic SOC upon which the charging will
96 will be resumed once the charging is complete. If this
97 property is not specified, then the default value will be
98 95.
99
100- qcom,fg-rsense-sel
101 Usage: optional
102 Value type: <u32>
103 Definition: Specifies the source of sense resistor.
104 Allowed values are:
105 0 - Rsense is from Battery FET
106 1 - Rsense is external
107 2 - Rsense is Battery FET and SMB
108 Option 2 can be used only when a parallel charger is
109 present. If this property is not specified, then the
110 default value will be 2.
111
112- qcom,fg-jeita-thresholds
113 Usage: optional
114 Value type: <prop-encoded-array>
115 Definition: A list of integers which holds the jeita thresholds (degC)
116 in the following order. Allowed size is 4.
117 Element 0 - JEITA cold threshold
118 Element 1 - JEITA cool threshold
119 Element 2 - JEITA warm threshold
120 Element 3 - JEITA hot threshold
121 If these parameters are not specified, then the default
122 values used will be 0, 5, 45, 50.
123
Nicholas Troastdcf8fe62016-08-04 14:30:02 -0700124- qcom,fg-esr-timer-charging
125 Usage: optional
126 Value type: <u32>
127 Definition: Number of cycles between ESR pulses while the battery is
128 charging.
129
130- qcom,fg-esr-timer-awake
131 Usage: optional
132 Value type: <u32>
133 Definition: Number of cycles between ESR pulses while the system is
134 awake and the battery is discharging.
135
136- qcom,fg-esr-timer-asleep
137 Usage: optional
138 Value type: <u32>
139 Definition: Number of cycles between ESR pulses while the system is
140 asleep and the battery is discharging. This option requires
141 qcom,fg-esr-timer-awake to be defined.
142
Subbaraman Narayanamurthy6accb262016-03-14 16:41:16 -0700143==========================================================
144Second Level Nodes - Peripherals managed by FG Gen3 driver
145==========================================================
146- reg
147 Usage: required
148 Value type: <prop-encoded-array>
149 Definition: Addresses and sizes for the specified peripheral
150
151- interrupts
152 Usage: optional
153 Value type: <prop-encoded-array>
154 Definition: Interrupt mapping as per the interrupt encoding
155
156- interrupt-names
157 Usage: optional
158 Value type: <stringlist>
159 Definition: Interrupt names. This list must match up 1-to-1 with the
160 interrupts specified in the 'interrupts' property.
161
162========
163Example
164========
165
166pmicobalt_fg: qpnp,fg {
167 compatible = "qcom,fg-gen3";
168 #address-cells = <1>;
169 #size-cells = <1>;
170 qcom,pmic-revid = <&pmicobalt_revid>;
171 io-channels = <&pmicobalt_rradc 3>;
172 io-channel-names = "rradc_batt_id";
173 status = "okay";
174
175 qcom,fg-batt-soc@4000 {
176 status = "okay";
177 reg = <0x4000 0x100>;
178 interrupts = <0x2 0x40 0x0 IRQ_TYPE_EDGE_BOTH>,
179 <0x2 0x40 0x1 IRQ_TYPE_EDGE_BOTH>,
180 <0x2 0x40 0x2 IRQ_TYPE_EDGE_BOTH>,
181 <0x2 0x40 0x3 IRQ_TYPE_EDGE_BOTH>;
182 interrupt-names = "soc-update",
183 "soc-ready",
184 "bsoc-delta",
185 "msoc-delta";
186
187 };
188
189 qcom,fg-batt-info@4100 {
190 status = "okay";
191 reg = <0x4100 0x100>;
192 interrupts = <0x2 0x41 0x3 IRQ_TYPE_EDGE_BOTH>;
193 interrupt-names = "batt-missing";
194 };
195
196 qcom,fg-memif@4400 {
197 status = "okay";
198 reg = <0x4400 0x100>;
199 };
200};