power: qpnp-smbcharger: allow icl to recover during parallel charging
Currently, if the charger gets a lower AICL setting due to a temporary
glitch or dip in the amount of current provided by the charging source,
the parallel charger can never recover the original AICL setting. This
is because the primary charger caps the input current limit to half of
the original AICL result for both the parallel charger and the primary
charger. Subsequent runs of AICL during parallel charging can never
exceed the original ICL setpoint because AICL can never be higher than
the configured ICL.
Fix this by setting the primary charger to (targeted ICL - parallel ICL).
This way, if the AICL is reran, either through the hardware feature or
through software, any extra available current can be recovered by the
algorithm to be rebalanced again.
This change can cause the AICL to collapse multiple times after enabling
parallel charging, so also change the algorithm to make sure the AICL is
settled before changing parallel charging. More specifically, when the
algorithm needs to change parallel charging settings, it will take two
AICL samples with 500ms between each sample. It will wait until
these two samples match before making any changes.
Furthermore, since the AICL is now more stable, we can remove the 100mA
decrements to the parallel charging current, and allow it to go to the
requested amount immediately.
Finally, remove the AICL rerun at the end of smbchg_parallel_usb_enable()
since AICL results can no longer be higher than the input current limit
anyways.
CRs-Fixed: 920791
Change-Id: I93e9f926b6f5ed520e4d6c2495087df25debf29d
Signed-off-by:
Xiaozhe Shi <xiaozhes@codeaurora.org>
Loading
Please register or sign in to comment