summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2018-10-25 15:11:56 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2019-01-02 21:09:39 +0000
commitd84125b6a8d4686236a0d748fc7de9361d6adaa4 (patch)
treee44745f0e3efa58855c716995033b89726f5010e
parent45ecc26ab682bb89ebe23ac4f65470b2be7c8a85 (diff)
downloadchrome-ec-d84125b6a8d4686236a0d748fc7de9361d6adaa4.tar.gz
USB-PD: Fix build errors for non-DRP
This patch fixes build errors for devices which don't use DRP ports. pd_restart_tcpc is called within DRP context. So, the static definition has to be excluded accordingly. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG= BRANCH=none TEST=buildall Change-Id: I51decb0a2071230da3cdd91139f77d94b685ca5f Reviewed-on: https://chromium-review.googlesource.com/1300616 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/1392423 Commit-Queue: Jett Rink <jettrink@chromium.org> Tested-by: Jett Rink <jettrink@chromium.org> Trybot-Ready: Jett Rink <jettrink@chromium.org>
-rw-r--r--common/usb_pd_protocol.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index ff8f5610cd..91a7f40503 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -2159,7 +2159,7 @@ static void pd_update_try_source(void)
}
DECLARE_HOOK(HOOK_BATTERY_SOC_CHANGE, pd_update_try_source, HOOK_PRIO_DEFAULT);
-#endif
+#endif /* CONFIG_USB_PD_TRY_SRC */
static inline void pd_set_dual_role_no_wakeup(int port,
enum pd_dual_role_states state)
@@ -2487,7 +2487,7 @@ static void pd_init_tasks(void)
}
#endif /* CONFIG_COMMON_RUNTIME */
-#ifndef CONFIG_USB_PD_TCPC
+#if !defined(CONFIG_USB_PD_TCPC) && defined(CONFIG_USB_PD_DUAL_ROLE)
static int pd_restart_tcpc(int port)
{
if (board_set_tcpc_power_mode) {
@@ -4665,6 +4665,7 @@ DECLARE_HOST_COMMAND(EC_CMD_USB_PD_PORTS,
hc_pd_ports,
EC_VER_MASK(0));
+#ifdef CONFIG_USB_PD_DUAL_ROLE
static const enum pd_dual_role_states dual_role_map[USB_PD_CTRL_ROLE_COUNT] = {
[USB_PD_CTRL_ROLE_TOGGLE_ON] = PD_DRP_TOGGLE_ON,
[USB_PD_CTRL_ROLE_TOGGLE_OFF] = PD_DRP_TOGGLE_OFF,
@@ -4672,6 +4673,7 @@ static const enum pd_dual_role_states dual_role_map[USB_PD_CTRL_ROLE_COUNT] = {
[USB_PD_CTRL_ROLE_FORCE_SOURCE] = PD_DRP_FORCE_SOURCE,
[USB_PD_CTRL_ROLE_FREEZE] = PD_DRP_FREEZE,
};
+#endif
#ifdef CONFIG_USBC_SS_MUX
static const enum typec_mux typec_mux_map[USB_PD_CTRL_MUX_COUNT] = {
@@ -4697,7 +4699,11 @@ static int hc_usb_pd_control(struct host_cmd_handler_args *args)
return EC_RES_INVALID_PARAM;
if (p->role != USB_PD_CTRL_ROLE_NO_CHANGE)
+#ifdef CONFIG_USB_PD_DUAL_ROLE
pd_set_dual_role(p->port, dual_role_map[p->role]);
+#else
+ return EC_RES_INVALID_PARAM;
+#endif
#ifdef CONFIG_USBC_SS_MUX
if (p->mux != USB_PD_CTRL_MUX_NO_CHANGE)