summaryrefslogtreecommitdiff
path: root/fuzz
diff options
context:
space:
mode:
authorSam Hurst <shurst@google.com>2019-11-07 17:55:55 -0800
committerCommit Bot <commit-bot@chromium.org>2019-11-21 23:41:16 +0000
commit2e2dcb986bfe952cd9a87bf2cd3498fafde6e805 (patch)
tree2d63c1ceb0ab7bad0f2e414b73243307dff87676 /fuzz
parent154f597b8656fbcc16f6652f6fe8713943440939 (diff)
downloadchrome-ec-2e2dcb986bfe952cd9a87bf2cd3498fafde6e805.tar.gz
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 <shurst@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1904974 Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'fuzz')
-rw-r--r--fuzz/usb_pd_fuzz.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fuzz/usb_pd_fuzz.c b/fuzz/usb_pd_fuzz.c
index eeb72586b4..1d44921817 100644
--- a/fuzz/usb_pd_fuzz.c
+++ b/fuzz/usb_pd_fuzz.c
@@ -45,6 +45,11 @@ static int mock_tcpci_get_chip_info(int port, int live,
return EC_ERROR_UNIMPLEMENTED;
}
+static __maybe_unused int mock_enter_low_power_mode(int port)
+{
+ return EC_SUCCESS;
+}
+
#define MAX_TCPC_PAYLOAD 28
struct message {
@@ -130,6 +135,9 @@ static const struct tcpm_drv mock_tcpm_drv = {
.transmit = &mock_tcpm_transmit,
.tcpc_alert = &mock_tcpc_alert,
.get_chip_info = &mock_tcpci_get_chip_info,
+#ifdef CONFIG_USB_PD_TCPC_LOW_POWER
+ .enter_low_power_mode = &mock_enter_low_power_mode,
+#endif
};
/* TCPC mux configuration */