summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Broch <tbroch@chromium.org>2015-05-28 10:34:26 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-05-29 01:37:38 +0000
commit14ba846eea9a16876df98802d9c0f192ae006ce0 (patch)
treed4e196c51225b478a24b4c8c71630dd792f19b08
parente4cd9121a5aa27f58106b6fc6a089c92b67a9668 (diff)
downloadchrome-ec-14ba846eea9a16876df98802d9c0f192ae006ce0.tar.gz
pd: Refine HPD debounce values.
Change refines HPD debounce values into both upstream and downstream values for packetizing across the type-C link. For LVL, the upstream type-C device will packetize any HPD transition >=2ms as either HIGH or LOW. On the downstream side the value is driven immediately. Additional debouncing should be done by true upstream device according to specification. For IRQ, the upstream type-C device will packetize any HPD pulse >250usec as an IRQ. On the downstream side it will be de-packetized to create 750usec pulse. Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=samus BUG=chrome-os-partner:39717 TEST=samus|macbook(2015) + hoho|dingdong|apple HDMI type-C dongles still drive screens successfully. Change-Id: Ide58f3b2d675a82c12ca6afc2be53ca6e2561ace Reviewed-on: https://chromium-review.googlesource.com/273867 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org>
-rw-r--r--board/dingdong/board.c23
-rw-r--r--board/hoho/board.c23
-rw-r--r--board/plankton/board.c18
-rw-r--r--board/ryu/usb_pd_policy.c2
-rw-r--r--board/samus_pd/usb_pd_policy.c2
-rw-r--r--include/usb_pd.h7
6 files changed, 40 insertions, 35 deletions
diff --git a/board/dingdong/board.c b/board/dingdong/board.c
index cdeb95342c..2896135389 100644
--- a/board/dingdong/board.c
+++ b/board/dingdong/board.c
@@ -34,16 +34,16 @@ void hpd_event(enum gpio_signal signal);
* 3. irq : downstream display sink signalling an interrupt.
*
* The debounce times for these various events are:
- * 100MSEC : min pulse width of level value.
- * 2MSEC : min pulse width of IRQ low pulse. Max is level debounce min.
+ * HPD_USTREAM_DEBOUNCE_LVL : min pulse width of level value.
+ * HPD_USTREAM_DEBOUNCE_IRQ : min pulse width of IRQ low pulse.
*
* lvl(n-2) lvl(n-1) lvl prev_delta now_delta event
* ----------------------------------------------------
- * 1 0 1 <2ms n/a low glitch (ignore)
- * 1 0 1 >2ms <100ms irq
- * x 0 1 n/a >100ms high
- * 0 1 0 <100ms n/a high glitch (ignore)
- * x 1 0 n/a >100ms low
+ * 1 0 1 <IRQ n/a low glitch (ignore)
+ * 1 0 1 >IRQ <LVL irq
+ * x 0 1 n/a >LVL high
+ * 0 1 0 <LVL n/a high glitch (ignore)
+ * x 1 0 n/a >LVL low
*/
void hpd_irq_deferred(void)
@@ -77,14 +77,15 @@ void hpd_event(enum gpio_signal signal)
hook_call_deferred(hpd_lvl_deferred, -1);
/* It's a glitch. Previous time moves but level is the same. */
- if (cur_delta < HPD_DEBOUNCE_IRQ)
+ if (cur_delta < HPD_USTREAM_DEBOUNCE_IRQ)
return;
- if ((!hpd_prev_level && level) && (cur_delta < HPD_DEBOUNCE_LVL))
+ if ((!hpd_prev_level && level) &&
+ (cur_delta < HPD_USTREAM_DEBOUNCE_LVL))
/* It's an irq */
hook_call_deferred(hpd_irq_deferred, 0);
- else if (cur_delta >= HPD_DEBOUNCE_LVL)
- hook_call_deferred(hpd_lvl_deferred, HPD_DEBOUNCE_LVL);
+ else if (cur_delta >= HPD_USTREAM_DEBOUNCE_LVL)
+ hook_call_deferred(hpd_lvl_deferred, HPD_USTREAM_DEBOUNCE_LVL);
hpd_prev_level = level;
}
diff --git a/board/hoho/board.c b/board/hoho/board.c
index 19f0cc2f7c..8e0a370bf3 100644
--- a/board/hoho/board.c
+++ b/board/hoho/board.c
@@ -36,16 +36,16 @@ void hpd_event(enum gpio_signal signal);
* 3. irq : downstream display sink signalling an interrupt.
*
* The debounce times for these various events are:
- * 100MSEC : min pulse width of level value.
- * 2MSEC : min pulse width of IRQ low pulse. Max is level debounce min.
+ * HPD_USTREAM_DEBOUNCE_LVL : min pulse width of level value.
+ * HPD_USTREAM_DEBOUNCE_IRQ : min pulse width of IRQ low pulse.
*
* lvl(n-2) lvl(n-1) lvl prev_delta now_delta event
* ----------------------------------------------------
- * 1 0 1 <2ms n/a low glitch (ignore)
- * 1 0 1 >2ms <100ms irq
- * x 0 1 n/a >100ms high
- * 0 1 0 <100ms n/a high glitch (ignore)
- * x 1 0 n/a >100ms low
+ * 1 0 1 <IRQ n/a low glitch (ignore)
+ * 1 0 1 >IRQ <LVL irq
+ * x 0 1 n/a >LVL high
+ * 0 1 0 <LVL n/a high glitch (ignore)
+ * x 1 0 n/a >LVL low
*/
void hpd_irq_deferred(void)
@@ -79,14 +79,15 @@ void hpd_event(enum gpio_signal signal)
hook_call_deferred(hpd_lvl_deferred, -1);
/* It's a glitch. Previous time moves but level is the same. */
- if (cur_delta < HPD_DEBOUNCE_IRQ)
+ if (cur_delta < HPD_USTREAM_DEBOUNCE_IRQ)
return;
- if ((!hpd_prev_level && level) && (cur_delta < HPD_DEBOUNCE_LVL))
+ if ((!hpd_prev_level && level) &&
+ (cur_delta < HPD_USTREAM_DEBOUNCE_LVL))
/* It's an irq */
hook_call_deferred(hpd_irq_deferred, 0);
- else if (cur_delta >= HPD_DEBOUNCE_LVL)
- hook_call_deferred(hpd_lvl_deferred, HPD_DEBOUNCE_LVL);
+ else if (cur_delta >= HPD_USTREAM_DEBOUNCE_LVL)
+ hook_call_deferred(hpd_lvl_deferred, HPD_USTREAM_DEBOUNCE_LVL);
hpd_prev_level = level;
}
diff --git a/board/plankton/board.c b/board/plankton/board.c
index 40b0c2b2d8..64f23549ec 100644
--- a/board/plankton/board.c
+++ b/board/plankton/board.c
@@ -41,16 +41,16 @@ static int sn75dp130_dpcd_init(void);
* 3. irq : downstream display sink signalling an interrupt.
*
* The debounce times for these various events are:
- * 100MSEC : min pulse width of level value.
- * 2MSEC : min pulse width of IRQ low pulse. Max is level debounce min.
+ * HPD_USTREAM_DEBOUNCE_LVL : min pulse width of level value.
+ * HPD_USTREAM_DEBOUNCE_IRQ : min pulse width of IRQ low pulse.
*
* lvl(n-2) lvl(n-1) lvl prev_delta now_delta event
* ----------------------------------------------------
- * 1 0 1 <2ms n/a low glitch (ignore)
- * 1 0 1 >2ms <100ms irq
- * x 0 1 n/a >100ms high
- * 0 1 0 <100ms n/a high glitch (ignore)
- * x 1 0 n/a >100ms low
+ * 1 0 1 <IRQ n/a low glitch (ignore)
+ * 1 0 1 >IRQ <LVL irq
+ * x 0 1 n/a >LVL high
+ * 0 1 0 <LVL n/a high glitch (ignore)
+ * x 1 0 n/a >LVL low
*/
void hpd_lvl_deferred(void)
@@ -84,14 +84,14 @@ void hpd_event(enum gpio_signal signal)
uint64_t cur_delta = now.val - hpd_prev_ts;
/* Record low pulse */
- if (cur_delta >= HPD_DEBOUNCE_IRQ && level)
+ if (cur_delta >= HPD_USTREAM_DEBOUNCE_IRQ && level)
hpd_possible_irq = 1;
/* store current time */
hpd_prev_ts = now.val;
/* All previous hpd level events need to be re-triggered */
- hook_call_deferred(hpd_lvl_deferred, HPD_DEBOUNCE_LVL);
+ hook_call_deferred(hpd_lvl_deferred, HPD_USTREAM_DEBOUNCE_LVL);
}
/* Debounce time for voltage buttons */
diff --git a/board/ryu/usb_pd_policy.c b/board/ryu/usb_pd_policy.c
index c64d59e41c..1bd5c6e6cd 100644
--- a/board/ryu/usb_pd_policy.c
+++ b/board/ryu/usb_pd_policy.c
@@ -338,7 +338,7 @@ static int svdm_dp_attention(int port, uint32_t *payload)
if (irq & cur_lvl) {
gpio_set_level(GPIO_USBC_DP_HPD, 0);
hook_call_deferred(hpd_irq_deferred,
- HPD_DEBOUNCE_IRQ);
+ HPD_DSTREAM_DEBOUNCE_IRQ);
} else if (irq & !cur_lvl) {
CPRINTF("ERR:HPD:IRQ&LOW\n");
return 0; /* nak */
diff --git a/board/samus_pd/usb_pd_policy.c b/board/samus_pd/usb_pd_policy.c
index 154a1303e7..af58c7e004 100644
--- a/board/samus_pd/usb_pd_policy.c
+++ b/board/samus_pd/usb_pd_policy.c
@@ -367,7 +367,7 @@ static int svdm_dp_attention(int port, uint32_t *payload)
if (irq & cur_lvl) {
gpio_set_level(hpd, 0);
hook_call_deferred(PORT_TO_HPD_IRQ_DEFERRED(port),
- HPD_DEBOUNCE_IRQ);
+ HPD_DSTREAM_DEBOUNCE_IRQ);
} else if (irq & !cur_lvl) {
CPRINTF("ERR:HPD:IRQ&LOW\n");
return 0; /* nak */
diff --git a/include/usb_pd.h b/include/usb_pd.h
index 31c3501726..2a432936f4 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -555,8 +555,11 @@ struct pd_policy {
#define PD_VDO_DPSTS_HPD_LVL(x) (((x) >> 7) & 1)
#define PD_VDO_DPSTS_MF_PREF(x) (((x) >> 4) & 1)
-#define HPD_DEBOUNCE_LVL (100*MSEC)
-#define HPD_DEBOUNCE_IRQ (2*MSEC)
+/* Per DisplayPort Spec v1.3 Section 3.3 */
+#define HPD_USTREAM_DEBOUNCE_LVL (2*MSEC)
+#define HPD_USTREAM_DEBOUNCE_IRQ (250)
+#define HPD_DSTREAM_DEBOUNCE_IRQ (750) /* between 500-1000us */
+
/*
* DisplayPort Configure VDO
* -------------------------