summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorTodd Broch <tbroch@chromium.org>2014-10-20 16:58:56 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-10-31 06:29:28 +0000
commitaac88442d7bbc76ec5116fdb3019af09cc522938 (patch)
tree5fb6bbe02b0b78e3837cecea41574e08382c3aee /common
parent13579c3570df0b7f3535d8c5499468761a482734 (diff)
downloadchrome-ec-aac88442d7bbc76ec5116fdb3019af09cc522938.tar.gz
pd: dingdong/hoho: inhibit USB Billboard.
USB Billboard class can be used to advertise an alternate mode capable device that hasn't entered a mode. Additionally it can remain after mode entry providing its Billboard capabilities descriptor is updated. This CL postpones enumeration which previously occurred after boot until tAMETimeout has passed and alternate mode has NOT been entered. Future CL could choose to also (re)enumerate with mode capabilities although this is not required by the USB PD specification. BRANCH=none BUG=chrome-os-partner:31192,chrome-os-partner:31193 TEST=manual, With DFP_U which does not enter mode see Billboard class enumerate else it does not. Change-Id: I59a0815cd0ea551ba9a878907c0184df4ba9480c Signed-off-by: Todd Broch <tbroch@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/224663 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/usb_pd_policy.c18
-rw-r--r--common/usb_pd_protocol.c8
2 files changed, 21 insertions, 5 deletions
diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c
index f0ae2cffab..87e1062817 100644
--- a/common/usb_pd_policy.c
+++ b/common/usb_pd_policy.c
@@ -7,11 +7,13 @@
#include "common.h"
#include "console.h"
#include "gpio.h"
+#include "hooks.h"
#include "host_command.h"
#include "registers.h"
#include "task.h"
#include "timer.h"
#include "util.h"
+#include "usb.h"
#include "usb_pd.h"
#include "usb_pd_config.h"
#include "version.h"
@@ -382,10 +384,6 @@ int pd_svdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload)
return 0;
}
-int pd_alt_mode(int port)
-{
- return 0;
-}
#endif /* CONFIG_USB_PD_ALT_MODE */
#ifndef CONFIG_USB_PD_CUSTOM_VDM
@@ -395,6 +393,18 @@ int pd_vdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload)
}
#endif /* !CONFIG_USB_PD_CUSTOM_VDM */
+void pd_usb_billboard_deferred(void)
+{
+#if defined(CONFIG_USB_PD_ALT_MODE) && !defined(CONFIG_USB_PD_ALT_MODE_DFP) \
+ && !defined(CONFIG_USB_PD_SIMPLE_DFP)
+
+ if (!pd_alt_mode())
+ usb_connect();
+
+#endif
+}
+DECLARE_DEFERRED(pd_usb_billboard_deferred);
+
#ifndef CONFIG_USB_PD_ALT_MODE_DFP
int pd_exit_mode(int port, uint32_t *payload)
{
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index c91893c4c5..c44e070043 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -185,6 +185,9 @@ static const uint8_t dec4b5b[] = {
#define PD_T_DRP_SRC (30*MSEC) /* toggle time for source DRP */
#define PD_T_SRC_RECOVER (760*MSEC) /* between 660ms and 1000ms */
+/* from USB Type-C Specification Table 5-1 */
+#define PD_T_AME (1*SECOND) /* timeout from UFP attach to Alt Mode Entry */
+
/* Port role at startup */
#ifdef CONFIG_USB_PD_DUAL_ROLE
#define PD_ROLE_DEFAULT PD_ROLE_SINK
@@ -1464,6 +1467,9 @@ void pd_task(void)
#endif
set_state(port, PD_STATE_SNK_DISCOVERY);
timeout = 10*MSEC;
+ hook_call_deferred(
+ pd_usb_billboard_deferred,
+ PD_T_AME);
break;
}
}
@@ -1750,7 +1756,7 @@ static int remote_flashing(int argc, char **argv)
void pd_send_hpd(int port, enum hpd_event hpd)
{
uint32_t data[1];
- int opos = pd_alt_mode(port);
+ int opos = pd_alt_mode();
if (!opos)
return;