summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Sanders <nsanders@chromium.org>2019-04-04 15:15:25 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-04-10 18:06:43 -0700
commitbeee9cedb0f9458154cbf0f98987df05637d746c (patch)
tree5b48a5232c57ba5403c41da353fb008a70e015e9
parent876c121bb25b592aaed93f9f0efae377b8f193c8 (diff)
downloadchrome-ec-beee9cedb0f9458154cbf0f98987df05637d746c.tar.gz
servo_v4: disable PD entirely when in SNK.
This prevents the system from negotiating power or reenabling dualrole after it's turned off in board.c. BUG=b:129882930 BRANCH=servo TEST=cc snkdts stays snk. Change-Id: I0a05eb9e8073cec7da884e071e023bcddadb130f Signed-off-by: Nick Sanders <nsanders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1553308 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
-rw-r--r--board/servo_v4/usb_pd_policy.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/board/servo_v4/usb_pd_policy.c b/board/servo_v4/usb_pd_policy.c
index f874e4dbe9..cb3332a017 100644
--- a/board/servo_v4/usb_pd_policy.c
+++ b/board/servo_v4/usb_pd_policy.c
@@ -660,6 +660,8 @@ static void print_cc_mode(void)
static void do_cc(int disable_dts_new, int allow_src_new)
{
+ int dualrole;
+
if ((disable_dts_new != disable_dts_mode) ||
(allow_src_new != allow_src_mode)) {
/* Force detach */
@@ -667,7 +669,9 @@ static void do_cc(int disable_dts_new, int allow_src_new)
/* Always set to 0 here so both CC lines are changed */
disable_dts_mode = 0;
allow_src_mode = 0;
+
/* Remove Rp/Rd on both CC lines */
+ pd_comm_enable(DUT, 0);
pd_set_rp_rd(DUT, TYPEC_CC_RP, TYPEC_RP_RESERVED);
/* Some time for DUT to detach, use tErrorRecovery */
@@ -676,14 +680,15 @@ static void do_cc(int disable_dts_new, int allow_src_new)
/* Accept new dts/src value */
disable_dts_mode = disable_dts_new;
allow_src_mode = allow_src_new;
+
/* Can we charge? */
- pd_set_dual_role(DUT,
- allow_src_mode && charge_port_is_active() ?
+ dualrole = allow_src_mode && charge_port_is_active();
+ pd_set_dual_role(DUT, dualrole ?
PD_DRP_FORCE_SOURCE : PD_DRP_FORCE_SINK);
/* Present Rp or Rd on CC1 and CC2 based on disable_dts_mode */
- pd_config_init(DUT,
- pd_get_dual_role(DUT) == PD_DRP_FORCE_SOURCE);
+ pd_config_init(DUT, dualrole);
+ pd_comm_enable(DUT, dualrole);
}
print_cc_mode();