From 9afcd8d602e3db10992866cbd52a303fbd77cc4b Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Tue, 23 Jan 2018 10:08:53 -0800 Subject: [PATCH] cleanup: Remove CONFIG_USB_PD_TCPC_BOARD_INIT It's no longer necessary to call board_tcpc_init() from PD tasks, since HOOK_INIT completion is guaranteed before the task starts. Also, calling board_tcpc_init() for each PD task without a port arg is a bad idea. BUG=b:72229154 BRANCH=none TEST=`make buildall -j` Change-Id: I6fba07771693b8343568041960a263e02775a8fc Signed-off-by: Shawn Nematbakhsh Reviewed-on: https://chromium-review.googlesource.com/881538 Commit-Ready: Shawn N Tested-by: Shawn N Reviewed-by: Daisuke Nojiri Reviewed-by: Edward Hill --- board/coral/board.c | 3 ++- board/coral/board.h | 1 - board/grunt/board.h | 1 - common/usb_pd_protocol.c | 5 ----- include/config.h | 3 --- 5 files changed, 2 insertions(+), 11 deletions(-) diff --git a/board/coral/board.c b/board/coral/board.c index 7a36855c5c..1b0a8044c3 100644 --- a/board/coral/board.c +++ b/board/coral/board.c @@ -362,7 +362,7 @@ void board_reset_pd_mcu(void) board_set_tcpc_power_mode(USB_PD_PORT_ANX74XX, 1); } -void board_tcpc_init(void) +static void board_tcpc_init(void) { int port, reg; int count = 0; @@ -411,6 +411,7 @@ void board_tcpc_init(void) mux->hpd_update(port, 0, 0); } } +DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_DEFAULT); /* * Data derived from Seinhart-Hart equation in a resistor divider circuit with diff --git a/board/coral/board.h b/board/coral/board.h index b73770f6dc..121ff1a0a0 100644 --- a/board/coral/board.h +++ b/board/coral/board.h @@ -321,7 +321,6 @@ void board_reset_pd_mcu(void); int board_get_version(void); void board_set_tcpc_power_mode(int port, int mode); -void board_tcpc_init(void); /* Sensors without hardware FIFO are in forced mode */ #define CONFIG_ACCEL_FORCE_MODE_MASK (1 << LID_ACCEL) diff --git a/board/grunt/board.h b/board/grunt/board.h index 6b4d7ef935..bfa7fe88e7 100644 --- a/board/grunt/board.h +++ b/board/grunt/board.h @@ -195,7 +195,6 @@ enum sensor_id { #define CONFIG_ACCEL_FORCE_MODE_MASK (1 << LID_ACCEL) void board_reset_pd_mcu(void); -void board_tcpc_init(void); #endif /* !__ASSEMBLER__ */ diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 9aec67cbb6..78578aaf9f 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -2042,11 +2042,6 @@ void pd_task(void *u) /* Ensure the power supply is in the default state */ pd_power_supply_reset(port); -#ifdef CONFIG_USB_PD_TCPC_BOARD_INIT - /* Board specific TCPC init */ - board_tcpc_init(); -#endif - /* Initialize TCPM driver and wait for TCPC to be ready */ res = tcpm_init(port); diff --git a/include/config.h b/include/config.h index a2a27c3aa6..4b2364f7e7 100644 --- a/include/config.h +++ b/include/config.h @@ -2718,9 +2718,6 @@ /* Use TCPC module (type-C port controller) */ #undef CONFIG_USB_PD_TCPC -/* Board provides specific TCPC init function */ -#undef CONFIG_USB_PD_TCPC_BOARD_INIT - /* Enable TCPC to enter low power mode */ #undef CONFIG_USB_PD_TCPC_LOW_POWER