diff options
author | Ruibin Chang <Ruibin.Chang@ite.com.tw> | 2019-11-15 10:06:54 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-11-18 04:24:16 +0000 |
commit | a885b202aae04c64c756468baf6185129c3802eb (patch) | |
tree | d36350d97c1888f3259de3b63db97157e2dc6781 /driver | |
parent | 5162094fe4be16ffc6255ac46102b536c2fbc96f (diff) | |
download | chrome-ec-a885b202aae04c64c756468baf6185129c3802eb.tar.gz |
driver/it83xx: Don't set cc when set message header power role
When driver's setting pd message header function is called
from TCPM, driver shouldn't set cc resistance. We should
follow the comment just setting header defined in set_msg_header.
The message header power role equal our cc resistance Rp/Rd
state in mostly case. But there is an exception, like
power role swap from SNK to SRC, there is a temporal transition
state that both port cc assert Rd and GoodCRC power role field
is swapped for response original SRC PS_RDY, so we shouldn't
assert cc in set_msg_header function.
[refer]: PD3.0 spec v2 ch8.3.2.6
BUG=none
BRANCH=none
TEST=connect to dongle, adapter, DRP on board ampton
1.Power role swap successfully
2.PD state to SRC_RDY or SNK_RDY
Change-Id: Ibad3d8fcfcaa382fef4c8ef8ed26e920c63730b5
Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1916759
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r-- | driver/tcpm/it83xx.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/driver/tcpm/it83xx.c b/driver/tcpm/it83xx.c index fd03426e33..14e7571dc6 100644 --- a/driver/tcpm/it83xx.c +++ b/driver/tcpm/it83xx.c @@ -525,7 +525,14 @@ static int it83xx_tcpm_set_vconn(int port, int enable) static int it83xx_tcpm_set_msg_header(int port, int power_role, int data_role) { - it83xx_set_power_role(port, power_role); + /* PD_ROLE_SINK 0, PD_ROLE_SOURCE 1 */ + if (power_role == PD_ROLE_SOURCE) + /* bit0: source */ + SET_MASK(IT83XX_USBPD_PDMSR(port), BIT(0)); + else + /* bit0: sink */ + CLEAR_MASK(IT83XX_USBPD_PDMSR(port), BIT(0)); + it83xx_set_data_role(port, data_role); return EC_SUCCESS; |