blob: d205b0b663708f26ce7451595f833f0664426ef8 [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
Subbaraman Narayanamurthy243fc3f2016-11-28 16:05:09 -080039- qcom,rradc-base
40 Usage: required
41 Value type: <u32>
42 Definition: Should specify the base address of RR_ADC peripheral. This
43 is used for reading certain peripheral registers under it.
44
Subbaraman Narayanamurthy6accb262016-03-14 16:41:16 -070045- qcom,fg-cutoff-voltage
46 Usage: optional
47 Value type: <u32>
48 Definition: The voltage (in mV) where the fuel gauge will steer the SOC
49 to be zero. For example, if the cutoff voltage is set to
50 3400mv, the fuel gauge will try to count SoC so that the
51 battery SOC will be 0 when it is 3400mV. If this property
52 is not specified, then the default value used will be
53 3200mV.
54
55- qcom,fg-empty-voltage
56 Usage: optional
57 Value type: <u32>
58 Definition: The voltage threshold (in mV) based on which the empty soc
59 interrupt will be triggered. When the empty soc interrupt
60 fires, battery soc will be set to 0 and the userspace will
61 be notified via the power supply framework. The userspace
62 will read 0% soc and immediately shutdown. If this property
63 is not specified, then the default value used will be
Subbaraman Narayanamurthyc7b33322016-11-01 16:29:46 -070064 2800mV.
Subbaraman Narayanamurthy6accb262016-03-14 16:41:16 -070065
66- qcom,fg-vbatt-low-thr
67 Usage: optional
68 Value type: <u32>
69 Definition: The voltage threshold (in mV) which upon set will be used
70 for configuring the low battery voltage threshold.
71
Subbaraman Narayanamurthy4cf5c1c2016-11-17 13:58:06 -080072- qcom,fg-recharge-voltage
73 Usage: optional
74 Value type: <u32>
75 Definition: The voltage threshold (in mV) based on which the charging
76 will be resumed once the charging is complete. If this
77 property is not specified, then the default value will be
78 4250mV.
79
Subbaraman Narayanamurthy6accb262016-03-14 16:41:16 -070080- qcom,fg-chg-term-current
81 Usage: optional
82 Value type: <u32>
83 Definition: Battery current (in mA) at which the fuel gauge will issue
84 an end of charge if the charger is configured to use the
85 fuel gauge ADC for end of charge detection. If this
86 property is not specified, then the default value used
87 will be 100mA.
88
89- qcom,fg-sys-term-current
90 Usage: optional
91 Value type: <u32>
92 Definition: Battery current (in mA) at which the fuel gauge will try to
93 scale towards 100%. When the charge current goes above this
94 the SOC should be at 100%. If this property is not
Subbaraman Narayanamurthy4bf3ce22016-09-19 11:17:59 -070095 specified, then the default value used will be -125mA.
96 This value has to be specified in negative values for
97 the charging current.
Subbaraman Narayanamurthy6accb262016-03-14 16:41:16 -070098
Subbaraman Narayanamurthya4e18882017-04-04 20:28:03 -070099- qcom,fg-chg-term-base-current
100 Usage: optional
101 Value type: <u32>
102 Definition: Battery current (in mA) upper boundary at which the fuel
103 gauge will issue an end of charge during discharging. If
104 this property is not specified, then the default value used
105 will be 75mA.
106
Subbaraman Narayanamurthy6accb262016-03-14 16:41:16 -0700107- qcom,fg-delta-soc-thr
108 Usage: optional
109 Value type: <u32>
Subbaraman Narayanamurthyfbf25372017-01-03 15:39:08 -0800110 Definition: Percentage of SOC increase upon which the delta monotonic &
111 battery SOC interrupts will be triggered. If this property
112 is not specified, then the default value will be 1.
113 Possible values are in the range of 0 to 12.
Subbaraman Narayanamurthy6accb262016-03-14 16:41:16 -0700114
115- qcom,fg-recharge-soc-thr
116 Usage: optional
117 Value type: <u32>
118 Definition: Percentage of monotonic SOC upon which the charging will
119 will be resumed once the charging is complete. If this
120 property is not specified, then the default value will be
121 95.
122
123- qcom,fg-rsense-sel
124 Usage: optional
125 Value type: <u32>
126 Definition: Specifies the source of sense resistor.
127 Allowed values are:
128 0 - Rsense is from Battery FET
Subbaraman Narayanamurthy6accb262016-03-14 16:41:16 -0700129 2 - Rsense is Battery FET and SMB
130 Option 2 can be used only when a parallel charger is
131 present. If this property is not specified, then the
132 default value will be 2.
133
134- qcom,fg-jeita-thresholds
135 Usage: optional
136 Value type: <prop-encoded-array>
137 Definition: A list of integers which holds the jeita thresholds (degC)
138 in the following order. Allowed size is 4.
139 Element 0 - JEITA cold threshold
140 Element 1 - JEITA cool threshold
141 Element 2 - JEITA warm threshold
142 Element 3 - JEITA hot threshold
143 If these parameters are not specified, then the default
144 values used will be 0, 5, 45, 50.
145
Nicholas Troastdcf8fe62016-08-04 14:30:02 -0700146- qcom,fg-esr-timer-charging
147 Usage: optional
Subbaraman Narayanamurthy784bd5b2017-05-17 17:43:22 -0700148 Value type: <prop-encoded-array>
Nicholas Troastdcf8fe62016-08-04 14:30:02 -0700149 Definition: Number of cycles between ESR pulses while the battery is
Subbaraman Narayanamurthy784bd5b2017-05-17 17:43:22 -0700150 charging. Array of 2 elements if specified.
151 Element 0 - Retry value for timer
152 Element 1 - Maximum value for timer
Nicholas Troastdcf8fe62016-08-04 14:30:02 -0700153
154- qcom,fg-esr-timer-awake
155 Usage: optional
Subbaraman Narayanamurthy784bd5b2017-05-17 17:43:22 -0700156 Value type: <prop-encoded-array>
Nicholas Troastdcf8fe62016-08-04 14:30:02 -0700157 Definition: Number of cycles between ESR pulses while the system is
Subbaraman Narayanamurthy784bd5b2017-05-17 17:43:22 -0700158 awake and the battery is discharging. Array of 2 elements
159 if specified.
160 Element 0 - Retry value for timer
161 Element 1 - Maximum value for timer
Nicholas Troastdcf8fe62016-08-04 14:30:02 -0700162
163- qcom,fg-esr-timer-asleep
164 Usage: optional
Subbaraman Narayanamurthy784bd5b2017-05-17 17:43:22 -0700165 Value type: <prop-encoded-array>
Nicholas Troastdcf8fe62016-08-04 14:30:02 -0700166 Definition: Number of cycles between ESR pulses while the system is
167 asleep and the battery is discharging. This option requires
Subbaraman Narayanamurthy784bd5b2017-05-17 17:43:22 -0700168 qcom,fg-esr-timer-awake to be defined. Array of 2 elements
169 if specified.
170 Element 0 - Retry value for timer
171 Element 1 - Maximum value for timer
Nicholas Troastdcf8fe62016-08-04 14:30:02 -0700172
Subbaraman Narayanamurthye14037f2017-03-16 19:14:58 -0700173- qcom,fg-esr-pulse-thresh-ma
174 Usage: optional
175 Value type: <u32>
176 Definition: ESR pulse qualification threshold in mA. If this is not
177 specified, a default value of 110 mA will be configured.
178 Allowed values are from 1 to 997.
179
180- qcom,fg-esr-meas-curr-ma
181 Usage: optional
182 Value type: <u32>
183 Definition: ESR measurement current in mA. If this is not specified,
184 a default value of 120 mA will be configured. Allowed
185 values are 60, 120, 180 and 240.
186
Nicholas Troaste29dec92016-08-24 09:35:11 -0700187- qcom,cycle-counter-en
188 Usage: optional
Subbaraman Narayanamurthydeeaec722016-12-22 18:55:25 -0800189 Value type: <empty>
Nicholas Troaste29dec92016-08-24 09:35:11 -0700190 Definition: Enables the cycle counter feature.
191
Subbaraman Narayanamurthy6da170e2016-09-21 12:36:03 -0700192- qcom,fg-force-load-profile
193 Usage: optional
Subbaraman Narayanamurthydeeaec722016-12-22 18:55:25 -0800194 Value type: <empty>
Subbaraman Narayanamurthy6da170e2016-09-21 12:36:03 -0700195 Definition: If set, battery profile will be force loaded if the profile
196 loaded earlier by bootloader doesn't match with the profile
197 available in the device tree.
198
Subbaraman Narayanamurthy07be9192016-09-14 14:48:49 -0700199- qcom,cl-start-capacity
200 Usage: optional
201 Value type: <u32>
202 Definition: Battery SOC threshold to start the capacity learning.
203 If this is not specified, then the default value used
204 will be 15.
205
206- qcom,cl-min-temp
207 Usage: optional
208 Value type: <u32>
209 Definition: Lower limit of battery temperature to start the capacity
210 learning. If this is not specified, then the default value
211 used will be 150. Unit is in decidegC.
212
213- qcom,cl-max-temp
214 Usage: optional
215 Value type: <u32>
216 Definition: Upper limit of battery temperature to start the capacity
217 learning. If this is not specified, then the default value
218 used will be 450 (45C). Unit is in decidegC.
219
220- qcom,cl-max-increment
221 Usage: optional
222 Value type: <u32>
223 Definition: Maximum capacity increment allowed per capacity learning
224 cycle. If this is not specified, then the default value
225 used will be 5 (0.5%). Unit is in decipercentage.
226
227- qcom,cl-max-decrement
228 Usage: optional
229 Value type: <u32>
230 Definition: Maximum capacity decrement allowed per capacity learning
231 cycle. If this is not specified, then the default value
232 used will be 100 (10%). Unit is in decipercentage.
233
234- qcom,cl-min-limit
235 Usage: optional
236 Value type: <u32>
237 Definition: Minimum limit that the capacity cannot go below in a
238 capacity learning cycle. If this is not specified, then
239 the default value is 0. Unit is in decipercentage.
240
241- qcom,cl-max-limit
242 Usage: optional
243 Value type: <u32>
244 Definition: Maximum limit that the capacity cannot go above in a
245 capacity learning cycle. If this is not specified, then
246 the default value is 0. Unit is in decipercentage.
247
cyizhaofb3eec52017-01-24 17:08:55 +0800248- qcom,battery-thermal-coefficients
249 Usage: optional
250 Value type: <u8>
251 Definition: Byte array of battery thermal coefficients.
252 This should be exactly 3 bytes in length.
253
Subbaraman Narayanamurthy65ff45e2016-09-23 19:11:17 -0700254- qcom,fg-jeita-hyst-temp
255 Usage: optional
256 Value type: <u32>
257 Definition: Hysteresis applied to Jeita temperature comparison.
258 Possible values are:
259 0 - No hysteresis
260 1,2,3 - Value in Celsius.
261
Subbaraman Narayanamurthy11bddec2016-09-26 11:27:24 -0700262- qcom,fg-batt-temp-delta
263 Usage: optional
264 Value type: <u32>
265 Definition: Battery temperature delta interrupt threshold. Possible
266 values are: 2, 4, 6 and 10. Unit is in Kelvin.
267
Subbaraman Narayanamurthydeeaec722016-12-22 18:55:25 -0800268- qcom,hold-soc-while-full
Subbaraman Narayanamurthyf9611e32016-09-26 11:12:47 -0700269 Usage: optional
Subbaraman Narayanamurthydeeaec722016-12-22 18:55:25 -0800270 Value type: <empty>
Subbaraman Narayanamurthyf9611e32016-09-26 11:12:47 -0700271 Definition: A boolean property that when defined holds SOC at 100% when
272 the battery is full.
273
Subbaraman Narayanamurthy50fb7fd2017-07-25 20:01:25 -0700274- qcom,linearize-soc
275 Usage: optional
276 Value type: <empty>
277 Definition: A boolean property that when defined linearizes SOC when
278 the SOC drops after charge termination monotonically to
279 improve the user experience. This is applicable only if
280 "qcom,hold-soc-while-full" is specified.
281
Subbaraman Narayanamurthydeeaec722016-12-22 18:55:25 -0800282- qcom,ki-coeff-soc-dischg
Subbaraman Narayanamurthyc1a94ed2016-10-05 19:58:58 -0700283 Usage: optional
284 Value type: <prop-encoded-array>
285 Definition: Array of monotonic SOC threshold values to change the ki
286 coefficient for medium discharge current during discharge.
287 This should be defined in the ascending order and in the
288 range of 0-100. Array limit is set to 3.
289
Subbaraman Narayanamurthydeeaec722016-12-22 18:55:25 -0800290- qcom,ki-coeff-med-dischg
Subbaraman Narayanamurthyc1a94ed2016-10-05 19:58:58 -0700291 Usage: optional
292 Value type: <prop-encoded-array>
293 Definition: Array of ki coefficient values for medium discharge current
294 during discharge. These values will be applied when the
295 monotonic SOC goes below the SOC threshold specified under
296 qcom,ki-coeff-soc-dischg. Array limit is set to 3. This
297 property should be specified if qcom,ki-coeff-soc-dischg
298 is specified to make it fully functional. Value has no
299 unit. Allowed range is 0 to 62200 in micro units.
300
Subbaraman Narayanamurthydeeaec722016-12-22 18:55:25 -0800301- qcom,ki-coeff-hi-dischg
Subbaraman Narayanamurthyc1a94ed2016-10-05 19:58:58 -0700302 Usage: optional
303 Value type: <prop-encoded-array>
304 Definition: Array of ki coefficient values for high discharge current
305 during discharge. These values will be applied when the
306 monotonic SOC goes below the SOC threshold specified under
307 qcom,ki-coeff-soc-dischg. Array limit is set to 3. This
308 property should be specified if qcom,ki-coeff-soc-dischg
309 is specified to make it fully functional. Value has no
310 unit. Allowed range is 0 to 62200 in micro units.
311
Subbaraman Narayanamurthye17be582017-08-08 19:28:37 -0700312- qcom,ki-coeff-full-dischg
313 Usage: optional
314 Value type: <u32>
315 Definition: Ki coefficient full SOC value that will be applied during
316 discharging. If not specified, a value of 0 will be set.
317 Allowed range is from 245 to 62256.
318
Subbaraman Narayanamurthyc297f6de2016-11-28 18:05:20 -0800319- qcom,fg-rconn-mohms
320 Usage: optional
321 Value type: <u32>
322 Definition: Battery connector resistance (Rconn) in milliohms. If Rconn
323 is specified, then ESR to Rslow scaling factors will be
324 updated to account it for an accurate ESR.
325
Subbaraman Narayanamurthydcfc8662017-02-24 16:04:46 -0800326- qcom,fg-esr-clamp-mohms
327 Usage: optional
328 Value type: <u32>
329 Definition: Equivalent series resistance (ESR) in milliohms. If this
330 is specified, then ESR will be clamped to this value when
331 ESR is found to be dropping below this. Default value is
332 20.
333
Subbaraman Narayanamurthyb99ea4c2016-12-22 15:10:09 -0800334- qcom,fg-esr-filter-switch-temp
335 Usage: optional
336 Value type: <u32>
337 Definition: Battery temperature threshold below which low temperature
338 ESR filter coefficients will be switched to normal
339 temperature ESR filter coefficients. If this is not
340 specified, then the default value used will be 100. Unit is
341 in decidegC.
342
343- qcom,fg-esr-tight-filter-micro-pct
344 Usage: optional
345 Value type: <u32>
346 Definition: Value in micro percentage for ESR tight filter. If this is
347 not specified, then a default value of 3907 (0.39 %) will
348 be used. Lowest possible value is 1954 (0.19 %).
349
350- qcom,fg-esr-broad-filter-micro-pct
351 Usage: optional
352 Value type: <u32>
353 Definition: Value in micro percentage for ESR broad filter. If this is
354 not specified, then a default value of 99610 (9.96 %) will
355 be used. Lowest possible value is 1954 (0.19 %).
356
357- qcom,fg-esr-tight-lt-filter-micro-pct
358 Usage: optional
359 Value type: <u32>
360 Definition: Value in micro percentage for low temperature ESR tight
361 filter. If this is not specified, then a default value of
362 48829 (4.88 %) will be used. Lowest possible value is 1954
363 (0.19 %).
364
365- qcom,fg-esr-broad-lt-filter-micro-pct
366 Usage: optional
367 Value type: <u32>
368 Definition: Value in micro percentage for low temperature ESR broad
369 filter. If this is not specified, then a default value of
370 148438 (14.84 %) will be used. Lowest possible value is
371 1954 (0.19 %).
372
Subbaraman Narayanamurthydeeaec722016-12-22 18:55:25 -0800373- qcom,fg-auto-recharge-soc
374 Usage: optional
375 Value type: <empty>
376 Definition: A boolean property when defined will configure automatic
377 recharge SOC threshold. If not specified, automatic
378 recharge voltage threshold will be configured. This has
379 to be configured in conjunction with the charger side
380 configuration for proper functionality.
381
Subbaraman Narayanamurthy94e63052017-02-09 18:06:14 -0800382- qcom,slope-limit-temp-threshold
383 Usage: optional
384 Value type: <u32>
385 Definition: Battery temperature threshold to decide when slope limit
386 coefficients should be applied along with charging status.
387 Unit is in decidegC.
388
389- qcom,slope-limit-coeffs
390 Usage: optional
391 Value type: <prop-encoded-array>
392 Definition: A list of integers which holds the slope limit coefficients
393 in the following order. Allowed size is 4. Possible values
394 are from 0 to 31. Unit is in decipercentage.
395 Element 0 - Low temperature discharging
396 Element 1 - Low temperature charging
397 Element 2 - High temperature discharging
398 Element 3 - High temperature charging
399 These coefficients have to be specified along with the
400 property "qcom,slope-limit-temp-threshold" to make dynamic
401 slope limit adjustment functional.
402
Fenglin Wud10ccf12017-08-10 15:43:41 +0800403- qcom,fg-bmd-en-delay-ms
404 Usage: optional
405 Value type: <u32>
406 Definition: The delay in ms for FG to enable BMD after reading RID.
407
Subbaraman Narayanamurthy6accb262016-03-14 16:41:16 -0700408==========================================================
409Second Level Nodes - Peripherals managed by FG Gen3 driver
410==========================================================
411- reg
412 Usage: required
413 Value type: <prop-encoded-array>
414 Definition: Addresses and sizes for the specified peripheral
415
416- interrupts
417 Usage: optional
418 Value type: <prop-encoded-array>
419 Definition: Interrupt mapping as per the interrupt encoding
420
421- interrupt-names
422 Usage: optional
423 Value type: <stringlist>
424 Definition: Interrupt names. This list must match up 1-to-1 with the
425 interrupts specified in the 'interrupts' property.
426
427========
428Example
429========
430
Harry Yang2452b272017-03-06 13:56:14 -0800431pmi8998_fg: qpnp,fg {
Subbaraman Narayanamurthy6accb262016-03-14 16:41:16 -0700432 compatible = "qcom,fg-gen3";
433 #address-cells = <1>;
434 #size-cells = <1>;
Harry Yang2452b272017-03-06 13:56:14 -0800435 qcom,pmic-revid = <&pmi8998_revid>;
436 io-channels = <&pmi8998_rradc 3>;
Subbaraman Narayanamurthy6accb262016-03-14 16:41:16 -0700437 io-channel-names = "rradc_batt_id";
Subbaraman Narayanamurthy243fc3f2016-11-28 16:05:09 -0800438 qcom,rradc-base = <0x4500>;
Subbaraman Narayanamurthyc1a94ed2016-10-05 19:58:58 -0700439 qcom,ki-coeff-soc-dischg = <30 60 90>;
440 qcom,ki-coeff-med-dischg = <800 1000 1400>;
441 qcom,ki-coeff-hi-dischg = <1200 1500 2100>;
Subbaraman Narayanamurthy94e63052017-02-09 18:06:14 -0800442 qcom,slope-limit-temp-threshold = <100>;
443 qcom,slope-limit-coeffs = <10 11 12 13>;
cyizhaofb3eec52017-01-24 17:08:55 +0800444 qcom,battery-thermal-coefficients = [9d 50 ff];
Subbaraman Narayanamurthy6accb262016-03-14 16:41:16 -0700445 status = "okay";
446
447 qcom,fg-batt-soc@4000 {
448 status = "okay";
449 reg = <0x4000 0x100>;
450 interrupts = <0x2 0x40 0x0 IRQ_TYPE_EDGE_BOTH>,
451 <0x2 0x40 0x1 IRQ_TYPE_EDGE_BOTH>,
452 <0x2 0x40 0x2 IRQ_TYPE_EDGE_BOTH>,
453 <0x2 0x40 0x3 IRQ_TYPE_EDGE_BOTH>;
454 interrupt-names = "soc-update",
455 "soc-ready",
456 "bsoc-delta",
457 "msoc-delta";
458
459 };
460
461 qcom,fg-batt-info@4100 {
462 status = "okay";
463 reg = <0x4100 0x100>;
464 interrupts = <0x2 0x41 0x3 IRQ_TYPE_EDGE_BOTH>;
465 interrupt-names = "batt-missing";
466 };
467
468 qcom,fg-memif@4400 {
469 status = "okay";
470 reg = <0x4400 0x100>;
471 };
472};