Re: [PATCH v3 27/38] drm/msm/dp: add dp_display_get_panel() to initialize DP panel

From: Yongxing Mou

Date: Wed Apr 01 2026 - 05:54:39 EST




On 8/27/2025 12:33 AM, Dmitry Baryshkov wrote:
On Mon, Aug 25, 2025 at 10:16:13PM +0800, Yongxing Mou wrote:
From: Abhinav Kumar <quic_abhinavk@xxxxxxxxxxx>

Add an API dp_display_get_panel() to initialize and return a DP
panel to be used by DP MST module. Since some of the fields of
DP panel are private, dp_display module needs to initialize these
parts and return the panel back.

Signed-off-by: Abhinav Kumar <quic_abhinavk@xxxxxxxxxxx>
Signed-off-by: Yongxing Mou <yongxing.mou@xxxxxxxxxxxxxxxx>
---
drivers/gpu/drm/msm/dp/dp_display.c | 23 +++++++++++++++++++++++
drivers/gpu/drm/msm/dp/dp_display.h | 2 ++
2 files changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index 84df34306fb557341bea288ea8c13b0c81b11919..abcab3ed43b6da5ef898355cf9b7561cd9fe0404 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -632,6 +632,29 @@ static int msm_dp_irq_hpd_handle(struct msm_dp_display_private *dp, u32 data)
return 0;
}
+struct msm_dp_panel *msm_dp_display_get_panel(struct msm_dp *msm_dp_display)
+{
+ struct msm_dp_display_private *dp;
+ struct msm_dp_panel *dp_panel;
+
+ dp = container_of(msm_dp_display, struct msm_dp_display_private, msm_dp_display);
+
+ dp_panel = msm_dp_panel_get(&dp->msm_dp_display.pdev->dev, dp->aux, dp->link,
+ dp->link_base, dp->mst2link_base, dp->mst3link_base,
+ dp->pixel_base);
+
+ if (IS_ERR(dp->panel)) {
+ DRM_ERROR("failed to initialize panel\n");
+ return NULL;
+ }
+
+ memcpy(dp_panel->dpcd, dp->panel->dpcd, DP_RECEIVER_CAP_SIZE);
+ memcpy(&dp_panel->link_info, &dp->panel->link_info,
+ sizeof(dp->panel->link_info));

Both these lines show that link_info and dpcd belong to msm_dp_display
rather than the panel. The panel should only be describing properties of
the particular sink.

I agree with your point.

This would require a larger cleanup of the panel abstraction, which
seems out of scope for this series. Could we address it in a separate refactoring series?

+
+ return dp_panel;
+}
+
static void msm_dp_display_deinit_sub_modules(struct msm_dp_display_private *dp)
{
msm_dp_audio_put(dp->audio);
diff --git a/drivers/gpu/drm/msm/dp/dp_display.h b/drivers/gpu/drm/msm/dp/dp_display.h
index b1ea027438d952c94f3ae80725c92e46c631bdb2..d5889b801d190b6f33b180ead898c1e4ebcbf8f3 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.h
+++ b/drivers/gpu/drm/msm/dp/dp_display.h
@@ -65,4 +65,6 @@ void msm_dp_display_unprepare(struct msm_dp *dp);
int msm_dp_display_get_active_stream_cnt(struct msm_dp *msm_dp_display);
+struct msm_dp_panel *msm_dp_display_get_panel(struct msm_dp *msm_dp_display);
+
#endif /* _DP_DISPLAY_H_ */

--
2.34.1