summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatryk Duda <pdk@semihalf.com>2020-03-26 19:15:34 +0100
committerCommit Bot <commit-bot@chromium.org>2020-04-01 20:25:59 +0000
commite1b0e96927b44a4816bab3d95114ef76bb864271 (patch)
tree33c4801fb5f2020417f6d28850fd0702f59053be
parentb0140e5e14a971820cce4cfe2e8eabdd2f5f79d6 (diff)
downloadchrome-ec-e1b0e96927b44a4816bab3d95114ef76bb864271.tar.gz
TCPMv2: Set dual-role state basing on chipset state
Set DRP state during TCPMv2 initialization, basing on current chipset state. This was found when running master branch on nocturne. When EC jumps from RO to RW and chipset state is S0 already, then it is expected that DRP state is PD_DRP_TOGGLE_ON but actually the state is PD_DRP_TOGGLE_OFF. DRP state is changed only during chipset power state change, so it was necessary to shutdown and power on chromebook in order to get USB-C devices working. BUG=b:151301058 BRANCH=none TEST= Run ChromeOS Plug some USB-C device and make sure device is working Reboot EC from EC console (EC should start from RO image) Run board Check if USB-C device is working. Do not replug it or reboot board Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: If83a463aabf8ee6493ba3dba44ad8829539c90cc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2124647 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--common/usbc/usb_tc_drp_acc_trysrc_sm.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
index 166815cd6c..c18eff6219 100644
--- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c
+++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -1039,6 +1039,14 @@ void tc_state_init(int port)
* can disable PD by policy later.
*/
tc_policy_pd_enable(port, 1);
+
+ /* Set dual-role state based on chipset power state */
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF))
+ pd_set_dual_role_no_wakeup(port, PD_DRP_FORCE_SINK);
+ else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND))
+ pd_set_dual_role_no_wakeup(port, PD_DRP_TOGGLE_OFF);
+ else /* CHIPSET_STATE_ON */
+ pd_set_dual_role_no_wakeup(port, PD_DRP_TOGGLE_ON);
}
enum pd_cable_plug tc_get_cable_plug(int port)