qpnp-charger.txt 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. Qualcomm QPNP Charger
  2. The charger supports the switch mode battery charger and boost (SMBB)
  3. peripherals on Qualcomm PMIC chips.
  4. There are seven different peripherals adding the following functionality.
  5. Each of these peripherals are implemented as subnodes in the example at the
  6. end of this file.
  7. - qcom,chgr: Supports charging control and status
  8. reporting.
  9. - qcom,bat-if: Battery status reporting such as presence,
  10. temperature reporting and voltage collapse
  11. protection.
  12. - qcom,buck: Charger buck configuration and status
  13. reporting with regards to several regulation
  14. loops such as vdd, ibat etc.
  15. - qcom,usb-chgpth: USB charge path detection and input current
  16. limiting configuration.
  17. - qcom,dc-chgpth: DC charge path detection and input current
  18. limiting configuration.
  19. - qcom,chg-misc: Miscellaneous features such as buck frequency
  20. settings, comparator override features etc.
  21. Parent node required properties:
  22. - qcom,vddmax-mv: Target voltage of battery in mV.
  23. - qcom,vddsafe-mv: Maximum Vdd voltage in mV.
  24. - qcom,vinmin-mv: Minimum input voltage in mV.
  25. - qcom,ibatmax-ma: Maximum battery charge current in mA
  26. - qcom,ibatsafe-ma: Safety battery current setting
  27. - qcom,thermal-mitigation: Array of ibatmax values for different
  28. system thermal mitigation level.
  29. Parent node optional properties:
  30. - qcom,ibatterm-ma: Current at which charging is terminated when
  31. the analog end of charge option is selected.
  32. - qcom,maxinput-usb-ma: Maximum input current USB.
  33. - qcom,maxinput-dc-ma: Maximum input current DC.
  34. - qcom,vbatdet-delta-mv: Battery charging resume delta.
  35. - qcom,vbatweak-mv: Weak battery voltage threshold in mV, above which
  36. fast charging can start. The supported voltage range is
  37. from 2100mV to 3600mV with a step size of 100mV.
  38. - qcom,charging-disabled: Set this property to disable charging
  39. by default. This can then be overriden
  40. writing the the module parameter
  41. "charging_disabled".
  42. - qcom,duty-cycle-100p: Set this property to enable the 100% duty
  43. cycle feature.
  44. - qcom,use-default-batt-values: Set this flag to force reporting of
  45. battery temperature of 250 decidegree
  46. Celsius, state of charge to be 50%
  47. and disable charging.
  48. - qcom,warm-bat-decidegc: Warm battery temperature in decidegC.
  49. - qcom,cool-bat-decidegc: Cool battery temperature in decidegC.
  50. Note that if both warm and cool battery
  51. temperatures are set, the corresponding
  52. ibatmax and bat-mv properties are
  53. required to be set.
  54. - qcom,ibatmax-cool-ma: Maximum cool battery charge current.
  55. - qcom,ibatmax-warm-ma: Maximum warm battery charge current.
  56. - qcom,warm-bat-mv: Warm temperature battery target voltage.
  57. - qcom,cool-bat-mv: Cool temperature battery target voltage.
  58. - qcom,tchg-mins: Maximum total software initialized charge time.
  59. - qcom,bpd-detection: Select a battery presence detection scheme by
  60. specifying either "bpd_thm", "bpd_id" or
  61. "bpd_thm_id". "bpd_thm" selects the temperature
  62. pin, "bpd_id" uses the id pin for battery presence
  63. detection, "bpd_thm_id" selects both.
  64. If the property is not set, the temperatue pin will
  65. be used.
  66. - qcom,btc-disabled: If flag is set battery hot and cold monitoring is
  67. disabled in hardware. This monitoring is turned on
  68. by default.
  69. - qcom,batt-hot-percent: Specify a supported hot threshold percentage.
  70. Supported thresholds: 25% and 35%. If none is specified
  71. hardware defaults will be used.
  72. - qcom,batt-cold-percent: Specify a supported cold threshold percentage.
  73. Supported thresholds: 70% and 80%. If none is specified
  74. hardware defaults will be used.
  75. - otg-parent-supply Specify a phandle to a parent supply regulator
  76. for the OTG regulator.
  77. - boost-parent-supply Specify a phandle to a parent supply regulator
  78. for the boost regulator.
  79. - qcom,resume-soc Capacity in percent at which charging should resume
  80. when a fully charged battery drops below this level.
  81. - qcom,chg-vadc Corresponding VADC device's phandle.
  82. - qcom,pmic-revid The phandle to the revid node of the pmic on which charger
  83. peripheral is present. This property is a must on PMIC chips
  84. that exhibit inaccuracies in battery current readings. This
  85. phandle is used to check the version of the PMIC and apply
  86. necessary software workarounds.
  87. - qcom,ovp-monitor-en The ovp is enabled on hw by default. If this flag is
  88. set, the charger ovp status is monitored in software.
  89. - qcom,ext-ovp-present Indicates if an external OVP exists which reduces the
  90. overall input resistance of the charge path.
  91. - qcom,ibat-calibration-enabled Indicates if ibat calibration is enabled. This is
  92. required for devices which have a ibat trim error
  93. causing ibatmax to go out of spec.
  94. - qcom,power-stage-reduced Indicates if power stage workaround is enabled. This work
  95. around reduces the power stage segments while charging
  96. under high load during low battery voltages. It's for
  97. improving IADC accuracy while board has a bad layout.
  98. - qcom,use-external-rsense A boolean that controls whether BMS will use
  99. an external sensor resistor instead of the default
  100. RDS of the batfet.
  101. - qcom,vbatdet-maxerr-mv This property in mV is a hystersis value for the charge
  102. resume voltage property qcom,vbatdet-delta-mv. If this
  103. property is not defined it defaults to 50 mV.
  104. - qcom,parallel-ovp-mode When this option is enabled, it allows charging through both
  105. DC and USB OVP FETs. Please note that this should only
  106. be enabled in board designs with PM8941 which have DC_IN
  107. and USB_IN connected via a short.
  108. - qcom,ext-ovp-isns-enable-gpio External OVP enable GPIO.
  109. - qcom,ext-ovp-isns-r-ohm External ISNS OVP resistance in ohm.
  110. Sub node required structure:
  111. - A qcom,chg node must be a child of an SPMI node that has specified
  112. the spmi-dev-container property. Each subnode reflects
  113. a hardware peripheral which adds a unique set of features
  114. to the collective charging device. For example USB detection
  115. and the battery interface are each seperate peripherals and
  116. each should be their own subnode.
  117. - qcom,chg-adc_tm Corresponding ADC TM device's phandle to set recurring
  118. measurements and receive notification for batt_therm.
  119. Sub node required properties:
  120. - compatible: Must be "qcom,qpnp-charger".
  121. - reg: Specifies the SPMI address and size for this peripheral.
  122. - interrupts: Specifies the interrupt associated with the peripheral.
  123. - interrupt-names: Specifies the interrupt names for the peripheral. Every
  124. available interrupt needs to have an associated name
  125. with it to indentify its purpose.
  126. The following lists each subnode and their corresponding
  127. required interrupt names:
  128. qcom,usb-chgpth:
  129. - usbin-valid
  130. - usb-ocp (only for SMBBP and SMBCL)
  131. qcom,chgr:
  132. - chg-done
  133. - chg-failed
  134. The following interrupts are available:
  135. qcom,chgr:
  136. - chg-done: Triggers on charge completion.
  137. - chg-failed: Notifies of charge failures.
  138. - fast-chg-on: Notifies of fast charging state.
  139. - trkl-chg-on: Indicates trickle charging.
  140. - state-change: Notifies of a state change in
  141. the charger state machine.
  142. - chgwdog: Charger watchdog interrupt.
  143. - vbat-det-hi: Triggers on vbat-det-hi voltage
  144. setting,can be used as
  145. battery alarm.
  146. - vbat-det-hi: Triggers on vbat-det-low voltage
  147. setting, can be used as
  148. battery alarm.
  149. qcom,buck:
  150. - vdd-loop: VDD loop change interrupt.
  151. - ibat-loop: Ibat loop change interrupt.
  152. - ichg-loop: Charge current loop change.
  153. - vchg-loop: Charge voltage loop change.
  154. - overtemp: Overtemperature interrupt.
  155. - vref-ov: Reference overvoltage interrupt.
  156. - vbat-ov: Battery overvoltage interrupt.
  157. qcom,bat-if:
  158. - psi: PMIC serial interface interrupt.
  159. - vcp-on: Voltage collapse protection
  160. status interrupt.
  161. - bat-fet-on: BATFET status interrupt.
  162. - bat-temp-ok: Battery temperature status
  163. interrupt.
  164. - batt-pres: Battery presence status
  165. interrupt.
  166. qcom,usb-chgpth:
  167. - usbin-valid: Indicates valid USB connection.
  168. - coarse-det-usb: Coarse detect interrupt triggers
  169. at low voltage on USB_IN.
  170. - chg-gone: Triggers on VCHG line.
  171. - usb-ocp Triggers on over current conditions when
  172. reverse boosting. (Only available on
  173. SMBCL and SMBBP devices).
  174. qcom,dc-chgpth:
  175. - dcin-valid: Indicates a valid DC charger
  176. connection.
  177. - coarse-det-dc: Coarse detect interrupt triggers
  178. at low voltage on DC_IN.
  179. qcom,boost:
  180. - limit-error: Limiting error on SMBB boost.
  181. - boost-pwr-ok: Status of boost power.
  182. Sub node optional properties:
  183. qcom,usb-chgpth:
  184. - regulator-name: A string used as a descriptive name
  185. for the OTG regulator.
  186. qcom,boost:
  187. - regulator-min-microvolt: Minimum boost voltage setting.
  188. - regulator-max-microvolt: Maximum boost voltage setting.
  189. - regulator-name: A string used as a descriptive name
  190. for the boost regulator.
  191. qcom,batfet:
  192. - regulator-name: A string used as a descriptive name
  193. for the batfet regulator.
  194. qcom,chgr:
  195. - regulator-name: A string used as a descriptive name
  196. for the flash workarounds regulator.
  197. Example:
  198. pm8941-chg {
  199. spmi-dev-container;
  200. compatible = "qcom,qpnp-charger";
  201. #address-cells = <1>;
  202. #size-cells = <1>;
  203. otg-parent-supply = <&pm8941_boost>;
  204. boost-parent-supply = <&foo_parent_reg>;
  205. qcom,vddmax-mv = <4200>;
  206. qcom,vddsafe-mv = <4200>;
  207. qcom,vinmin-mv = <4200>;
  208. qcom,ibatmax-ma = <1500>;
  209. qcom,ibatterm-ma = <200>;
  210. qcom,ibatsafe-ma = <1500>;
  211. qcom,vbatweak-mv = <3200>;
  212. qcom,thermal-mitigation = <1500 700 600 325>;
  213. qcom,cool-bat-degc = <10>;
  214. qcom,cool-bat-mv = <4100>;
  215. qcom,ibatmax-warm-ma = <350>;
  216. qcom,warm-bat-degc = <45>;
  217. qcom,warm-bat-mv = <4100>;
  218. qcom,ibatmax-cool-ma = <350>;
  219. qcom,vbatdet-delta-mv = <60>;
  220. qcom,batt-hot-percent = <25>;
  221. qcom,batt-cold-percent = <85>;
  222. qcom,btc-disabled = <0>;
  223. qcom,chg-vadc = <&pm8941_vadc>;
  224. qcom,chg-adc_tm = <&pm8941_adc_tm>;
  225. qcom,pmic-revid = <&pm8941_revid>;
  226. qcom,chgr@1000 {
  227. reg = <0x1000 0x100>;
  228. interrupts = <0x0 0x10 0x0>,
  229. <0x0 0x10 0x1>,
  230. <0x0 0x10 0x2>,
  231. <0x0 0x10 0x3>,
  232. <0x0 0x10 0x4>,
  233. <0x0 0x10 0x5>,
  234. <0x0 0x10 0x6>,
  235. <0x0 0x10 0x7>;
  236. interrupt-names = "chg-done",
  237. "chg-failed",
  238. "fast-chg-on",
  239. "trkl-chg-on",
  240. "state-change",
  241. "chgwdog",
  242. "vbat-det-hi",
  243. "vbat-det-lo";
  244. };
  245. qcom,buck@1100 {
  246. reg = <0x1100 0x100>;
  247. interrupts = <0x0 0x11 0x0>,
  248. <0x0 0x11 0x1>,
  249. <0x0 0x11 0x2>,
  250. <0x0 0x11 0x3>,
  251. <0x0 0x11 0x4>,
  252. <0x0 0x11 0x5>,
  253. <0x0 0x11 0x6>;
  254. interrupt-names = "vdd-loop",
  255. "ibat-loop",
  256. "ichg-loop",
  257. "vchg-loop",
  258. "overtemp",
  259. "vref-ov",
  260. "vbat-ov";
  261. };
  262. qcom,bat-if@1200 {
  263. reg = <0x1200 0x100>;
  264. interrupts = <0x0 0x12 0x0>,
  265. <0x0 0x12 0x1>,
  266. <0x0 0x12 0x2>,
  267. <0x0 0x12 0x3>,
  268. <0x0 0x12 0x4>;
  269. interrupt-names = "psi",
  270. "vcp-on",
  271. "bat-fet-on",
  272. "bat-temp-ok",
  273. "batt-pres";
  274. };
  275. pm8941_chg_otg: qcom,usb-chgpth@1300 {
  276. reg = <0x1300 0x100>;
  277. interrupts = <0 0x13 0x0>,
  278. <0 0x13 0x1>,
  279. <0x0 0x13 0x2>;
  280. interrupt-names = "usbin-valid",
  281. "coarse-det-usb",
  282. "chg-gone";
  283. };
  284. qcom,dc-chgpth@1400 {
  285. reg = <0x1400 0x100>;
  286. interrupts = <0x0 0x14 0x0>,
  287. <0x0 0x14 0x1>;
  288. interrupt-names = "dcin-valid",
  289. "coarse-det-dc";
  290. };
  291. pm8941_chg_boost: qcom,boost@1500 {
  292. reg = <0x1500 0x100>;
  293. interrupts = <0x0 0x15 0x0>,
  294. <0x0 0x15 0x1>;
  295. interrupt-names = "limit-error",
  296. "boost-pwr-ok";
  297. };
  298. qcom,misc@1600 {
  299. reg = <0x1600 0x100>;
  300. };
  301. };
  302. In regulator specific device tree file:
  303. &pm8941_chg_boost {
  304. regulator-min-microvolt = <5000000>;
  305. regulator-max-microvolt = <5000000>;
  306. regulator-name = "8941_smbb_boost";
  307. };
  308. &pm8941_chg_batif {
  309. regulator-name = "batfet";
  310. };
  311. &pm8941_chg_otg {
  312. regulator-name = "8941_smbb_otg";
  313. };