[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3bygazxh5sabn6jc7m5yd63s6igag2lt3hp46642b2tusxecb7@2zkhof4wr6rq>
Date: Thu, 15 Jan 2026 11:40:56 +0200
From: Dmitry Baryshkov <dmitry.baryshkov@....qualcomm.com>
To: Konrad Dybcio <konrad.dybcio@....qualcomm.com>
Cc: Rob Clark <robin.clark@....qualcomm.com>,
Dmitry Baryshkov <lumag@...nel.org>,
Abhinav Kumar <abhinav.kumar@...ux.dev>,
Jessica Zhang <jesszhan0024@...il.com>, Sean Paul <sean@...rly.run>,
Marijn Suijten <marijn.suijten@...ainline.org>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
Kuogee Hsieh <quic_khsieh@...cinc.com>, linux-arm-msm@...r.kernel.org,
dri-devel@...ts.freedesktop.org, freedreno@...ts.freedesktop.org,
linux-kernel@...r.kernel.org,
Jessica Zhang <jessica.zhang@....qualcomm.com>
Subject: Re: [PATCH v3 3/8] drm/msm/dp: Read DPCD and sink count in bridge
detect()
On Thu, Jan 15, 2026 at 10:19:27AM +0100, Konrad Dybcio wrote:
> On 1/15/26 8:29 AM, Dmitry Baryshkov wrote:
> > From: Jessica Zhang <jessica.zhang@....qualcomm.com>
> >
> > Instead of relying on the link_ready flag to specify if DP is connected,
> > read the DPCD bits and get the sink count to accurately detect if DP is
> > connected.
> >
> > Signed-off-by: Jessica Zhang <jessica.zhang@....qualcomm.com>
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@....qualcomm.com>
> > ---
> > drivers/gpu/drm/msm/dp/dp_display.c | 60 +++++++++++++++++++++++++++++++++++++
> > drivers/gpu/drm/msm/dp/dp_drm.c | 20 -------------
> > drivers/gpu/drm/msm/dp/dp_drm.h | 2 ++
> > 3 files changed, 62 insertions(+), 20 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
> > index 5997cd28ba11..a05144de3b93 100644
> > --- a/drivers/gpu/drm/msm/dp/dp_display.c
> > +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> > @@ -1151,6 +1151,66 @@ static int msm_dp_hpd_event_thread_start(struct msm_dp_display_private *msm_dp_p
> > return 0;
> > }
> >
> > +/**
> > + * msm_dp_bridge_detect - callback to determine if connector is connected
> > + * @bridge: Pointer to drm bridge structure
> > + * @connector: Pointer to drm connector structure
> > + * Returns: Bridge's 'is connected' status
> > + */
> > +enum drm_connector_status msm_dp_bridge_detect(struct drm_bridge *bridge,
> > + struct drm_connector *connector)
> > +{
> > + struct msm_dp_bridge *msm_dp_bridge = to_dp_bridge(bridge);
> > + struct msm_dp *dp = msm_dp_bridge->msm_dp_display;
> > + struct msm_dp_display_private *priv;
> > + int ret = 0;
> > + int status = connector_status_disconnected;
> > + u8 dpcd[DP_RECEIVER_CAP_SIZE];
> > + struct drm_dp_desc desc;
>
> Reverse-Christmas-tree would be nice
>
> > +
> > + dp = to_dp_bridge(bridge)->msm_dp_display;
> > +
> > + priv = container_of(dp, struct msm_dp_display_private, msm_dp_display);
> > +
> > + if (!dp->link_ready)
> > + return status;
> > +
> > + msm_dp_aux_enable_xfers(priv->aux, true);
> > +
> > + ret = pm_runtime_resume_and_get(&dp->pdev->dev);
> > + if (ret) {
>
> See ef8057b07c72 ("PM: runtime: Wrapper macros for ACQUIRE()/ACQUIRE_ERR()")
Interesting. Something fun to learn.
>
>
> > + DRM_ERROR("failed to pm_runtime_resume\n");
> > + msm_dp_aux_enable_xfers(priv->aux, false);
> > + return status;
> > + }
> > +
> > + ret = msm_dp_aux_is_link_connected(priv->aux);
> > + if (dp->internal_hpd && !ret)
> > + goto end;
> > +
> > + ret = drm_dp_read_dpcd_caps(priv->aux, dpcd);
>
>
> > + if (ret)
> > + goto end;
> > +
> > + ret = drm_dp_read_desc(priv->aux, &desc, drm_dp_is_branch(dpcd));
> > + if (ret)
> > + goto end;
> > +
> > + status = connector_status_connected;
> > + if (drm_dp_read_sink_count_cap(connector, dpcd, &desc)) {
> > + int sink_count = drm_dp_read_sink_count(priv->aux);
> > +
> > + drm_dbg_dp(dp->drm_dev, "sink_count = %d\n", sink_count);
> > +
> > + if (sink_count <= 0)
> > + status = connector_status_disconnected;
>
> < 0 would be an error coming from drm_dp_dpcd_read_byte, should we log
> it?
I'd rather not. At this point the errors might be coming from the cable
being not so fun, not settled, etc.
--
With best wishes
Dmitry
Powered by blists - more mailing lists