qpnp-qg.txt 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. Qualcomm Techonologies, Inc. QPNP PMIC QGAUGE (QG) Device
  2. QPNP PMIC QGAUGE device provides the ability to gauge the State-of-Charge
  3. of the battery. It provides an interface to the clients to read various
  4. battery related parameters.
  5. =======================
  6. Required Node Structure
  7. =======================
  8. Qgauge device must be described in two level of nodes. The first level
  9. describes the properties of the Qgauge device and the second level
  10. describes the peripherals managed/used of the module.
  11. ====================================
  12. First Level Node - QGAUGE device
  13. ====================================
  14. - compatible
  15. Usage: required
  16. Value type: <string>
  17. Definition: Should be "qcom,qpnp-qg".
  18. - qcom,pmic-revid
  19. Usage: required
  20. Value type: <phandle>
  21. Definition: Should specify the phandle of PMIC revid module. This is
  22. used to identify the PMIC subtype.
  23. - qcom,qg-vadc
  24. Usage: required
  25. Value type: <phandle>
  26. Definition: Phandle for the VADC node, it is used for BATT_ID and
  27. BATT_THERM readings.
  28. - qcom,vbatt-empty-mv
  29. Usage: optional
  30. Value type: <u32>
  31. Definition: The battery voltage threshold (in mV) at which the
  32. vbatt-empty interrupt fires. The SOC is forced to 0
  33. when this interrupt fires. If not specified, the
  34. default value is 3200 mV.
  35. - qcom,vbatt-empty-cold-mv
  36. Usage: optional
  37. Value type: <u32>
  38. Definition: The battery voltage threshold (in mV) at which the
  39. vbatt-empty interrupt fires. This threshold is only
  40. applied at cold temperature specified by
  41. 'qcom,cold-temp-threshold'. The SOC is forced to 0
  42. when this interrupt fires. If not specified, the
  43. default value is 3000 mV.
  44. - qcom,vbatt-cutoff-mv
  45. Usage: optional
  46. Value type: <u32>
  47. Definition: The battery voltage threshold (in mV) at which the
  48. the Qgauge algorithm converges to 0 SOC. If not specified
  49. the default value is 3400 mV.
  50. - qcom,vbatt-low-mv
  51. Usage: optional
  52. Value type: <u32>
  53. Definition: The battery voltage threshold (in mV) at which the
  54. the VBAT_LOW interrupt fires. Software can take necessary
  55. the action when this interrupt fires. If not specified
  56. the default value is 3500 mV.
  57. - qcom,vbatt-low-cold-mv
  58. Usage: optional
  59. Value type: <u32>
  60. Definition: The battery voltage threshold (in mV) at which the
  61. the VBAT_LOW interrupt fires. The threshold is only
  62. applied at cold temperature specified by
  63. 'qcom,cold-temp-threshold'. Software can take necessary
  64. the action when this interrupt fires. If not specified
  65. the default value is 3800 mV.
  66. - qcom,qg-iterm-ma
  67. Usage: optional
  68. Value type: <u32>
  69. Definition: The battery current (in mA) at which the the QG algorithm
  70. converges the SOC to 100% during charging and can be used to
  71. terminate charging. If not specified, the default value is
  72. 100mA.
  73. - qcom,delta-soc
  74. Usage: optional
  75. Value type: <u32>
  76. Definition: The SOC percentage increase at which the SOC is
  77. periodically reported to the userspace. If not specified,
  78. the value defaults to 1%.
  79. - qcom,s2-fifo-length
  80. Usage: optional
  81. Value type: <u32>
  82. Definition: The total number if FIFO samples which need to be filled up
  83. in S2 state of QG to fire the FIFO DONE interrupt.
  84. Minimum value = 1 Maximum Value = 8. If not specified,
  85. the default value is 5.
  86. - qcom,s2-acc-length
  87. Usage: optional
  88. Value type: <u32>
  89. Definition: The number of distinct V & I samples to be accumulated
  90. in each FIFO in the S2 state of QG.
  91. Minimum Value = 0 Maximum Value = 256. If not specified,
  92. the default value is 128.
  93. - qcom,s2-acc-interval-ms
  94. Usage: optional
  95. Value type: <u32>
  96. Definition: The time (in ms) between each of the V & I samples being
  97. accumulated in FIFO.
  98. Minimum Value = 0 ms Maximum Value = 2550 ms. If not
  99. specified the default value is 100 ms.
  100. - qcom,ocv-timer-expiry-min
  101. Usage: optional
  102. Value type: <u32>
  103. Definition: The maximum time (in minutes) for the QG to transition from
  104. S3 to S2 state.
  105. Minimum Value = 2 min Maximum Value = 30 min. If not
  106. specified the hardware default is set to 14 min.
  107. - qcom,ocv-tol-threshold-uv
  108. Usage: optional
  109. Value type: <u32>
  110. Definition: The OCV detection error tolerance (in uV). The maximum
  111. voltage allowed between 2 VBATT readings in the S3 state
  112. to qualify for a valid OCV.
  113. Minimum Value = 0 uV Maximum Value = 12262 uV Step = 195 uV
  114. - qcom,s3-entry-fifo-length
  115. Usage: optional
  116. Value type: <u32>
  117. Definition: The minimum number if FIFO samples which have to qualify the
  118. S3 IBAT entry threshold (qcom,s3-entry-ibat-ua) for QG
  119. to enter into S3 state.
  120. Minimum Value = 1 Maximum Value = 8. The hardware default
  121. is configured to 3.
  122. - qcom,s3-entry-ibat-ua
  123. Usage: optional
  124. Value type: <u32>
  125. Definition: The battery current (in uA) for the QG to enter into the S3
  126. state. The QG algorithm enters into S3 if the battery
  127. current is lower than this threshold consecutive for
  128. the FIFO length specified in 'qcom,s3-entry-fifo-length'.
  129. Minimum Value = 0 uA Maximum Value = 155550 uA
  130. Step = 610 uA.
  131. - qcom,s3-exit-ibat-ua
  132. Usage: optional
  133. Value type: <u32>
  134. Definition: The battery current (in uA) for the QG to exit S3 state.
  135. If the battery current is higher than this threshold QG
  136. exists S3 state.
  137. Minimum Value = 0 uA Maximum Value = 155550 uA
  138. Step = 610 uA.
  139. - qcom,rbat-conn-mohm
  140. Usage: optional
  141. Value type: <u32>
  142. Definition: Resistance of the battery connectors in mOhms.
  143. - qcom,ignore-shutdown-soc-secs
  144. Usage: optional
  145. Value type: <u32>
  146. Definition: Time in seconds beyond which shutdown SOC is ignored.
  147. If not specified the default value is 360 secs.
  148. - qcom,hold-soc-while-full
  149. Usage: optional
  150. Value type: <empty>
  151. Definition: A boolean property that when defined holds SOC at 100% when
  152. the battery is full until recharge starts.
  153. - qcom,linearize-soc
  154. Usage: optional
  155. Value type: <empty>
  156. Definition: A boolean property that when defined linearizes SOC when
  157. the SOC drops after charge termination monotonically to
  158. improve the user experience. This is applicable only if
  159. "qcom,hold-soc-while-full" is specified.
  160. - qcom,cold-temp-threshold
  161. Usage: optional
  162. Value type: <u32>
  163. Definition: Temperature threshold in decidegree at which the low
  164. temperature specific configuration as applied. If not
  165. specified, the default value is 0 degree centigrade.
  166. - qcom,cl-disable
  167. Usage: optional
  168. Value type: <empty>
  169. Definition: A boolean property to disable the battery capacity
  170. learning when charging.
  171. - qcom,cl-feedback-on
  172. Usage: optional
  173. Value type: <empty>
  174. Definition: A boolean property to feedback the learned capacity into
  175. the capacity lerning algorithm. This has to be used only if the
  176. property "qcom,cl-disable" is not specified.
  177. - qcom,cl-max-start-soc
  178. Usage: optional
  179. Value type: <u32>
  180. Definition: Battery SOC has to be below or equal to this value at the
  181. start of a charge cycle to start the capacity learning.
  182. If this is not specified, then the default value used
  183. will be 15. Unit is in percentage.
  184. - qcom,cl-min-start-soc
  185. Usage: optional
  186. Value type: <u32>
  187. Definition: Battery SOC has to be above or equal to this value at the
  188. start of a charge cycle to start the capacity learning.
  189. If this is not specified, then the default value used
  190. will be 10. Unit is in percentage.
  191. - qcom,cl-min-temp
  192. Usage: optional
  193. Value type: <u32>
  194. Definition: Lower limit of battery temperature to start the capacity
  195. learning. If this is not specified, then the default value
  196. used will be 150 (15 C). Unit is in decidegC.
  197. - qcom,cl-max-temp
  198. Usage: optional
  199. Value type: <u32>
  200. Definition: Upper limit of battery temperature to start the capacity
  201. learning. If this is not specified, then the default value
  202. used will be 500 (50 C). Unit is in decidegC.
  203. - qcom,cl-max-increment
  204. Usage: optional
  205. Value type: <u32>
  206. Definition: Maximum capacity increment allowed per capacity learning
  207. cycle. If this is not specified, then the default value
  208. used will be 5 (0.5%). Unit is in decipercentage.
  209. - qcom,cl-max-decrement
  210. Usage: optional
  211. Value type: <u32>
  212. Definition: Maximum capacity decrement allowed per capacity learning
  213. cycle. If this is not specified, then the default value
  214. used will be 100 (10%). Unit is in decipercentage.
  215. - qcom,cl-min-limit
  216. Usage: optional
  217. Value type: <u32>
  218. Definition: Minimum limit that the capacity cannot go below in a
  219. capacity learning cycle. If this is not specified, then
  220. the default value is 0. Unit is in decipercentage.
  221. - qcom,cl-max-limit
  222. Usage: optional
  223. Value type: <u32>
  224. Definition: Maximum limit that the capacity cannot go above in a
  225. capacity learning cycle. If this is not specified, then
  226. the default value is 0. Unit is in decipercentage.
  227. ==========================================================
  228. Second Level Nodes - Peripherals managed by QGAUGE driver
  229. ==========================================================
  230. - reg
  231. Usage: required
  232. Value type: <prop-encoded-array>
  233. Definition: Addresses and sizes for the specified peripheral
  234. - interrupts
  235. Usage: optional
  236. Value type: <prop-encoded-array>
  237. Definition: Interrupt mapping as per the interrupt encoding
  238. - interrupt-names
  239. Usage: optional
  240. Value type: <stringlist>
  241. Definition: Interrupt names. This list must match up 1-to-1 with the
  242. interrupts specified in the 'interrupts' property.
  243. ========
  244. Example
  245. ========
  246. pmi632_qg: qpnp,qg {
  247. compatible = "qcom,qpnp-qg";
  248. qcom,pmic-revid = <&pmi632_revid>;
  249. qcom,qg-vadc = <&pmi632_vadc>;
  250. qcom,vbatt-empty-mv = <3200>;
  251. qcom,vbatt-low-mv = <3500>;
  252. qcom,vbatt-cutoff-mv = <3400>;
  253. qcom,qg-iterm-ma = <100>;
  254. qcom,qgauge@4800 {
  255. status = "okay";
  256. reg = <0x4800 0x100>;
  257. interrupts = <0x2 0x48 0x0 IRQ_TYPE_EDGE_BOTH>,
  258. <0x2 0x48 0x1 IRQ_TYPE_EDGE_BOTH>,
  259. <0x2 0x48 0x2 IRQ_TYPE_EDGE_BOTH>,
  260. <0x2 0x48 0x4 IRQ_TYPE_EDGE_BOTH>,
  261. <0x2 0x48 0x5 IRQ_TYPE_EDGE_BOTH>,
  262. <0x2 0x48 0x6 IRQ_TYPE_EDGE_BOTH>;
  263. interrupt-names = "qg-batt-missing",
  264. "qg-vbat-low",
  265. "qg-vbat-empty",
  266. "qg-fifo-done",
  267. "qg-good-ocv",
  268. "qg-fsm-state-chg",
  269. "qg-event";
  270. };
  271. qcom,qg-sdam@b000 {
  272. status = "okay";
  273. reg = <0xb000 0x100>;
  274. };
  275. };