diff options
author | Tom Hughes <tomhughes@chromium.org> | 2021-10-25 17:59:54 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-11-03 23:00:04 +0000 |
commit | 19552a15af11e6a0d3fc1498aabf8338c8804b80 (patch) | |
tree | 481471fce5d00c7159cb3569b19157527352e218 /board | |
parent | dcc080eeeee889be594af9fb20a1344de5d2cbc7 (diff) | |
download | chrome-ec-19552a15af11e6a0d3fc1498aabf8338c8804b80.tar.gz |
board/woomax,board/morphius: Fix return type
clang warns:
board/morphius/board.c:406:8: error: implicit conversion from
enumeration type 'enum ioex_signal' to different enumeration type 'enum
gpio_signal'
[-Werror,-Wenum-conversion]
? IOEX_USB_C1_HPD_IN_DB
^~~~~~~~~~~~~~~~~~~~~
board/woomax/board.c:864:6: error: implicit conversion from enumeration
type 'enum ioex_signal' to different enumeration type 'enum gpio_signal'
[-Werror,-Wenum-conversion]
: IOEX_USB_C1_HPD_IN_DB;
^~~~~~~~~~~~~~~~~~~~~
The only caller appears to be svdm_set_hpd_gpio() and
svdm_get_hpd_gpio(), which correctly calls gpio_or_ioex_set_level()
since the signal may be either gpio_signal or ioex_signal. Rename the
board_usbc_port* function to indicate that it can return gpio or ioex.
BRANCH=none
BUG=b:172020503
TEST=make buildall
TEST=CC=clang make BOARD=woomax
TEST=CC=clang make BOARD=morphius
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: I7be75c8a714ba103362b293413aadc6a92ab72c3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3243008
Reviewed-by: Eric Yilun Lin <yllin@google.com>
Diffstat (limited to 'board')
-rw-r--r-- | board/morphius/board.c | 2 | ||||
-rw-r--r-- | board/morphius/board.h | 11 | ||||
-rw-r--r-- | board/woomax/board.c | 2 | ||||
-rw-r--r-- | board/woomax/board.h | 12 |
4 files changed, 19 insertions, 8 deletions
diff --git a/board/morphius/board.c b/board/morphius/board.c index 35988b6723..4680109e18 100644 --- a/board/morphius/board.c +++ b/board/morphius/board.c @@ -383,7 +383,7 @@ static void setup_v0_charger(void) */ DECLARE_HOOK(HOOK_INIT, setup_v0_charger, HOOK_PRIO_INIT_I2C); -enum gpio_signal board_usbc_port_to_hpd_gpio(int port) +int board_usbc_port_to_hpd_gpio_or_ioex(int port) { /* USB-C0 always uses USB_C0_HPD (= DP3_HPD). */ if (port == 0) diff --git a/board/morphius/board.h b/board/morphius/board.h index 603bcec69b..a38fd93fc1 100644 --- a/board/morphius/board.h +++ b/board/morphius/board.h @@ -209,8 +209,15 @@ static inline bool ec_config_has_mst_hub_rtd2141b(void) } void motion_interrupt(enum gpio_signal signal); -enum gpio_signal board_usbc_port_to_hpd_gpio(int port); -#define PORT_TO_HPD(port) board_usbc_port_to_hpd_gpio(port) + +/** + * @warning Callers must use gpio_or_ioex_set_level to handle the return result + * since either type of signal can be returned. + * + * @return GPIO (gpio_signal) or IOEX (ioex_signal) + */ +int board_usbc_port_to_hpd_gpio_or_ioex(int port); +#define PORT_TO_HPD(port) board_usbc_port_to_hpd_gpio_or_ioex(port) extern const struct usb_mux usbc0_pi3dpx1207_usb_retimer; extern const struct usb_mux usbc1_ps8802; diff --git a/board/woomax/board.c b/board/woomax/board.c index 106f21db59..f10bb227da 100644 --- a/board/woomax/board.c +++ b/board/woomax/board.c @@ -835,7 +835,7 @@ void hdmi_hpd_interrupt(enum gpio_signal signal) hook_call_deferred(&hdmi_hpd_handler_data, (2 * MSEC)); } -enum gpio_signal board_usbc_port_to_hpd_gpio(int port) +int board_usbc_port_to_hpd_gpio_or_ioex(int port) { /* USB-C0 always uses USB_C0_HPD */ if (port == 0) diff --git a/board/woomax/board.h b/board/woomax/board.h index d81c82f181..f5289f2bd1 100644 --- a/board/woomax/board.h +++ b/board/woomax/board.h @@ -194,15 +194,19 @@ static inline bool ec_config_has_mst_hub_rtd2141b(void) HAS_MST_HUB_RTD2141B); } -/* +/** + * @warning Callers must use gpio_or_ioex_set_level to handle the return result + * since either type of signal can be returned. + * * USB-C0 always uses USB_C0_HPD (= DP3_HPD). * USB-C1 OPT1 DB uses DP2_HPD. * USB-C1 OPT3 DB uses DP1_HPD via RTD2141B MST hub to drive AP * HPD, EC drives MST hub HPD input from USB-PD messages. + * + * @return GPIO (gpio_signal) or IOEX (ioex_signal) */ - -enum gpio_signal board_usbc_port_to_hpd_gpio(int port); -#define PORT_TO_HPD(port) board_usbc_port_to_hpd_gpio(port) +int board_usbc_port_to_hpd_gpio_or_ioex(int port); +#define PORT_TO_HPD(port) board_usbc_port_to_hpd_gpio_or_ioex(port) extern const struct usb_mux usbc0_pi3dpx1207_usb_retimer; extern const struct usb_mux usbc1_ps8802; |