diff options
author | Boris Mittelberg <bmbm@google.com> | 2022-11-17 16:03:12 -0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-11-19 02:12:00 +0000 |
commit | 92ee12965a30e88904ee1e72642ea370b32d784c (patch) | |
tree | 7599ffc524c602425d77a079191a84e87bdff15d | |
parent | c1642270ed023a462223e93d1a9b3f953182b6d5 (diff) | |
download | chrome-ec-92ee12965a30e88904ee1e72642ea370b32d784c.tar.gz |
pompom: dead code elimination
Pompom has only one type-c port, remove the unnecessary loops.
BUG=b:64477774
BRANCH=none
TEST=make BOARD=pompom
Signed-off-by: Boris Mittelberg <bmbm@google.com>
Change-Id: I3a9197ecd6f66d591b20baf10231db226ad4dad4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4035430
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Reviewed-by: Wai-Hong Tam <waihong@google.com>
-rw-r--r-- | board/pompom/board.c | 43 | ||||
-rw-r--r-- | board/pompom/board.h | 1 |
2 files changed, 13 insertions, 31 deletions
diff --git a/board/pompom/board.c b/board/pompom/board.c index b46e347f88..2f1de29013 100644 --- a/board/pompom/board.c +++ b/board/pompom/board.c @@ -269,8 +269,6 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); void board_hibernate(void) { - int i; - /* * Sensors are unpowered in hibernate. Apply PD to the * interrupt lines such that they don't float. @@ -290,8 +288,7 @@ void board_hibernate(void) * otherwise, ACOK won't go High and can't wake EC up. Check the * bug b/170324206 for details. */ - for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) - ppc_vbus_sink_enable(i, 1); + ppc_vbus_sink_enable(USB_PD_PORT_C0, 1); } __override uint16_t board_get_ps8xxx_product_id(int port) @@ -323,9 +320,9 @@ void board_tcpc_init(void) * Initialize HPD to low; after sysjump SOC needs to see * HPD pulse to enable video path */ - for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port) - usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED | - USB_PD_MUX_HPD_IRQ_DEASSERTED); + usb_mux_hpd_update(USB_PD_PORT_C0, + USB_PD_MUX_HPD_LVL_DEASSERTED | + USB_PD_MUX_HPD_IRQ_DEASSERTED); } DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1); @@ -405,24 +402,20 @@ void board_overcurrent_event(int port, int is_overcurrented) int board_set_active_charge_port(int port) { - int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT); - int i; + int is_real_port = (port == USB_PD_PORT_C0); if (!is_real_port && port != CHARGE_PORT_NONE) return EC_ERROR_INVAL; if (port == CHARGE_PORT_NONE) { CPRINTS("Disabling all charging port"); - - /* Disable all ports. */ - for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) { - /* - * Do not return early if one fails otherwise we can - * get into a boot loop assertion failure. - */ - if (board_vbus_sink_enable(i, 0)) - CPRINTS("Disabling p%d sink path failed.", i); - } + /* + * Do not return early if one fails otherwise we can + * get into a boot loop assertion failure. + */ + if (board_vbus_sink_enable(USB_PD_PORT_C0, 0)) + CPRINTS("Disabling p%d sink path failed.", + USB_PD_PORT_C0); return EC_SUCCESS; } @@ -435,18 +428,6 @@ int board_set_active_charge_port(int port) CPRINTS("New charge port: p%d", port); - /* - * Turn off the other ports' sink path FETs, before enabling the - * requested charge port. - */ - for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) { - if (i == port) - continue; - - if (board_vbus_sink_enable(i, 0)) - CPRINTS("p%d: sink path disable failed.", i); - } - /* Enable requested charge port. */ if (board_vbus_sink_enable(port, 1)) { CPRINTS("p%d: sink path enable failed.", port); diff --git a/board/pompom/board.h b/board/pompom/board.h index 1282ecdb41..774b339273 100644 --- a/board/pompom/board.h +++ b/board/pompom/board.h @@ -32,6 +32,7 @@ #define CONFIG_USB_PD_TCPM_PS8805 #define CONFIG_USBC_PPC_SN5S330 #define CONFIG_USB_PD_PORT_MAX_COUNT 1 +#define USB_PD_PORT_C0 0 /* USB-A */ #define USB_PORT_COUNT 1 |