Herobrine: Add debug messages to show the HPD change
Show the HPD change message to help debugging issues.
BRANCH=None
TEST=Plug and unplug a Type-C monitor and check the messages.
@@ -229,9 +229,11 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
usleep(svdm_hpd_deadline[port] - now);
/* Generate IRQ_HPD pulse */
+ CPRINTS("C%d: Recv IRQ. HPD->0", port);
gpio_pin_set_dt(hpd, 0);
usleep(HPD_DSTREAM_DEBOUNCE_IRQ);
gpio_pin_set_dt(hpd, 1);
+ CPRINTS("C%d: Recv IRQ. HPD->1", port);
/* Set the minimum time delay (2ms) for the next HPD IRQ */
svdm_hpd_deadline[port] = get_time().val +
@@ -240,6 +242,7 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
CPRINTF("ERR:HPD:IRQ&LOW\n");
return 0;
} else {
+ CPRINTS("C%d: Recv lvl. HPD->%d", port, lvl);
gpio_pin_set_dt(hpd, lvl);
/* Set the minimum time delay (2ms) for the next HPD IRQ */
svdm_hpd_deadline[port] = get_time().val +
@@ -251,6 +254,7 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
__override void svdm_exit_dp_mode(int port)
{
+ CPRINTS("%s(%d)", __func__, port);
if (is_dp_muxable(port)) {
/* Disconnect the DP port selection mux. */
gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_dp_mux_oe_l), 1);
@@ -259,6 +263,7 @@ __override void svdm_exit_dp_mode(int port)
/* Signal AP for the HPD low event */
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ CPRINTS("C%d: DP exit. HPD->0", port);
gpio_pin_set_dt(
GPIO_DT_FROM_NODELABEL(gpio_dp_hot_plug_det_r), 0);
}
