diff options
author | Abe Levkoy <alevkoy@chromium.org> | 2020-10-15 10:52:50 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-10-22 19:38:09 +0000 |
commit | e1728abb335acf11e2c9512ae88181a770935850 (patch) | |
tree | 75e3d109394193178e2552bf41f0492d44f5db01 /include | |
parent | 67645100a8dd165840c65f4bb73343ec1e53300f (diff) | |
download | chrome-ec-e1728abb335acf11e2c9512ae88181a770935850.tar.gz |
TCPMv2: Add typeccontrol enter-mode subcommand
Define and implement TYPEC_CONTROL_COMMAND_ENTER_MODE. Allow DPM state
to be accessed asynchronously by host commands. Add support for this
command to ectool.
BUG=b:168030639
TEST=Attach DP dongle; discovers but does not enter
TEST=ectool typeccontrol 1 2 0; enters DP
TEST=Attach TBT dock and TBT active cable; discovers but does not enter
TEST=ectool typeccontrol 1 2 1; enters TBT
BRANCH=none
Change-Id: I218c4b9a92004ef1efe9a27b2a920031961b33f3
Signed-off-by: Abe Levkoy <alevkoy@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2454538
Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/config.h | 6 | ||||
-rw-r--r-- | include/ec_commands.h | 9 | ||||
-rw-r--r-- | include/usb_pd.h | 12 | ||||
-rw-r--r-- | include/usb_pd_dpm.h | 3 |
4 files changed, 30 insertions, 0 deletions
diff --git a/include/config.h b/include/config.h index 8966f0e0e8..4c3ec5289e 100644 --- a/include/config.h +++ b/include/config.h @@ -3905,6 +3905,12 @@ /* Support for USB PD alternate mode of Downward Facing Port */ #undef CONFIG_USB_PD_ALT_MODE_DFP +/* + * Do not enter USB PD alternate modes or USB4 automatically. Wait for the AP to + * direct the EC to enter a mode. This requires AP software support. + */ +#undef CONFIG_USB_PD_REQUIRE_AP_MODE_ENTRY + /* HPD is sent to the GPU from the EC via a GPIO */ #undef CONFIG_USB_PD_DP_HPD_GPIO diff --git a/include/ec_commands.h b/include/ec_commands.h index 226571b005..c378847904 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -6371,6 +6371,14 @@ struct ec_response_typec_discovery { enum typec_control_command { TYPEC_CONTROL_COMMAND_EXIT_MODES, TYPEC_CONTROL_COMMAND_CLEAR_EVENTS, + TYPEC_CONTROL_COMMAND_ENTER_MODE, +}; + +/* Modes (USB or alternate) that a type-C port may enter. */ +enum typec_mode { + TYPEC_MODE_DP, + TYPEC_MODE_TBT, + TYPEC_MODE_USB4, }; struct ec_params_typec_control { @@ -6385,6 +6393,7 @@ struct ec_params_typec_control { */ union { uint32_t clear_events_mask; + uint8_t mode_to_enter; /* enum typec_mode */ uint8_t placeholder[128]; }; } __ec_align1; diff --git a/include/usb_pd.h b/include/usb_pd.h index df5f785135..6c9de3307e 100644 --- a/include/usb_pd.h +++ b/include/usb_pd.h @@ -2609,6 +2609,18 @@ uint32_t pd_get_events(int port); */ void pd_clear_events(int port, uint32_t clear_mask); +/* + * Requests that the port enter the specified mode. A successful result just + * means that the request was received, not that the mode has been entered yet. + * + * @param port USB-C port number + * @param mode The mode to enter + * @return EC_RES_SUCCESS if the request was made + * EC_RES_INVALID_PARAM for an invalid port or mode; + * EC_RES_BUSY if another mode entry request is already in progress + */ +enum ec_status pd_request_enter_mode(int port, enum typec_mode mode); + /** * Get port partner data swap capable status * diff --git a/include/usb_pd_dpm.h b/include/usb_pd_dpm.h index d1c029bc03..ccc7c57ff7 100644 --- a/include/usb_pd_dpm.h +++ b/include/usb_pd_dpm.h @@ -11,6 +11,9 @@ #ifndef __CROS_EC_USB_DPM_H #define __CROS_EC_USB_DPM_H +#include "ec_commands.h" +#include "usb_pd_tcpm.h" + /* * Initializes DPM state for a port. * |