Quoting Dmitry Baryshkov (2023-09-07 14:48:54) > On 08/09/2023 00:34, Stephen Boyd wrote: > > Quoting Dmitry Baryshkov (2023-09-03 15:24:32) > >> diff --git a/drivers/gpu/drm/msm/dp/dp_panel.c b/drivers/gpu/drm/msm/dp/dp_panel.c > >> index 97ba41593820..1cb54f26f5aa 100644 > >> --- a/drivers/gpu/drm/msm/dp/dp_panel.c > >> +++ b/drivers/gpu/drm/msm/dp/dp_panel.c > >> @@ -162,6 +162,11 @@ int dp_panel_read_sink_caps(struct dp_panel *dp_panel, > >> } > >> } > >> > >> + rc = drm_dp_read_downstream_info(panel->aux, dp_panel->dpcd, > >> + dp_panel->downstream_ports); > >> + if (rc) > >> + return rc; > > > > I haven't been able to test it yet, but I think with an apple dongle > > we'll never populate the 'downstream_ports' member if the HDMI cable is > > not connected when this runs. That's because this function bails out > > early before trying to read the downstream ports when there isn't a > > sink. Perhaps we need to read it again when an hpd_irq comes in, or we > > need to read it before bailing out from here? > > I don't have an Apple dongle here. But I'll run a check with first > connecting the dongle and plugging the HDMI afterwards. > > However my expectation based on my previous tests is that we only get > here when the actual display is connected. > We get here when HPD is high. With an apple dongle, hpd is high when just the dongle is plugged in. That calls dp_display_process_hpd_high() which calls dp_panel_read_sink_caps(), but that returns with an error (-ENOTCONN) and then we wait for something to change. When the HDMI cable is plugged in (i.e. an actual display) we get an irq_hpd. That causes dp_irq_hpd_handle() to call dp_display_usbpd_attention_cb() which calls dp_link_process_request() that sees 'sink_request & DS_PORT_STATUS_CHANGED' and thus calls dp_display_handle_port_ststus_changed() (that has a typo right?) which hits the else condition and calls dp_display_process_hpd_high(). So yes? We will eventually call dp_panel_read_sink_caps() again, and this time not bail out early. It's probably fine.