Since ErrorRecovery handling requires a spoof disconnect, the
charger driver needs to avoid immediately reapplying the
terminations. Re-use the PROP_PR_SWAP property which ignores
the disconnect. After the 25ms delay, policy engine will
explicitly reset back to DRP.
Also remove the transition to ErrorRecovery from PE_SNK_DISCOVERY
as it is removed in V1.3 of the PD 2.0 specification.
Change-Id: I41f1da293208b6813dfb540a123ee84ac35b4a68
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Move setting of PD_IN_HARD_RESET to the phy_sig_received()
callback in order to inform the charger to ignore the upcoming
VBUS toggle as soon as possible. This will help decrease the
possibility of racing to set the appropriate HW bits while
VBUS turns off and leads to the charger indicating disconnect.
Change-Id: I42cc2969defa48c9987fa4bea64780866861d868
Signed-off-by: Jack Pham <jackp@codeaurora.org>
During hard reset inform charger driver to suspend current draw
as the sink should not draw more than 1mA while VBUS is driven
to VSafe0V. Once VBUS returns to VSafe5V the current draw can be
restored when contract is re-established.
Change-Id: I3f529c861706d4544f3c8b65d6fc6be47a598309
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Charger driver needs to know when PR Swap is happening in
order to avoid resetting state when the disconnect (which
is expected) occurs. Utilize the new power supply PR_SWAP
property to notify whenever PD is in PR Swap.
Change-Id: I13fdbd4a3cf3e0716d48d1268795189f6b064598
Signed-off-by: Jack Pham <jackp@codeaurora.org>
In the callback to change the usb icl, the current code waits to
rerun AICL. These waits were to ensure that AICL completes and we
can restore parallel charger once done.
However, these waits are unnecessary since we invoke code to
enable USBIN_I_VOTER for parallel charger in a workqueue. Moreover,
these wait causes compliance failures. Remove those waits.
Change-Id: Id2e3ca87e111aa415c47683a2cc365a9bece7ffb
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
During a power_role swap, the CC lines get disconnected for a bit.
This causes the charger driver to prematurely declare a disconnection
and it resets back to disconnected state.
Update the code to distinguish a disconnect caused during PR_SWAP vs
a real disconnect.
Avoid
- resetting the CC line to HW control
- switching DRP mode
- enabling the crude sensor workaround
- enabling APSD
during a discconnet caused by PR_SWAP
Note that PR_SWAP setting/unsetting needs to done regardless of the
connected state of the CC line. When PR_SWAP is notified to be
completed and the CC lines are still seen disconnected call the real
disconnect code.
While at it Vconn can be disabled too in the real disconnect code path.
Change-Id: I97ab7ee343c5b2bcf25797e6acbb1de37f5ba00a
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Introduce POWER_SUPPLY_PROP_PR_SWAP to notify if the device is in
power role swap.
Change-Id: I8d0cb3a71ec1a646b7ec37405e66cb00ddc40e0d
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
The driver could leave SDP's current draw to a higher value
once its removed. This is because the code to reset the
current limit needs the type to be SDP to reset it which is
not going to be the case after removal.
So reset SDPs current limit back to 100mA in the code path
for non-SDP chargers.
Change-Id: Idfb9df1b72a17f1db63265b85f6546cbb77c4018
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>