diff options
author | Aseda Aboagye <aaboagye@google.com> | 2019-07-02 11:11:37 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-08-19 17:44:13 +0000 |
commit | 2b2d1558f37b1d2bdb55198220d359988a6b4b60 (patch) | |
tree | fa81594d2938c82470e314e27a72ceb0dbe535f6 | |
parent | 7c79b06f23308a6843fd20d87b4fdece9d229eb9 (diff) | |
download | chrome-ec-2b2d1558f37b1d2bdb55198220d359988a6b4b60.tar.gz |
pd_policy: Change DP AltMode event from host event to MKBP.
Previously, the EC could notify the AP that it had entered into
DisplayPort Alternate mode by sending a MODE_CHANGE host event.
However, there was no mechanism to disable that functionality if desired
without effecting the other MODE_CHANGE events (i.e. - base
attach/detach). By changing the DisplayPort Alternate mode entry to an
MKBP event, we can have more granularity and only affect this single
event.
- This commit adds a new MKBP event, EC_MKBP_EVENT_DP_ALT_MODE_ENTERED.
- The commit also changes the DP AltMode entry notification from sending
a MODE_CHANGE host event to this new MKBP event.
BUG=chromium:786721
BRANCH=None
TEST=Build and flash nocturne, verify that system still wakes up on
DisplayPort Alternate Mode entry.
Change-Id: Ia5f294b26701c3c98c9b7f948fc693d26234c835
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1685787
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1719750
Reviewed-by: Duncan Laurie <dlaurie@google.com>
-rw-r--r-- | common/usb_pd_policy.c | 24 | ||||
-rw-r--r-- | include/ec_commands.h | 16 | ||||
-rw-r--r-- | include/usb_pd.h | 2 |
3 files changed, 28 insertions, 14 deletions
diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c index 3c1e3c0fc5..46b5cdea3f 100644 --- a/common/usb_pd_policy.c +++ b/common/usb_pd_policy.c @@ -7,10 +7,12 @@ #include "charge_manager.h" #include "common.h" #include "console.h" +#include "ec_commands.h" #include "flash.h" #include "gpio.h" #include "hooks.h" #include "host_command.h" +#include "mkbp_event.h" #include "registers.h" #include "rsa.h" #include "sha256.h" @@ -33,22 +35,20 @@ static int rw_flash_changed = 1; -#ifdef CONFIG_HOSTCMD_EVENTS +#ifdef CONFIG_MKBP_EVENT +static int dp_alt_mode_entry_get_next_event(uint8_t *data) +{ + return EC_SUCCESS; +} +DECLARE_EVENT_SOURCE(EC_MKBP_EVENT_DP_ALT_MODE_ENTERED, + dp_alt_mode_entry_get_next_event); + void pd_notify_dp_alt_mode_entry(void) { - /* - * Note: EC_HOST_EVENT_PD_MCU may be a more appropriate host event to - * send, but we do not send that here because there are other cases - * where we send EC_HOST_EVENT_PD_MCU such as charger insertion or - * removal. Currently, those do not wake the system up, but - * EC_HOST_EVENT_MODE_CHANGE does. If we made the system wake up on - * EC_HOST_EVENT_PD_MCU, we would be turning the internal display on on - * every charger insertion/removal, which is not desired. - */ CPRINTS("Notifying AP of DP Alt Mode Entry..."); - host_set_single_event(EC_HOST_EVENT_MODE_CHANGE); + mkbp_send_event(EC_MKBP_EVENT_DP_ALT_MODE_ENTERED); } -#endif /* CONFIG_HOSTCMD_EVENTS */ +#endif /* CONFIG_MKBP_EVENT */ int pd_check_requested_voltage(uint32_t rdo, const int port) { diff --git a/include/ec_commands.h b/include/ec_commands.h index 5933937270..ed5950dcb7 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -557,7 +557,6 @@ enum host_event_code { * * - TABLET/LAPTOP mode * - detachable base attach/detach event - * - DisplayPort Alternate Mode entry */ EC_HOST_EVENT_MODE_CHANGE = 29, @@ -2925,6 +2924,21 @@ enum ec_mkbp_event { */ EC_MKBP_EVENT_SYSRQ = 6, + /* + * New 64-bit host event. + * The event data is 8 bytes of host event flags. + */ + EC_MKBP_EVENT_HOST_EVENT64 = 7, + + /* Notify the AP that something happened on CEC */ + EC_MKBP_EVENT_CEC_EVENT = 8, + + /* Send an incoming CEC message to the AP */ + EC_MKBP_EVENT_CEC_MESSAGE = 9, + + /* We have entered DisplayPort Alternate Mode on a Type-C port. */ + EC_MKBP_EVENT_DP_ALT_MODE_ENTERED = 10, + /* Number of MKBP events */ EC_MKBP_EVENT_COUNT, }; diff --git a/include/usb_pd.h b/include/usb_pd.h index 1c65a0d251..4d303b5766 100644 --- a/include/usb_pd.h +++ b/include/usb_pd.h @@ -1720,7 +1720,7 @@ int pd_capable(int port); /* * Notify the AP that we have entered into DisplayPort Alternate Mode. This - * sets a MODE_CHANGE host event which may wake the AP. + * sets a DP_ALT_MODE_ENTERED MKBP event which may wake the AP. */ void pd_notify_dp_alt_mode_entry(void); |