OSDN Git Service

qcom: smb-lib: add delay for parallel enable
authorAshay Jaiswal <ashayj@codeaurora.org>
Tue, 21 Mar 2017 06:54:16 +0000 (12:24 +0530)
committerAshay Jaiswal <ashayj@codeaurora.org>
Wed, 5 Apr 2017 04:32:29 +0000 (10:02 +0530)
commitf521128115ac89264850f7a52fe42b62c052600d
tree23af1e627d2ee6f261c5d67ddf8ffc59f070969c
parent38939b5e92ae99b3544f24e275746ba27cd8ba98
qcom: smb-lib: add delay for parallel enable

Currently, the driver enables parallel charger as soon
as a favorable charger is seen. This causes many, unnecessary
splits of AICL results as AICL runs for the first time. Besides
the detection logic could further update charger type and rerun
AICL.

Its best to simply delay enabling parallel charger for 30 seconds.
This ensures that type detection and its AICL run to completion and
parallel charging starts with a stable AICL result.

To realize this
- implement a workqueue which will be scheduled/cancelled 30 seconds
  later when vbus plugin interrupt happens.
- The workqueue signifies that 30 seconds have elapsed and parallel
  charging should be enabled by PL_DELAY_VOTER.
- remove PL_DELAY_HDVP_VOTER since PL_DELAY_VOTER will
  ensure parallel gets enabled after 30 seconds of insertion.
- unvote from PL_DELAY_VOTER only when the typeC removal event happens.
  A PR_SWAP during a sink session will keep the PL_DELAY_VOTER's vote
  enabled, we expect CHG_STATE_VOTER to disable parallel since device will
  be supplying VBUS and not charging the battery. This also means that
  when another PR_SWAP happens and the device starts operating in sink mode
  again, PL_DELAY_VOTER's vote will remain enabled and parallel charging
  would begin when other conditions become favorable. IOW PL_DELAY_VOTER
  tracks 30 second after physical insertion and remains unaffected by
  PR_SWAPs.

CRs-Fixed: 2014572
Change-Id: Ibe10768e61c6d2661bc8946f7f6b9be06f0c28e6
Signed-off-by: Ashay Jaiswal <ashayj@codeaurora.org>
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
drivers/power/supply/qcom/qpnp-smb2.c
drivers/power/supply/qcom/smb-lib.c
drivers/power/supply/qcom/smb-lib.h