Zork: avoid losing edges from MST hub to DP1_HPD
BRANCH=none
TEST=scope shows 1ms HPD pulses preserved by EC
@@ -133,7 +133,10 @@ static void mst_hpd_handler(void)
{
int hpd = 0;
- /* Pass HPD through from DB OPT3 MST hub to AP's DP1. */
+ /*
+ * Ensure level on GPIO_DP1_HPD matches IOEX_MST_HPD_OUT, in case
+ * we got out of sync.
+ */
ioex_get_level(IOEX_MST_HPD_OUT, &hpd);
gpio_set_level(GPIO_DP1_HPD, hpd);
ccprints("MST HPD %d", hpd);
@@ -142,7 +145,14 @@ DECLARE_DEFERRED(mst_hpd_handler);
void mst_hpd_interrupt(enum ioex_signal signal)
{
- /* Debounce for 2 msec. */
+ /*
+ * Goal is to pass HPD through from DB OPT3 MST hub to AP's DP1.
+ * Immediately invert GPIO_DP1_HPD, to pass through the edge on
+ * IOEX_MST_HPD_OUT. Then check level after 2 msec debounce.
+ */
+ int hpd = !gpio_get_level(GPIO_DP1_HPD);
+
+ gpio_set_level(GPIO_DP1_HPD, hpd);
hook_call_deferred(&mst_hpd_handler_data, (2 * MSEC));
}
