From 0ebac7251aa188027460d41994dee3d69337b7c9 Mon Sep 17 00:00:00 2001 From: Zhang Yubing Date: Tue, 17 Dec 2024 10:58:34 +0800 Subject: [PATCH] drm/rockchip: vop2: wait dp output config take effect The dp_out_en is config as take effect by vsync signal. When disable the output, it will do some thing as follow: 1. clean dp_out_en bit in vop. 2. disable dp video stream; 3. disable dp link clk. If it not wait clean dp_out_en bit take effect, the link clk may disable before clean dp_out_en bit, which will cause dp fifo overflow issue. When enable the output, though it not has this issue, it's better to wait set dp_out_en bit take effect to avoid the similar issue in the future. Change-Id: Ie088a0265e5bdef349cdd3e0dc3daebb6d9eeeff Signed-off-by: Zhang Yubing --- drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c index 9598b4624cee..25f3879a46b0 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -1038,6 +1038,9 @@ static const struct drm_bus_format_enum_list drm_bus_format_enum_list[] = { static DRM_ENUM_NAME_FN(drm_get_bus_format_name, drm_bus_format_enum_list) +static inline void vop2_cfg_done(struct drm_crtc *crtc); +static void vop2_wait_for_fs_by_done_bit_status(struct vop2_video_port *vp); + static inline struct vop2_video_port *to_vop2_video_port(struct drm_crtc *crtc) { struct rockchip_crtc *rockchip_crtc; @@ -1224,7 +1227,12 @@ static void vop2_crtc_output_post_enable(struct drm_crtc *crtc, int intf) else if (intf & VOP_OUTPUT_IF_DP2) VOP_CTRL_SET(vop2, dp2_en, 1); - dev_info(vop2->dev, "vop enable intf:%x\n", intf); + if (output_if_is_dp(intf)) { + vop2_cfg_done(crtc); + vop2_wait_for_fs_by_done_bit_status(vp); + } + + drm_info(vop2, "vop enable intf:%x\n", intf); } static void vop2_crtc_output_pre_disable(struct drm_crtc *crtc, int intf) @@ -1239,7 +1247,12 @@ static void vop2_crtc_output_pre_disable(struct drm_crtc *crtc, int intf) else if (intf & VOP_OUTPUT_IF_DP2) VOP_CTRL_SET(vop2, dp2_en, 0); - dev_info(vop2->dev, "vop disable intf:%x\n", intf); + if (output_if_is_dp(intf)) { + vop2_cfg_done(crtc); + vop2_wait_for_fs_by_done_bit_status(vp); + } + + drm_info(vop2, "vop disable intf:%x\n", intf); } static inline const struct vop2_win_regs *vop2_get_win_regs(struct vop2_win *win,