Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/bridge: synopsys: dw-mipi-dsi: Force input bus flags

The DATAEN_ACTIVE_LOW bit in DSI_DPI_CFG_POL register is set to zero,
so set the DRM_BUS_FLAG_DE_HIGH flag in input_bus_cfg.flags. It appears
that the DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE flag also makes sense, so
set it in input_bus_cfg.flags too. With this patch, the flags set by
drm_atomic_bridge_propagate_bus_flags() are overridden (see comment in
that function) in case any downstream bridges propagates invalid flags
to this bridge. A real problematic case is to connect a RM67191 MIPI
DSI panel whose driver sets DRM_BUS_FLAG_DE_LOW and
DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE bus flags.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
Reviewed-by: Robert Foss <rfoss@kernel.org>
Signed-off-by: Robert Foss <rfoss@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230821034008.3876938-4-victor.liu@nxp.com

authored by

Liu Ying and committed by
Robert Foss
d5116fb2 0de852d4

+13
+13
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
··· 23 23 #include <drm/bridge/dw_mipi_dsi.h> 24 24 #include <drm/drm_atomic_helper.h> 25 25 #include <drm/drm_bridge.h> 26 + #include <drm/drm_connector.h> 26 27 #include <drm/drm_crtc.h> 27 28 #include <drm/drm_mipi_dsi.h> 28 29 #include <drm/drm_modes.h> ··· 568 567 return input_fmts; 569 568 } 570 569 570 + static int dw_mipi_dsi_bridge_atomic_check(struct drm_bridge *bridge, 571 + struct drm_bridge_state *bridge_state, 572 + struct drm_crtc_state *crtc_state, 573 + struct drm_connector_state *conn_state) 574 + { 575 + bridge_state->input_bus_cfg.flags = 576 + DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE; 577 + 578 + return 0; 579 + } 580 + 571 581 static void dw_mipi_dsi_video_mode_config(struct dw_mipi_dsi *dsi) 572 582 { 573 583 u32 val; ··· 1048 1036 .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, 1049 1037 .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, 1050 1038 .atomic_get_input_bus_fmts = dw_mipi_dsi_bridge_atomic_get_input_bus_fmts, 1039 + .atomic_check = dw_mipi_dsi_bridge_atomic_check, 1051 1040 .atomic_reset = drm_atomic_helper_bridge_reset, 1052 1041 .atomic_pre_enable = dw_mipi_dsi_bridge_atomic_pre_enable, 1053 1042 .atomic_enable = dw_mipi_dsi_bridge_atomic_enable,