The DPU backend reads the tear-check source name of a DSI link through
msm_dsi_get_te_source() on the concrete sub-block while building the
display info.

Add a mandatory get_te_source() callback to struct msm_display_funcs; DSI
returns its te_source string, DP and HDMI return NULL. dpu_kms_dsi_set_te_
source() now takes a struct msm_display and dispatches through the
callback.

No functional change intended.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Dmitry Baryshkov <[email protected]>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 6 +++---
 drivers/gpu/drm/msm/dp/dp_display.c     | 6 ++++++
 drivers/gpu/drm/msm/dsi/dsi.c           | 8 ++++++++
 drivers/gpu/drm/msm/dsi/dsi_manager.c   | 5 -----
 drivers/gpu/drm/msm/hdmi/hdmi.c         | 6 ++++++
 drivers/gpu/drm/msm/msm_drv.h           | 8 ++------
 6 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 7928bc1a73f3..8dacde316033 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -555,9 +555,9 @@ static const char *dpu_vsync_sources[] = {
 };
 
 static int dpu_kms_dsi_set_te_source(struct msm_display_info *info,
-                                    struct msm_dsi *dsi)
+                                    struct msm_display *display)
 {
-       const char *te_source = msm_dsi_get_te_source(dsi);
+       const char *te_source = display->funcs->get_te_source(display);
        int i;
 
        if (!te_source) {
@@ -617,7 +617,7 @@ static int _dpu_kms_initialize_dsi(struct drm_device *dev,
                display = msm_dsi_get_display(priv->kms->dsi[i]);
                info.is_cmd_mode = display->funcs->is_cmd_mode(display);
 
-               rc = dpu_kms_dsi_set_te_source(&info, priv->kms->dsi[i]);
+               rc = dpu_kms_dsi_set_te_source(&info, display);
                if (rc) {
                        DPU_ERROR("failed to identify TE source for dsi 
display\n");
                        return rc;
diff --git a/drivers/gpu/drm/msm/dp/dp_display.c 
b/drivers/gpu/drm/msm/dp/dp_display.c
index 047295d46c02..95810e3b01a7 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -1379,6 +1379,11 @@ static struct drm_dsc_config 
*msm_dp_display_get_dsc_config(struct msm_display *
        return NULL;
 }
 
+static const char *msm_dp_display_get_te_source(struct msm_display *display)
+{
+       return NULL;
+}
+
 static const struct msm_display_funcs msm_dp_display_funcs = {
        .modeset_init = msm_dp_modeset_init,
        .snapshot = msm_dp_snapshot,
@@ -1386,6 +1391,7 @@ static const struct msm_display_funcs 
msm_dp_display_funcs = {
        .needs_periph_flush = msm_dp_display_needs_periph_flush,
        .is_cmd_mode = msm_dp_display_is_cmd_mode,
        .get_dsc_config = msm_dp_display_get_dsc_config,
+       .get_te_source = msm_dp_display_get_te_source,
 };
 
 struct msm_display *msm_dp_get_display(struct msm_dp *msm_dp_display)
diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
index e42f5b929b84..e07d1a964c7c 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.c
+++ b/drivers/gpu/drm/msm/dsi/dsi.c
@@ -20,6 +20,13 @@ static struct drm_dsc_config *msm_dsi_get_dsc_config(struct 
msm_display *display
        return msm_dsi_host_get_dsc_config(msm_dsi->host);
 }
 
+static const char *msm_dsi_get_te_source(struct msm_display *display)
+{
+       struct msm_dsi *msm_dsi = container_of(display, struct msm_dsi, 
display);
+
+       return msm_dsi->te_source;
+}
+
 static bool msm_dsi_wide_bus_enabled(struct msm_display *display)
 {
        struct msm_dsi *msm_dsi = container_of(display, struct msm_dsi, 
display);
@@ -294,6 +301,7 @@ static const struct msm_display_funcs msm_dsi_display_funcs 
= {
        .needs_periph_flush = msm_dsi_needs_periph_flush,
        .is_cmd_mode = msm_dsi_is_cmd_mode,
        .get_dsc_config = msm_dsi_get_dsc_config,
+       .get_te_source = msm_dsi_get_te_source,
 };
 
 struct msm_display *msm_dsi_get_display(struct msm_dsi *msm_dsi)
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c 
b/drivers/gpu/drm/msm/dsi/dsi_manager.c
index 959daa88b1d0..2a5326f1fa8b 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
@@ -614,8 +614,3 @@ bool msm_dsi_is_master_dsi(struct msm_dsi *msm_dsi)
 {
        return IS_MASTER_DSI_LINK(msm_dsi->id);
 }
-
-const char *msm_dsi_get_te_source(struct msm_dsi *msm_dsi)
-{
-       return msm_dsi->te_source;
-}
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
index 918fc9c88a19..6e077747ebce 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
@@ -249,6 +249,11 @@ static struct drm_dsc_config 
*msm_hdmi_get_dsc_config(struct msm_display *displa
        return NULL;
 }
 
+static const char *msm_hdmi_get_te_source(struct msm_display *display)
+{
+       return NULL;
+}
+
 static const struct msm_display_funcs msm_hdmi_display_funcs = {
        .modeset_init = msm_hdmi_modeset_init,
        .snapshot = msm_hdmi_snapshot,
@@ -256,6 +261,7 @@ static const struct msm_display_funcs 
msm_hdmi_display_funcs = {
        .needs_periph_flush = msm_hdmi_needs_periph_flush,
        .is_cmd_mode = msm_hdmi_is_cmd_mode,
        .get_dsc_config = msm_hdmi_get_dsc_config,
+       .get_te_source = msm_hdmi_get_te_source,
 };
 
 struct msm_display *msm_hdmi_get_display(struct hdmi *hdmi)
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index cda9849811b1..989b0a37d6aa 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -288,6 +288,7 @@ struct msm_disp_state;
  * @needs_periph_flush: whether @mode requires a peripheral flush; mandatory.
  * @is_cmd_mode:  whether the sub-block runs in command mode; mandatory.
  * @get_dsc_config: return the DSC config for the sub-block, or NULL; 
mandatory.
+ * @get_te_source: return the tear-check source name, or NULL; mandatory.
  */
 struct msm_display_funcs {
        int (*modeset_init)(struct msm_display *display, struct drm_device *dev,
@@ -299,6 +300,7 @@ struct msm_display_funcs {
                                   const struct drm_display_mode *mode);
        bool (*is_cmd_mode)(struct msm_display *display);
        struct drm_dsc_config *(*get_dsc_config)(struct msm_display *display);
+       const char *(*get_te_source)(struct msm_display *display);
 };
 
 /**
@@ -336,7 +338,6 @@ void __exit msm_dsi_unregister(void);
 struct msm_display *msm_dsi_get_display(struct msm_dsi *msm_dsi);
 bool msm_dsi_is_bonded_dsi(struct msm_dsi *msm_dsi);
 bool msm_dsi_is_master_dsi(struct msm_dsi *msm_dsi);
-const char *msm_dsi_get_te_source(struct msm_dsi *msm_dsi);
 #else
 static inline void __init msm_dsi_register(void)
 {
@@ -356,11 +357,6 @@ static inline bool msm_dsi_is_master_dsi(struct msm_dsi 
*msm_dsi)
 {
        return false;
 }
-
-static inline const char *msm_dsi_get_te_source(struct msm_dsi *msm_dsi)
-{
-       return NULL;
-}
 #endif
 
 struct msm_dp;

-- 
2.47.3

Reply via email to