summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2019-03-28 10:43:52 -0700
committerCommit Bot <commit-bot@chromium.org>2020-07-14 06:13:20 +0000
commita768573ff9b1548b420bf9ea5c92626c34c2ff6d (patch)
tree5be7c8701d39433ee981c1b9fd93cb7d6bac13a8
parentdafc781e1db8b2ad8d321cb2a0a56a780bf5bf3e (diff)
downloadchrome-ec-a768573ff9b1548b420bf9ea5c92626c34c2ff6d.tar.gz
common: pd_policy: Add notification for DP AltMode
This commit simply adds a notification that can be called when the device enters DisplayPort Alternate mode or a DP attention VDM is received. Calling the notification will send a MODE_CHANGE host event which may wake the AP. BUG=chromium:786721 BRANCH=firmware-nami-10775.B TEST=With other PD Policies patches, flash nami and run faft_ec&pd Change-Id: Iaa221e69060a7d1015f7c1e2f6f053e6810a674a Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1666366 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Auto-Submit: Aseda Aboagye <aaboagye@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2274380 Tested-by: Dawid Niedźwiecki <dn@semihalf.com> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Dossym Nurmukhanov <dossym@chromium.org>
-rw-r--r--common/usb_pd_policy.c17
-rw-r--r--include/ec_commands.h8
-rw-r--r--include/usb_pd.h6
3 files changed, 30 insertions, 1 deletions
diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c
index 979ffa2603..12aa08bb31 100644
--- a/common/usb_pd_policy.c
+++ b/common/usb_pd_policy.c
@@ -34,6 +34,23 @@
static int rw_flash_changed = 1;
+#ifdef CONFIG_HOSTCMD_EVENTS
+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);
+}
+#endif /* CONFIG_HOSTCMD_EVENTS */
+
int pd_check_requested_voltage(uint32_t rdo, const int port)
{
int max_ma = rdo & 0x3FF;
diff --git a/include/ec_commands.h b/include/ec_commands.h
index a2f9079a7e..8199bb716a 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -596,7 +596,13 @@ enum host_event_code {
/* EC desires to change state of host-controlled USB mux */
EC_HOST_EVENT_USB_MUX = 28,
- /* TABLET/LAPTOP mode event*/
+ /*
+ * The device has changed "modes". This can be one of the following:
+ *
+ * - TABLET/LAPTOP mode
+ * - detachable base attach/detach event
+ * - DisplayPort Alternate Mode entry
+ */
EC_HOST_EVENT_MODE_CHANGE = 29,
/* Keyboard recovery combo with hardware reinitialization */
diff --git a/include/usb_pd.h b/include/usb_pd.h
index c0f2f01b71..4ec6ad9f0b 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -1774,6 +1774,12 @@ int pd_get_partner_usb_comm_capable(int port);
*/
int pd_is_vbus_present(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.
+ */
+void pd_notify_dp_alt_mode_entry(void);
+
/* ----- Logging ----- */
#ifdef CONFIG_USB_PD_LOGGING
/**