The msm KMS core and its DPU/MDP5/MDP4 backends reach into the concrete DSI, DP and HDMI sub-blocks all over the place. Connector creation is open-coded in each backend and in each sub-block, the bonded-DSI dispatch is duplicated three times with subtle variations, and every cross-module query (command mode, wide bus, DSC config, tear-check source, peripheral flush, snapshot, ...) is a type-specific msm_dsi_*()/msm_dp_*()/ msm_hdmi_*() helper reached through an interface-type switch. In the other direction the sub-blocks cache drm_connector pointers that the core has to hand back to them, coupling each sub-block to a connector it does not own.
Refactor the MSM display / encoder interface. Introduce a small struct msm_display interface, embedded in struct msm_dsi, struct msm_dp and struct hdmi, and fold the per-sub-block operations into it one callback at a time: modeset_init(), snapshot(), the wide-bus / command-mode / DSC / TE-source / peripheral-flush / bonded / encoder queries. Once every cross-module call goes through the interface, struct msm_kms can store the sub-blocks as struct msm_display pointers and drop the concrete accessors entirely. On top of that, move connector creation into common code: each backend now only builds the (genuinely backend-specific) encoder and attaches the bridge chain, and a shared msm_kms_init_connectors() walks the encoders once the bridges are in place and creates a bridge connector for each. The last DisplayPort-specific bit, attaching the DP subconnector property, is generalised into drm_bridge_connector_init() so it is applied to any DisplayPort bridge connector rather than open-coded in msm. The series incorporates two patches by Yongxing Mou from [1], one patch is added as is, another one has minor fix. [1] https://lore.kernel.org/dri-devel/[email protected]/ Signed-off-by: Dmitry Baryshkov <[email protected]> --- Dmitry Baryshkov (22): drm/msm/dp: reject YUV420-only modes without VSC SDP support drm/msm/dp: drop the always-true yuv_supported argument drm/msm: create the display connectors from common code drm/msm: introduce the struct msm_display interface drm/msm: route the display snapshot through the msm_display interface drm/msm/hdmi: capture the HDMI registers in the display snapshot drm/msm: add the wide_bus_enabled callback to msm_display drm/msm: add the needs_periph_flush callback to msm_display drm/msm: add the is_cmd_mode callback to msm_display drm/msm: add the get_dsc_config callback to msm_display drm/msm: add the get_te_source callback to msm_display drm/msm: add is_bonded and needs_encoder callbacks to msm_display drm/msm/hdmi: use dev_get_drvdata() in msm_hdmi_unbind() drm/msm: store the display sub-blocks as struct msm_display drm/msm/dp: do not reject wide-bus modes while a YUV420 mode is active drm/msm/hdmi: cache is_hdmi instead of storing the connector drm/msm/dp: drop redundant panel->connector drm/msm/dp: use drm_display_info in mode_valid callbacks drm/msm/dp: guard subconnector setup on the connector type drm/msm/dp: stop storing the connector in struct msm_dp drm/msm: create the bridge connectors from common code drm/bridge-connector: attach the DP subconnector property Yongxing Mou (2): drm/msm/dp: remove cached drm_edid from panel drm/msm/dp: drop deprecated .mode_set() and use .atomic_pre_enable drivers/gpu/drm/display/drm_bridge_connector.c | 4 + drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 64 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 52 +--- drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 26 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 11 +- drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c | 19 +- drivers/gpu/drm/msm/dp/dp_display.c | 353 +++++++++++++--------- drivers/gpu/drm/msm/dp/dp_display.h | 7 +- drivers/gpu/drm/msm/dp/dp_drm.c | 30 +- drivers/gpu/drm/msm/dp/dp_drm.h | 10 +- drivers/gpu/drm/msm/dp/dp_panel.c | 62 +--- drivers/gpu/drm/msm/dp/dp_panel.h | 15 +- drivers/gpu/drm/msm/dsi/dsi.c | 71 ++++- drivers/gpu/drm/msm/dsi/dsi.h | 8 +- drivers/gpu/drm/msm/dsi/dsi_manager.c | 18 +- drivers/gpu/drm/msm/hdmi/hdmi.c | 101 +++++-- drivers/gpu/drm/msm/hdmi/hdmi.h | 7 +- drivers/gpu/drm/msm/hdmi/hdmi_audio.c | 2 +- drivers/gpu/drm/msm/hdmi/hdmi_bridge.c | 16 +- drivers/gpu/drm/msm/msm_drv.h | 135 +++------ drivers/gpu/drm/msm/msm_kms.c | 90 ++++++ drivers/gpu/drm/msm/msm_kms.h | 9 +- 22 files changed, 636 insertions(+), 474 deletions(-) --- base-commit: b2128290c29902315e632ea59e0504d6bc9e9b42 change-id: 20260722-drm-msm-display-interface-5bccec4b69d5 Best regards, -- With best wishes Dmitry
