summaryrefslogtreecommitdiff
path: root/zephyr/projects/corsola/src/usb_pd_policy.c
diff options
context:
space:
mode:
authorEric Yilun Lin <yllin@chromium.org>2022-02-18 16:33:33 +0800
committerCommit Bot <commit-bot@chromium.org>2022-02-24 09:43:54 +0000
commit5276c82511b7485aaa7acfbf21b752c31eb29643 (patch)
treeb0e9e84bed32c433ffcd0558c3303807b77c4688 /zephyr/projects/corsola/src/usb_pd_policy.c
parente374e796a6c97f8178faf0659acb358c9fe1b750 (diff)
downloadchrome-ec-5276c82511b7485aaa7acfbf21b752c31eb29643.tar.gz
corsola: support HDMI HPD over virtual mux and type-c DP
Initialize USB-C port num to 2 after tasks associated with port 1 exit, and we can safely simulate HDMI1 over C1 mux. Simulate HDMI HPD event over C1 virtual mux, and type-c DP. HPD high -> virtual mux set DP connected HPD low for 2 ms -> virtual mux set DP disconnected This CL saves 2 GPIOs to AP and re-use the existing ANX7625 driver without changing. BUG=b:216021294 TEST=1. plug hdmi, unplug HDMI, and virtual mux, and DP status can be updated accordingly. 2. See HDMI port output 3. ectool typec 0|1 BRANCH=none Change-Id: Icbf35523770a6eeda6ac970573738373ecdf849b Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3474551 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Eric Yilun Lin <yllin@google.com> Tested-by: Eric Yilun Lin <yllin@google.com> Auto-Submit: Eric Yilun Lin <yllin@google.com>
Diffstat (limited to 'zephyr/projects/corsola/src/usb_pd_policy.c')
-rw-r--r--zephyr/projects/corsola/src/usb_pd_policy.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/zephyr/projects/corsola/src/usb_pd_policy.c b/zephyr/projects/corsola/src/usb_pd_policy.c
index 88eb297694..790c830c17 100644
--- a/zephyr/projects/corsola/src/usb_pd_policy.c
+++ b/zephyr/projects/corsola/src/usb_pd_policy.c
@@ -11,6 +11,8 @@
#include "usb_pd.h"
#include "usbc_ppc.h"
+#include "baseboard_usbc_config.h"
+
#if CONFIG_USB_PD_3A_PORTS != 1
#error Corsola reference must have at least one 3.0 A port
#endif
@@ -39,15 +41,7 @@ void svdm_set_hpd_gpio(int port, int en)
gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(ec_ap_dp_hpd_odl), !en);
}
-/**
- * Is the port fine to be muxed its DisplayPort lines?
- *
- * Only one port can be muxed to DisplayPort at a time.
- *
- * @param port Port number of TCPC.
- * @return 1 is fine; 0 is bad as other port is already muxed;
- */
-static int is_dp_muxable(int port)
+int corsola_is_dp_muxable(int port)
{
int i;
@@ -72,7 +66,7 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
dp_status[port] = payload[1];
- if (!is_dp_muxable(port)) {
+ if (!corsola_is_dp_muxable(port)) {
/* TODO(waihong): Info user? */
CPRINTS("p%d: The other port is already muxed.", port);
return 0; /* nak */