[PATCH v4 30/39] drm/msm/dp: add dp_display_get_panel() to initialize DP panel

Yongxing Mou
2026-04-10T09:36:25Z

From: Abhinav Kumar <quic_abhinavk@quicinc.com>

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@quicinc.com>
Signed-off-by: Yongxing Mou <yongxing.mou@oss.qualcomm.com>
---
drivers/gpu/drm/msm/dp/dp_display.c | 24 ++++++++++++++++++++++++
drivers/gpu/drm/msm/dp/dp_display.h | 1 +
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 abf26951819a..1f26283b2dee 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -571,6 +571,30 @@ static int msm_dp_irq_hpd_handle(struct msm_dp_display_private *dp)
return rc;
}

+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[0]);
+
+ if (IS_ERR(dp->panel)) {
+ DRM_ERROR("failed to initialize panel\n");
+ return NULL;
+ }
+
+ /* FIXME: move out of panel */
+ 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));
+
+ 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 2548f67cd441..5f3ef295d710 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.h
+++ b/drivers/gpu/drm/msm/dp/dp_display.h
@@ -59,4 +59,5 @@ int msm_dp_display_set_mode_helper(struct msm_dp *msm_dp_display,
int msm_dp_display_prepare(struct msm_dp *msm_dp_display);
void msm_dp_display_unprepare(struct msm_dp *dp);

+struct msm_dp_panel *msm_dp_display_get_panel(struct msm_dp *msm_dp_display);
#endif /* _DP_DISPLAY_H_ */

--
2.43.0