On Thu, Dec 05, 2024 at 08:31:39PM -0800, Abhinav Kumar wrote: > dp_display_disable() handles special case of when monitor is > disconnected from the dongle while the dongle stays connected > thereby needing a separate function dp_ctrl_off_link_stream() > for this. However with a slight rework this can still be handled > by keeping common paths same for regular and special case. > > Signed-off-by: Abhinav Kumar <quic_abhinavk@xxxxxxxxxxx> > --- > drivers/gpu/drm/msm/dp/dp_ctrl.c | 29 +++++++++++++++-------------- > drivers/gpu/drm/msm/dp/dp_ctrl.h | 4 ++++ > drivers/gpu/drm/msm/dp/dp_display.c | 25 ++++++++++++------------- > 3 files changed, 31 insertions(+), 27 deletions(-) > Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx> Nevertheless, > @@ -905,20 +905,19 @@ static int msm_dp_display_disable(struct msm_dp_display_private *dp) > if (!msm_dp_display->power_on) > return 0; > > - if (dp->link->sink_count == 0) { > - /* > - * irq_hpd with sink_count = 0 > - * hdmi unplugged out of dongle > - */ > - msm_dp_ctrl_off_link_stream(dp->ctrl); > - } else { > - /* > - * unplugged interrupt > - * dongle unplugged out of DUT > - */ > - msm_dp_ctrl_off(dp->ctrl); > + msm_dp_ctrl_clear_vsc_sdp_pkt(dp->ctrl); > + > + /* dongle is still connected but sinks are disconnected */ > + if (dp->link->sink_count == 0) > + msm_dp_ctrl_psm_config(dp->ctrl); > + > + msm_dp_ctrl_off(dp->ctrl); > + > + /* re-init the PHY so that we can listen to Dongle disconnect */ > + if (dp->link->sink_count == 0) It might be better to have just two codepaths: if (sink_count == 0) { msm_dp_ctrl_clear_vsc_sdp_pkt() msm_dp_ctrl_psm_config() msm_dp_ctrl_off() msm_dp_ctrl_reinit_phy() } else { msm_dp_ctrl_clear_vsc_sdp_pkt() msm_dp_ctrl_off() msm_dp_display_host_phy_exit() } > + msm_dp_ctrl_reinit_phy(dp->ctrl); > + else > msm_dp_display_host_phy_exit(dp); > - } > > msm_dp_display->power_on = false; > > > -- > 2.34.1 > -- With best wishes Dmitry