qpnp-vm-bms.txt 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. Qualcomm's QPNP Voltage-Mode(VM) PMIC Battery Management System
  2. QPNP PMIC VM BMS provides interface to clients to read properties related
  3. to the battery. Its main function is to calculate the SOC (state of charge)
  4. of the battery based on periodic sampling of the VBAT (battery voltage).
  5. Parent node required properties:
  6. - compatible : Must be "qcom,qpnp-vm-bms" for the BM driver.
  7. - reg : Offset and length of the PMIC peripheral register map.
  8. - interrupts : The interrupt mappings.
  9. The format should be
  10. <slave-id peripheral-id interrupt-number>.
  11. - interrupt-names : names for the mapped bms interrupt
  12. The following interrupts are required:
  13. 0 : leave CV state
  14. 1 : enter CV state
  15. 2 : good ocv generated
  16. 3 : ocv_thr
  17. 4 : fifo update
  18. 5 : fsm state chnaged
  19. Additionally, optional subnodes may be included:
  20. - qcom,batt-pres-status : A subnode with a register address for the SMBB
  21. battery interface's BATT_PRES_STATUS register. If this node is
  22. added, then the BMS will try to detect offmode battery removal
  23. via the battery interface's offmode battery removal circuit.
  24. - qcom,battery-data : A phandle to a node containing the available batterydata
  25. profiles. See the batterydata bindings documentation for more
  26. details.
  27. Parent node required properties:
  28. - qcom,v-cutoff-uv : cutoff voltage where the battery is considered dead in
  29. micro-volts.
  30. - qcom,max-voltage-uv : maximum voltage for the battery in micro-volts.
  31. - qcom,r-conn-mohm : connector resistance in milli-ohms.
  32. - qcom,shutdown-soc-valid-limit : If the ocv upon restart is within this
  33. distance of the shutdown ocv, the BMS will try to force
  34. the new SoC to the old one to provide charge continuity.
  35. That is to say,
  36. if (abs(shutdown-soc - current-soc) < limit)
  37. then use old SoC.
  38. - qcom,low-soc-calculate-soc-threshold : The SoC threshold for when
  39. the periodic calculate_soc work speeds up. This ensures
  40. SoC is updated in userspace constantly when we are near
  41. shutdown.
  42. - qcom,low-voltage-threshold : The battery voltage threshold in micro-volts for
  43. when the BMS tries to wake up and hold a wakelock to
  44. ensure a clean shutdown.
  45. - qcom,low-voltage-calculate-soc-ms : The time period between subsequent
  46. SoC recalculations when the current voltage is below
  47. qcom,low-voltage threshold. This takes precedence over
  48. qcom,low-soc-calculate-soc-ms.
  49. - qcom,low-soc-calculate-soc-ms : The time period between subsequent
  50. SoC recalculations when the current SoC is below
  51. qcom,low-soc-calculate-soc-threshold. This takes
  52. precedence over qcom,calculate-soc-ms.
  53. - qcom,calculate-soc-ms : The time period between subsequent SoC
  54. recalculations when the current SoC is above or equal
  55. qcom,low-soc-calculate-soc-threshold.
  56. - qcom,volatge-soc-timeout-ms : The timeout period after which the module starts
  57. reporting volage based SOC and does not use the VMBMS
  58. algorithm for SOC calculation.
  59. - qcom,bms-vadc: Corresponding VADC device's phandle.
  60. - qcom,bms-adc_tm: Corresponding ADC_TM device's phandle to set recurring
  61. measurements and receive notifications for vbatt.
  62. - qcom,pmic-revid : Phandle pointing to the revision peripheral node.
  63. Parent node Optional properties
  64. - qcom,s1-sample-interval-ms: The sampling rate in ms of the accumulator in state
  65. S1. (i.e) the rate at which the accumulator is being
  66. filled with vbat samples. Minimum value = 0 and
  67. Maximum value = 2550ms.
  68. - qcom,s2-sample-interval-ms: The sampling rate in ms of the accumulator in state
  69. S2. (i.e) the rate at which the accumulator is being
  70. filled with vbat samples. Minimum value = 0 and
  71. Maximum value = 2550ms.
  72. - qcom,s1-sample-count: The number of samples to be accululated for one FIFO in
  73. state S1. Possible values are - 0, 4, 8, 16, 32, 64, 128,
  74. 256.
  75. - qcom,s2-sample-count: The number of samples to be accululated for one FIFO in
  76. state S2. Possible values are - 0, 4, 8, 16, 32, 64, 128,
  77. 256.
  78. - qcom,s1-fifo-legth: Number of FIFO's to be filled in state S1, to generate
  79. the fifo_update_done interrupt. Possile values - 0 to 8
  80. - qcom,s2-fifo-legth: Number of FIFO's to be filled in state S2, to generate
  81. the fifo_update_done interrupt. Possible values- 0 to 8
  82. - qcom,force-s3-on-suspend : Bool property to force the BMS into S3 (sleep) state
  83. while entering into system suspend.
  84. - qcom,force-bms-active-on-charger: Bool property to keep BMS FSM active
  85. if charger is present.
  86. - qcom,report-charger-eoc : Bool property to indicate if BMS needs to indicate
  87. EOC to charger.
  88. - qcom,ignore-shutdown-soc: A boolean that controls whether BMS will
  89. try to force the startup SoC to be the same as the
  90. shutdown SoC. Defining it will make BMS ignore the
  91. shutdown SoC.
  92. - qcom,use-voltage-soc : A boolean that controls whether BMS will use
  93. voltage-based SoC instead of a coulomb counter based
  94. one. Voltage-based SoC will not guarantee linearity.
  95. - qcom,disable-bms : Bool property to disable the VMBMS hardware module.
  96. Enable this property if BMS is not supported or an external
  97. fuel gauge is used.
  98. - qcom,s3-ocv-tolerence-uv : The S3 state OCV tolerence threshold in uV. The
  99. LSB value is 300uV and maximum value is 76500uV.
  100. - qcom,low-soc-fifo-length : The fifo length (of S2 STATE) to be used at lower
  101. SOCs. If this value is not specified the system uses
  102. default length.
  103. - qcom,resume-soc: Capacity in percent at which charging should resume
  104. when a fully charged battery drops below this level.
  105. - qcom,low-temp-threshold : The temperature threshold below which the IBAT
  106. averaging and UUC smoothening is disabled. This value
  107. is in deci-degrees centigrade. If not specified it
  108. defaults to 0.
  109. - qcom,ibat-avg-samples : The number of samples to be averaged for IBAT
  110. estimation. If not specified it defaults to 16.
  111. The possible values are 1 to 16.
  112. - qcom,batt-aging-comp : A boolean that defines if battery aging compensation
  113. is enabled.
  114. - qcom,use-reported-soc : Bool property to enable the reported_soc logic. To
  115. enable this feature, qcom,resume-soc must be defined as
  116. a proper value. The BMS is also required to control the
  117. charging, discharging and recharging.
  118. qcom,batt-pres-status node required properties:
  119. - reg : offset and length of the PMIC LBC battery interface BATT_PRES_STATUS
  120. register.
  121. qcom,qpnp-chg-pres required properties:
  122. - reg : offset and length of the PMIC LBC charger interafce CHARGER_OPTION
  123. register.
  124. Example:
  125. pm8916_bms: qcom,qpnp-vm-bms {
  126. spmi-dev-container;
  127. compatible = "qcom,qpnp-vm-bms";
  128. #address-cells = <1>;
  129. #size-cells = <1>;
  130. status = "disabled";
  131. qcom,v-cutoff-uv = <3400000>;
  132. qcom,max-voltage-uv = <4200000>;
  133. qcom,r-conn-mohm = <18>;
  134. qcom,shutdown-soc-valid-limit = <20>;
  135. qcom,low-soc-calculate-soc-threshold = <15>;
  136. qcom,low-voltage-threshold = <3420000>;
  137. qcom,low-voltage-calculate-soc-ms = <1000>;
  138. qcom,low-soc-calculate-soc-ms = <5000>;
  139. qcom,low-soc-fifo-length = <2>;
  140. qcom,calculate-soc-ms = <20000>;
  141. qcom,s3-ocv-tolerence-uv = <1200>;
  142. qcom,volatge-soc-timeout-ms = <60000>;
  143. qcom,battery-data = <&mtp_batterydata>;
  144. qcom,bms-vadc = <&pm8916_vadc>;
  145. qcom,bms-adc_tm = <&pm8916_adc_tm>;
  146. qcom,batt-pres-status@1208 {
  147. reg = <0x1208 0x1>;
  148. }
  149. qcom,qpnp-chg-pres@1208 {
  150. reg = <0x1108 0x1>;
  151. }
  152. qcom,bms-bms@4000 {
  153. reg = <0x4000 0x100>;
  154. interrupts = <0x0 0x40 0x0>,
  155. <0x0 0x40 0x1>,
  156. <0x0 0x40 0x2>,
  157. <0x0 0x40 0x3>,
  158. <0x0 0x40 0x4>,
  159. <0x0 0x40 0x5>,
  160. interrupt-names = "leave_cv",
  161. "enter_cv",
  162. "good_ocv",
  163. "ocv_thr",
  164. "fifo_updtaed",
  165. "fsm_state_change";
  166. };
  167. };