power: smb5: update USB source detection sequence

Currently, USB/TypeC source detection takes place in the following
order: APSD runs first for BC 1.2 and HVDCP2, followed by PD; if PD
fails, APSD is rerun for HVDCP3 authentication. However, this has a
big shortcoming, APSD rerun needs to be carefully designed to
avoid PD conflicts, which increases code complexity, and makes it
hard to maintain and add new changes.

To simplify, a new APSD/PD flow is introduced to replace it: go PD
first, followed by APSD rerun for BC1.2, HVDCP2 and then HVDCP3.

For PD, if USB cable is plugged at boot up, run PD irrespective of
cable type (legacy or regular), otherwise, skip PD in case of legacy
cable detected.

Change-Id: I2816a88c32e57bb167d9d325db306602fb4f0b64
Signed-off-by: Harry Yang <harryy@codeaurora.org>
4 files changed