From 2e2dcb986bfe952cd9a87bf2cd3498fafde6e805 Mon Sep 17 00:00:00 2001 From: Sam Hurst Date: Thu, 7 Nov 2019 17:55:55 -0800 Subject: TCPMv2: Enable TCPC low power when port is looking for a connection When the port is in a state where it is looking for a connection, to save power, we should put the TCPC in its low power mode and enable auto toggling. Low power mode can happen when DRP auto toggling, acting as a SNK only, or acting as a SRC only. BUG=chromium:1022217 BRANCH=none TEST=make -j buildall manual tests: 1: (S0) Nothing plugged in, port is drp and low power mode 2: (S5/S3/S0ix) Port is SNK only, and low power with nothing plugged in 3: (S3/S0ix) If TypeC sink was previously plugged in, port remains powered 4: (S5/S3/S0ix) TypeC source is recognized 5: (S3->S0) TypeC sink plugged in, port is powered when S0 is reached Low power exit test: Using this command from the AP console: ectool i2cread 8 2 0x16 0x0d Transfer failed with status=0x1 # This means the TCPC was asleep. On the EC console: 2019-11-21 09:50:24 [315.235538 TCPC p1 init ready] 2019-11-21 09:50:24 [315.236048 TCPC p1 Exit Low Power Mode] 2019-11-21 09:50:24 [315.242837 TCPC p1 init ready] 2019-11-21 09:50:24 [315.243229 C1: DRPAutoToggle] 2019-11-21 09:50:24 [315.246471 C1: Unattached.SNK] 2019-11-21 09:50:24 [315.252504 C1: DRPAutoToggle] 2019-11-21 09:50:24 [315.362878 C1: LowPowerMode] 2019-11-21 09:50:24 [315.363314 TCPC p1 Enter Low Power Mode] Change-Id: I7e853d05e0ece1f6b3031f17a18fcbf0d9a15a51 Signed-off-by: Sam Hurst Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1904974 Reviewed-by: Edward Hill Reviewed-by: Jett Rink --- test/usb_typec_drp_acc_trysrc.c | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/usb_typec_drp_acc_trysrc.c b/test/usb_typec_drp_acc_trysrc.c index 07496ca600..205ef6ad3a 100644 --- a/test/usb_typec_drp_acc_trysrc.c +++ b/test/usb_typec_drp_acc_trysrc.c @@ -40,6 +40,7 @@ __maybe_unused static int test_mux_con_dis_as_src(void) mock_tcpc.cc1 = TYPEC_CC_VOLT_RD; mock_tcpc.cc2 = TYPEC_CC_VOLT_OPEN; task_set_event(TASK_ID_PD_C0, PD_EVENT_CC, 0); + pd_set_dual_role(0, PD_DRP_TOGGLE_ON); /* This wait trainsitions through AttachWait.SRC then Attached.SRC */ task_wait_event(SECOND); -- cgit v1.2.1