From efe0fbc416966340abae6539df8b2ab5a7e5a219 Mon Sep 17 00:00:00 2001 From: lschyi Date: Mon, 15 May 2023 15:37:12 +0800 Subject: corsola: Fix reported USB-C ports for no DB design with DB detection on The definition of `CORSOLA_DB_NONE` was settled to no DB in the project in the previous CL "corsola: Update implementation for no daughter board ", and the USB-C counts is determined by dts settings in previous CL " corosla: Improve USB-C port configuration". This introduces a reported port number mismatch when the DB detection is enabled, and the desired detection result is no DB in the design. Extend the DB status enum with `CORSOLA_DB_NO_DETECTION` to properly describe the different DB status, and fix the reported USB-C port logic. BUG=b:282625153 TEST=`zmake build --clobber` Change-Id: Idd55381759677272e0bfc7b270647d759642ce01 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4530326 Reviewed-by: Ting Shen Tested-by: Sung-Chi Li Commit-Queue: Sung-Chi Li --- zephyr/program/corsola/src/usbc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'zephyr/program/corsola/src/usbc.c') diff --git a/zephyr/program/corsola/src/usbc.c b/zephyr/program/corsola/src/usbc.c index 71c02ff54f..871c84a2e4 100644 --- a/zephyr/program/corsola/src/usbc.c +++ b/zephyr/program/corsola/src/usbc.c @@ -45,7 +45,7 @@ DECLARE_HOOK(HOOK_INIT, baseboard_init, HOOK_PRIO_PRE_DEFAULT); __override uint8_t board_get_usb_pd_port_count(void) { - /* This function returns the PORT_COUNT+1 when HDMI db is connected. + /* This function returns the PORT_COUNT when HDMI db is connected. * This is a trick to ensure the usb_mux_set being set properley. * HDMI display functions using the USB virtual mux to * communicate * with the DP bridge. @@ -56,6 +56,8 @@ __override uint8_t board_get_usb_pd_port_count(void) } else { return CONFIG_USB_PD_PORT_MAX_COUNT - 1; } + } else if (corsola_get_db_type() == CORSOLA_DB_NONE) { + return CONFIG_USB_PD_PORT_MAX_COUNT - 1; } return CONFIG_USB_PD_PORT_MAX_COUNT; @@ -65,7 +67,7 @@ uint8_t board_get_adjusted_usb_pd_port_count(void) { const enum corsola_db_type db = corsola_get_db_type(); - if (db == CORSOLA_DB_TYPEC || db == CORSOLA_DB_NONE) { + if (db == CORSOLA_DB_TYPEC || db == CORSOLA_DB_NO_DETECTION) { return CONFIG_USB_PD_PORT_MAX_COUNT; } else { return CONFIG_USB_PD_PORT_MAX_COUNT - 1; -- cgit v1.2.1