Re: [PATCH RFC v3 8/8] drm/mediatek: Use dp_connector helpers to expose link training state

From: CK Hu (胡俊光)

Date: Tue Nov 10 2026 - 04:14:56 EST


On Mon, 2026-10-12 at 17:11 +0200, Kory Maincent wrote:
> Adopt the DRM core DisplayPort helpers by setting DRM_BRIDGE_OP_DP and
> populating the bridge dp_link_caps at probe time. Report the sink
> capabilities on hotplug, reset them on disconnect, and report the link
> parameters once link training succeeds.
>
> Signed-off-by: Kory Maincent <kory.maincent@xxxxxxxxxxx>
> ---

[snip]

> static int mtk_dp_training(struct mtk_dp *mtk_dp)
> {
> int ret;
> @@ -2015,6 +2044,8 @@ static irqreturn_t mtk_dp_hpd_event_thread(int hpd, void *dev)
> ret = mtk_dp_training(mtk_dp);
> if (ret)
> drm_err(mtk_dp->drm_dev, "Training failed, %d\n", ret);
> + else
> + mtk_dp_report_link_train(mtk_dp);

I would like to do this in mtk_dp_bdg_detect().
So move drm_helper_hpd_irq_event() after mtk_dp_training().

Regards,
CK

>
> mtk_dp->enabled = true;
> }
> @@ -2145,9 +2176,12 @@ mtk_dp_bdg_detect(struct drm_bridge *bridge, struct drm_connector *connector)
> struct mtk_dp *mtk_dp = mtk_dp_from_bridge(bridge);
> enum drm_connector_status ret = connector_status_disconnected;
> bool enabled = mtk_dp->enabled;
> + int err;
>
> - if (!mtk_dp->train_info.cable_plugged_in)
> + if (!mtk_dp->train_info.cable_plugged_in) {
> + drm_dp_sink_reset_caps(connector);
> return ret;
> + }
>
> if (!enabled)
> mtk_dp_aux_panel_poweron(mtk_dp, true);
> @@ -2160,9 +2194,18 @@ mtk_dp_bdg_detect(struct drm_bridge *bridge, struct drm_connector *connector)
> * whether we connect to a sink device.
> */
>
> - if (drm_dp_read_sink_count(&mtk_dp->aux) > 0)
> + if (drm_dp_read_sink_count(&mtk_dp->aux) > 0) {
> ret = connector_status_connected;
>
> + err = drm_dp_sink_sync_caps(connector, &mtk_dp->aux, NULL);
> + if (err)
> + drm_dbg_kms(mtk_dp->aux.drm_dev,
> + "%s: error sink caps synchronisation (%d)\n",
> + mtk_dp->aux.name, err);
> + } else {
> + drm_dp_sink_reset_caps(connector);
> + }
> +
> if (!enabled)
> mtk_dp_aux_panel_poweron(mtk_dp, false);
>
>