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>