qpnp-smbcharger.txt 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. QPNP SMB Battery Charger
  2. QPNP SMB Charger is a single-cell switching mode battery charger. It can charge
  3. the battery and power the system via the USB and AC adapter input.
  4. The QPNP SMB Charger interfaces via the SPMI bus.
  5. There are six different peripherals adding the following functionality.
  6. Each of these peripherals are implemented as subnodes in the example at the
  7. end of this file.
  8. - qcom,chgr: Supports charging control and status
  9. reporting.
  10. - qcom,bat-if: Battery status reporting such as presence,
  11. temperature reporting and voltage collapse
  12. protection.
  13. - qcom,usb-chgpth: USB charge path detection and input current
  14. limiting configuration.
  15. - qcom,dc-chgpth: DC charge path detection and input current
  16. limiting configuration.
  17. - qcom,chg-misc: Miscellaneous features such as watchdog timers
  18. and SYSOK pin control
  19. - qcom,chg-otg: OTG configuration control.
  20. Parent node required properties:
  21. - compatible: Must be "qcom,qpnp-smbcharger"
  22. - #address-cells: Must be <1>
  23. - #size-cells: Must be <1>
  24. - qcom,pmic-revid: Should specify the phandle of PMIC
  25. revid module. This is used to identify
  26. the PMIC subtype.
  27. Sub node required properties:
  28. - reg: The SPMI address for this peripheral
  29. - interrupts: Specifies the interrupt associated with the peripheral.
  30. - interrupt-names: Specifies the interrupt names for the peripheral. Every
  31. available interrupt needs to have an associated name
  32. with it to indentify its purpose.
  33. The following lists each subnode and their corresponding
  34. required interrupt names:
  35. qcom,chgr:
  36. - chg-tcc-thr: Triggers on charge completion.
  37. - chg-taper-thr: Triggers on the taper charge
  38. transtion.
  39. - chg-inhibit: Notifies on battery voltage
  40. being too high to resume
  41. charging.
  42. - chg-p2f-thr: Triggers on transitioning from
  43. precharge to fastcharge.
  44. - chg-rechg-thr: Triggers on battery voltage
  45. falling below the resume
  46. threshold.
  47. qcom,bat-if:
  48. - batt-hot: Triggers on battery temperature
  49. hitting the hot threshold.
  50. Charging stops.
  51. - batt-warm: Triggers on battery temperature
  52. hitting the warm threshold.
  53. Charging current is reduced.
  54. - batt-cool: Triggers on battery temperature
  55. hitting the cool threshold.
  56. Charging current is reduced
  57. - batt-cold: Triggers on battery temperature
  58. hitting the cold threshold.
  59. Charging stops.
  60. - batt-missing: Battery missing status
  61. interrupt.
  62. - batt-low: Triggers on battery voltage
  63. falling across a low threshold.
  64. qcom,usb-chgpth:
  65. - usbin-uv: USB input voltage falls below a
  66. valid threshold.
  67. - usbin-src-det: USB automatic source detection
  68. finishes.
  69. qcom,dc-chgpth:
  70. - dcin-uv: DC input voltage falls below a
  71. valid threshold.
  72. qcom,chgr-misc:
  73. - wdog-timeout-mins: Charger watchdog timer
  74. interrupt.
  75. - temp-shutdown: Triggers when charger goes
  76. overtemp and causes a shutdown.
  77. - power-ok: Triggers when the charger
  78. switcher turns on or off.
  79. Regulator Subnodes:
  80. - qcom,smbcharger-boost-otg A subnode for a regulator device that turns on
  81. the charger boost for OTG operation.
  82. - qcom,smbcharger-external-otg A subnode for a regulator device that switches
  83. off charging and the USB input charge path
  84. in order to allow an external regulator to
  85. operate. This can be used in place of the
  86. qcom,smbcharger-boost-otg if an external boost
  87. is available.
  88. Regulator Sub node required properties:
  89. - regulator-name A name string for the regulator in question
  90. Optional Properties:
  91. - qcom,battery-psy-name The name of the main battery power supply that
  92. the charger will register. Failing to define
  93. this property will default the name to
  94. "battery".
  95. - qcom,bms-psy-name The psy name to use for reporting battery
  96. capacity. If left unspecified the capacity uses
  97. a preprogrammed default value of 50.
  98. - qcom,float-voltage-mv Float Voltage in mV - the maximum voltage up
  99. to which the battery is charged. Supported
  100. range 3600mV to 4500mV
  101. - qcom,float-voltage-comp Specifies the JEITA float voltage compensation.
  102. Value ranges from 0 to 63.
  103. - qcom,fastchg-current-ma Specifies the fast charge current in mA. Supported
  104. range is from 300mA to 3000mA.
  105. - qcom,fastchg-current-comp Specifies the fast charge current compensation in
  106. mA. Supported values are 250, 700, 900 and 1200mA.
  107. - qcom,charging-timeout-mins Maximum duration in minutes that a single
  108. charge cycle may last. Supported values are:
  109. 0, 192, 384, 768, and 1536. A value of 0
  110. means that no charge cycle timeout is used and
  111. charging can continue indefinitely.
  112. - qcom,precharging-timeout-mins Maximum duration in minutes that a single
  113. precharge cycle may last. Supported values
  114. are: 0, 24, 48, 96, 192. A value of 0 means
  115. that no precharge cycle timeout is used and
  116. charging can continue indefinitely. Note that
  117. the qcom,charging-timeout-mins property must
  118. be specified in order for this to take effect.
  119. - qcom,dc-psy-type The type of charger connected to the DC path.
  120. Can be "Mains", "Wireless" or "Wipower"
  121. - qcom,dc-psy-ma The current in mA dc path can support. Must be
  122. specified if dc-psy-type is specified. Valid
  123. range 300mA to 2000mA.
  124. - qcom,dcin-vadc The phandle to pmi8994 voltage adc. The ADC is
  125. used to get notifications when the DCIN voltage
  126. crosses a programmed min/max threshold. This is
  127. used to make configurations for optimized power
  128. draw for Wipower.
  129. - qcom,wipower-div2-ilim-map
  130. - qcom,wipower-pt-ilim-map
  131. - qcom,wipower-default-ilim-map
  132. Array of 5 elements to indicate the voltage ranges and their corresponding
  133. current limits. The 5 elements with index [0..4] are:
  134. [0] => voltage_low in uV
  135. [1] => voltage_high in uV
  136. [2] => current limit for pass through in mA
  137. [3] => current limit for div2 mode dcin low voltage in mA
  138. [4] => current limit for div2 mode dcin high voltage in mA
  139. The div2 and pt tables indicate the current limits
  140. to use when Wipower is operating in divide_by_2 mode
  141. and pass through mode respectively.
  142. The default table is used when the voltage ranges
  143. are beyond the ones specified in the mapping table.
  144. Note that if dcin-vadc or any of these mapping
  145. tables are not specified, dynamic dcin input
  146. is disabled.
  147. - qcom,charging-disabled Set this if charging should be disabled in the
  148. build by default.
  149. - qcom,resume-delta-mv Specifies the minimum voltage drop in
  150. millivolts below the float voltage that is
  151. required in order to initiate a new charging
  152. cycle. Supported values are: 50, 100, 200 and
  153. 300mV.
  154. - qcom,chg-inhibit-en Boolean that indicates whether the charge inhibit
  155. feature needs to be enabled. If this is not set,
  156. charge inhibit feature is disabled by default.
  157. - qcom,chg-inhibit-fg Indicates if the recharge threshold source has
  158. to be Fuel gauge ADC. If this is not set, it
  159. will be analog sensor by default.
  160. - qcom,bmd-algo-disabled Indicates if the battery missing detection
  161. algorithm is disabled. If this node is present
  162. SMB uses the THERM pin for battery missing
  163. detection.
  164. - qcom,charge-unknown-battery Boolean that indicates whether an unknown
  165. battery without a matching profile will be
  166. charged. If this is not set, if the fuel gauge
  167. does not recognize the battery based on its
  168. battery ID, the charger will not start
  169. charging.
  170. - qcom,bmd-pin-src A string that indicates the source pin for the
  171. battery missind detection. This can be either:
  172. - "bpd_none"
  173. battery is considered always present
  174. - "bpd_id"
  175. battery id pin is used
  176. - "bpd_thm"
  177. battery therm pin is used
  178. - "bpd_thm_id"
  179. both pins are used (battery is
  180. considered missing if either pin is
  181. floating).
  182. - qcom,iterm-ma Specifies the termination current to indicate
  183. end-of-charge. Possible values in mA:
  184. 50, 100, 150, 200, 250, 300, 500, 600.
  185. - qcom,iterm-disabled Disables the termination current feature. This
  186. is a boolean property.
  187. - otg-parent-supply A phandle to an external boost regulator for
  188. OTG if it exists.
  189. - qcom,thermal-mitigation: Array of input current limit values for
  190. different system thermal mitigation levels.
  191. This should be a flat array that denotates the
  192. maximum charge current in mA for each thermal
  193. level.
  194. - qcom,rparasitics-uohm: The parasitic resistance of the board following
  195. the line from the battery connectors through
  196. vph_power. This is used to calculate maximum
  197. available current of the battery.
  198. - qcom,vled-max-uv: The maximum input voltage of the flash leds.
  199. This is used to calculate maximum available
  200. current of the battery.
  201. - qcom,autoadjust-vfloat A boolean property that when set, makes the
  202. driver automatically readjust vfloat using the
  203. fuel gauge ADC readings to make charging more
  204. accurate.
  205. - qcom,jeita-temp-hard-limit property when present will enable or disable
  206. the jeita temperature hard limit based on the
  207. value 1 or 0. Specify 0 if the jeita temp hard
  208. limit needs to be disabled. If it is not present,
  209. jeita temperature hard limit will be based on what
  210. the bootloader had set earlier.
  211. - qcom,low-volt-dcin: A boolean property which upon set will enable the
  212. AICL deglitch configuration dynamically. This needs
  213. to be set if the DCIN supply is going to be less
  214. than or equal to 5V.
  215. - qcom,force-aicl-rerun: A boolean property which upon set will enable the
  216. AICL rerun by default along with the deglitch time
  217. configured to long interval (20 ms). Also, specifying
  218. this property will not adjust the AICL deglitch time
  219. dynamically for handling the battery over-voltage
  220. oscillations when the charger is headroom limited.
  221. - qcom,aicl-rerun-period-s If force-aicl-rerun is on, this property dictates
  222. how often aicl is reran in seconds. Possible values
  223. are 45, 90, 180, and 360.
  224. - qcom,ibat-ocp-threshold-ua Maximum current before the battery will trigger
  225. overcurrent protection. Use the recommended
  226. battery pack value minus some margin.
  227. - qcom,soft-vfloat-comp-disabled Set this property when the battery is
  228. powered via external source and could
  229. go above the float voltage.
  230. - qcom,parallel-usb-min-current-ma Minimum current drawn by the primary
  231. charger before enabling the parallel
  232. charger if one exists. Do not define
  233. this property if no parallel chargers
  234. exist.
  235. - qcom,parallel-usb-9v-min-current-ma Minimum current drawn by the primary
  236. charger before enabling the parallel
  237. charger if one exists. This property
  238. applies only for 9V chargers.
  239. - qcom,parallel-allowed-lowering-ma Acceptable current drop from the initial limit
  240. to keep parallel charger activated. If the
  241. charger current reduces beyond this threshold
  242. parallel charger is disabled. Must be specified
  243. if parallel charger is used.
  244. - qcom,parallel-main-chg-fcc-percent Percentage of the fast charge current allotted to the
  245. main charger when parallel charging is enabled and
  246. operational. If this property is not defined, the
  247. driver defaults to a 50%/50% split between the main
  248. and parallel charger.
  249. - qcom,parallel-main-chg-icl-percent Percentage of the input current allotted to the
  250. main charger when parallel charging is enabled and
  251. operational. If this property is not defined, the
  252. driver defaults to a 60%/40% split between the main
  253. and parallel charger.
  254. - qcom,battery-data Points to the phandle of node which
  255. contains the battery-profiles supported
  256. by the charger/FG.
  257. - qcom,chg-led-support A bool property to support the charger led feature.
  258. - qcom,chg-led-sw-controls A bool property to allow the software to control
  259. the charger led without a valid charger.
  260. - qcom,skip-usb-notification A boolean property to be used when usb gets present
  261. and type from other means. Especially true on
  262. liquid hardware, where usb presence is detected based on GPIO.
  263. - qcom,skip-usb-suspend-for-fake-battery A boolean property to skip
  264. suspending USB path for fake
  265. battery.
  266. - qcom,vchg_sns-vadc Phandle of the VADC node.
  267. - qcom,vchg-adc-channel-id The ADC channel to which the VCHG is routed.
  268. - qcom,max-pulse-allowed The maximum number of pulses allowed in
  269. HVDCP3 mode. It can be used to restrict VBUS
  270. to a value.
  271. Example:
  272. qcom,qpnp-smbcharger {
  273. compatible = "qcom,qpnp-smbcharger";
  274. #address-cells = <1>;
  275. #size-cells = <1>;
  276. qcom,iterm-ma = <100>;
  277. qcom,float-voltage-mv = <4200>;
  278. qcom,resume-delta-mv = <100>;
  279. qcom,bmd-pin-src = "bpd_thm_id";
  280. qcom,dc-psy-type = "Mains";
  281. qcom,dc-psy-ma = <1500>;
  282. qcom,bms-psy-name = "bms";
  283. qcom,battery-psy-name = "battery";
  284. qcom,thermal-mitigation = <1500 700 600 325>;
  285. qcom,vchg_sns-vadc = <&pmi8950_vadc>;
  286. qcom,vchg-adc-channel-id = <3>;
  287. qcom,chgr@1000 {
  288. reg = <0x1000 0x100>;
  289. interrupts = <0x2 0x10 0x0>,
  290. <0x2 0x10 0x1>,
  291. <0x2 0x10 0x2>,
  292. <0x2 0x10 0x3>,
  293. <0x2 0x10 0x4>,
  294. <0x2 0x10 0x5>,
  295. <0x2 0x10 0x6>,
  296. <0x2 0x10 0x7>;
  297. interrupt-names = "chg-error",
  298. "chg-inhibit",
  299. "chg-prechg-sft",
  300. "chg-complete-chg-sft",
  301. "chg-p2f-thr",
  302. "chg-rechg-thr",
  303. "chg-taper-thr",
  304. "chg-tcc-thr";
  305. };
  306. qcom,otg@1100 {
  307. reg = <0x1100 0x100>;
  308. };
  309. qcom,bat-if@1200 {
  310. reg = <0x1200 0x100>;
  311. interrupts = <0x2 0x12 0x0>,
  312. <0x2 0x12 0x1>,
  313. <0x2 0x12 0x2>,
  314. <0x2 0x12 0x3>,
  315. <0x2 0x12 0x4>,
  316. <0x2 0x12 0x5>,
  317. <0x2 0x12 0x6>,
  318. <0x2 0x12 0x7>;
  319. interrupt-names = "batt-hot",
  320. "batt-warm",
  321. "batt-cold",
  322. "batt-cool",
  323. "batt-ov",
  324. "batt-low",
  325. "batt-missing",
  326. "batt-term-missing";
  327. };
  328. qcom,usb-chgpth@1300 {
  329. reg = <0x1300 0x100>;
  330. interrupts = <0x2 0x13 0x0>,
  331. <0x2 0x13 0x1>,
  332. <0x2 0x13 0x2>,
  333. <0x2 0x13 0x3>,
  334. <0x2 0x13 0x4>,
  335. <0x2 0x13 0x5>,
  336. <0x2 0x13 0x6>;
  337. interrupt-names = "usbin-uv",
  338. "usbin-ov",
  339. "usbin-src-det",
  340. "otg-fail",
  341. "otg-oc",
  342. "aicl-done",
  343. "usbid-change";
  344. };
  345. qcom,dc-chgpth@1400 {
  346. reg = <0x1400 0x100>;
  347. interrupts = <0x2 0x14 0x0>,
  348. <0x2 0x14 0x1>;
  349. interrupt-names = "dcin-uv",
  350. "dcin-ov";
  351. };
  352. qcom,chgr-misc@1600 {
  353. reg = <0x1600 0x100>;
  354. interrupts = <0x2 0x16 0x0>,
  355. <0x2 0x16 0x1>,
  356. <0x2 0x16 0x2>,
  357. <0x2 0x16 0x3>,
  358. <0x2 0x16 0x4>,
  359. <0x2 0x16 0x5>;
  360. interrupt-names = "power-ok",
  361. "temp-shutdown",
  362. "wdog-timeout",
  363. "flash-fail",
  364. "otst2",
  365. "otst3";
  366. };
  367. };