diff options
author | Alec Berg <alecaberg@chromium.org> | 2015-05-06 09:53:32 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-05-22 05:35:06 +0000 |
commit | 6fcd1c0481292b9df96f26bbb248248c697e2641 (patch) | |
tree | a470e921abfecad7c94bf0a3924365a066eeda36 /common/usb_pd_protocol.c | |
parent | 7c1231c55faa8880e6ec26e48d2cd342d280ee0f (diff) | |
download | chrome-ec-6fcd1c0481292b9df96f26bbb248248c697e2641.tar.gz |
pd: add config options for including TCPM and TCPC separately
Add config options for various parts of USB PD stack:
CONFIG_USB_POWER_DELIVERY: The use of this option has changed
slightly. It now represents whether or not to include the USB
PD protocol and policy layers of the software stack.
CONFIG_USB_PD_TCPC: Compile in type-C port controller module
which performs the phy layer of the PD stack.
CONFIG_USB_PD_TCPM_STUB and CONFIG_USB_PD_TCPM_TCPCI: If
CONFIG_USB_POWER_DELIVERY is defined, then one TCPM needs to
be defined to declare which port management module to use
to drive the TCPC.
BUG=none
BRANCH=none
TEST=make -j buildall
Change-Id: I41aa65a478e36925745cd37a6707f242c0dfbf91
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/270171
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common/usb_pd_protocol.c')
-rw-r--r-- | common/usb_pd_protocol.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index cbe4502b84..0bd0b6169a 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -1293,8 +1293,10 @@ void pd_task(void) /* Ensure the power supply is in the default state */ pd_power_supply_reset(port); +#ifdef CONFIG_USB_PD_TCPC /* Initialize port controller */ tcpc_init(port); +#endif /* Initialize PD protocol state variables for each port. */ pd[port].power_role = PD_ROLE_DEFAULT; @@ -1332,11 +1334,13 @@ void pd_task(void) /* wait for next event/packet or timeout expiration */ evt = task_wait_event(timeout); +#ifdef CONFIG_USB_PD_TCPC /* * run port controller task to check CC and/or read incoming * messages */ tcpc_run(port, evt); +#endif /* process any potential incoming message */ incoming_packet = evt & PD_EVENT_RX; @@ -1776,6 +1780,11 @@ void pd_task(void) } break; case PD_STATE_SUSPENDED: + /* + * TODO: Suspend state only supported if we are also + * the TCPC. + */ +#ifdef CONFIG_USB_PD_TCPC pd_rx_disable_monitoring(port); pd_hw_release(port); pd_power_supply_reset(port); @@ -1785,6 +1794,7 @@ void pd_task(void) task_wait_event(-1); pd_hw_init(port, PD_ROLE_DEFAULT); +#endif break; case PD_STATE_SNK_DISCONNECTED: timeout = 10*MSEC; |