From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B9E8380FFD for ; Fri, 19 Jun 2026 14:09:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781878150; cv=none; b=Vyhn4W1dyMXvYBMzjaUv5zWTkBHgOwNLF/9c/mqyD2No+lschEqz/3et8NFuazng+d2aj1TUBdbcD0s04FnmwoRK/Brg/U+MmoQMFW4eoNHCxS1O/JL1JRuVTuTVZ+WQ2LaKTcxbjpQPClvMMUrYdlLaxy4g/N14tuHBmNR8MWo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781878150; c=relaxed/simple; bh=5x4P9TLdk1IA18EbpnCwDLhifUvgIQrPJ21FPA9DFtQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=a5eQ2HQwIOEA0xwpB0/DM5EP7p7FReewaIfIDY3qQPUBQ3zs4c8S+CAt4mQdxEkcYRHi+qD17qp1cIJGKLZBCqjBFTEa1c05QbBBXQMceKt9/L34gcCwJhKeNYBa92yMGUaDeRdfLqfvrcLrvgvOl0jAF1ABvHhJARUSVbsn1NA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=kiZ2AHRx; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="kiZ2AHRx" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id A36D41A39A0; Fri, 19 Jun 2026 14:09:07 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 6EBE8601AD; Fri, 19 Jun 2026 14:09:07 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 9A510106C88A8; Fri, 19 Jun 2026 16:09:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1781878145; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=8zhw41Wj4vCH2abThiXQujr4lQRlosy+XBXOYfxLors=; b=kiZ2AHRxwemniL/axdXQpGWkQMO6tJUJDELCW+DFK9ZKkXXaQdxEqkFNGLXDrm2ox3/Cxu 9mHtWNKn+nOv/H/8SvKQdP2m/0J7WgRYfuLktXZCWylmWZ94LHnDRjf6a2sDHelmMKcyzM pnxZprH1bJKxX7zlAx1THNyAD9dVwpwZzEa8iLXjTSn1Qu0zcEBaHTpiMbWeEUCoAAJIks CMuE8ArmR6M3bq+VLJpPsRQ9QMuUl7U0pXwz9KXle582cGhXXsXzSwotkaU697KUVLjnU3 f/35RBhBdw4uhl45nMlhCCeEE8Eraq/+1zFAJHEGSPLNjobb8OAhDvlvnoenSg== From: Kory Maincent Date: Fri, 19 Jun 2026 16:08:46 +0200 Subject: [PATCH RFC v2 4/4] drm/mediatek: Use dp_connector helpers to report link training state Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260619-feat_link_cap-v2-4-a3dec4c02ad9@bootlin.com> References: <20260619-feat_link_cap-v2-0-a3dec4c02ad9@bootlin.com> In-Reply-To: <20260619-feat_link_cap-v2-0-a3dec4c02ad9@bootlin.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Chun-Kuang Hu , Philipp Zabel , Matthias Brugger , AngeloGioacchino Del Regno , Dmitry Baryshkov , Daniel Stone Cc: Thomas Petazzoni , Mark Yacoub , Sean Paul , Manasi Navare , Drew Davenport , Louis Chauvet , Luca Ceresoli , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Kory Maincent X-Mailer: b4 0.15.0 X-Last-TLS-Session-Version: TLSv1.3 Set DRM_BRIDGE_OP_DP and populate dp_link_train_caps with the supported link rates, lane counts, voltage swing and pre-emphasis levels so the bridge connector uses drmm_connector_dp_init() and exposes the link training state properties to userspace. Store per-lane voltage swing and pre-emphasis values in mtk_dp_train_info and report the negotiated link parameters via drm_connector_dp_set_link_train_properties() on training completion. Clear them via drm_connector_dp_reset_link_train_properties() when a disconnect is detected in the HPD event thread. Signed-off-by: Kory Maincent --- This patch has still not been tested. I am in the process of finding the hardware for that. Changes in v2: - Remove voltage swing and pre emphasis properties. --- drivers/gpu/drm/mediatek/mtk_dp.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c index eefbc7e0f9c8d..c1e7086104116 100644 --- a/drivers/gpu/drm/mediatek/mtk_dp.c +++ b/drivers/gpu/drm/mediatek/mtk_dp.c @@ -1789,6 +1789,8 @@ static int mtk_dp_parse_capabilities(struct mtk_dp *mtk_dp) } } + drm_dp_sink_set_link_caps(mtk_dp->conn, &mtk_dp->aux); + return 0; } @@ -1812,6 +1814,17 @@ static void mtk_dp_train_change_mode(struct mtk_dp *mtk_dp) mtk_dp_reset_swing_pre_emphasis(mtk_dp); } +static void mtk_dp_report_link_train(struct mtk_dp *mtk_dp) +{ + u32 rate, nlanes; + + rate = drm_dp_bw_code_to_link_rate(mtk_dp->train_info.link_rate); + nlanes = mtk_dp->train_info.lane_count; + + drm_dp_set_cur_link_params(mtk_dp->conn, rate, nlanes, false); + drm_dp_set_max_link_params(mtk_dp->conn, rate, nlanes); +} + static int mtk_dp_training(struct mtk_dp *mtk_dp) { int ret; @@ -1892,6 +1905,7 @@ static int mtk_dp_training(struct mtk_dp *mtk_dp) mtk_dp_training_set_scramble(mtk_dp, true); mtk_dp_set_enhanced_frame_mode(mtk_dp); + mtk_dp_report_link_train(mtk_dp); return 0; } @@ -2004,6 +2018,7 @@ static irqreturn_t mtk_dp_hpd_event_thread(int hpd, void *dev) mtk_dp->need_debounce = false; mod_timer(&mtk_dp->debounce_timer, jiffies + msecs_to_jiffies(100) - 1); + drm_dp_sink_reset_link_caps(mtk_dp->conn); } else { mtk_dp_aux_panel_poweron(mtk_dp, true); @@ -2742,6 +2757,12 @@ static int mtk_dp_edp_link_panel(struct drm_dp_aux *mtk_aux) static int mtk_dp_probe(struct platform_device *pdev) { + static const u32 dp_rates[] = {162000, 270000, 540000, 810000}; + static const struct drm_connector_dp_link_caps dp_link_caps = { + .nlanes = 4, + .nlink_rates = ARRAY_SIZE(dp_rates), + .link_rates = dp_rates, + }; struct mtk_dp *mtk_dp; struct device *dev = &pdev->dev; int ret; @@ -2809,6 +2830,8 @@ static int mtk_dp_probe(struct platform_device *pdev) mtk_dp->bridge.of_node = dev->of_node; mtk_dp->bridge.type = mtk_dp->data->bridge_type; + mtk_dp->bridge.dp_link_caps = &dp_link_caps; + mtk_dp->bridge.ops = DRM_BRIDGE_OP_DP; if (mtk_dp->bridge.type == DRM_MODE_CONNECTOR_eDP) { /* -- 2.43.0