Commit 7f53fbba authored by Heiko Stuebner's avatar Heiko Stuebner Committed by Mark Yao

drm/rockchip: fix clk enable disable mismatch in vop_crtc_mode_set

The function disables the dclk at the beginning, so don't simply return
when an error happens, but instead enable the clock again, so that
enable and disable calls are balanced.

ret_clk is introduced to hold the clk_enable result and not mangle the
original error code.
Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
Reviewed-by: default avatarDaniel Kurtz <djkurtz@chromium.org>
parent 502e95c6
...@@ -893,7 +893,7 @@ static int vop_crtc_mode_set(struct drm_crtc *crtc, ...@@ -893,7 +893,7 @@ static int vop_crtc_mode_set(struct drm_crtc *crtc,
u16 vsync_len = adjusted_mode->vsync_end - adjusted_mode->vsync_start; u16 vsync_len = adjusted_mode->vsync_end - adjusted_mode->vsync_start;
u16 vact_st = adjusted_mode->vtotal - adjusted_mode->vsync_start; u16 vact_st = adjusted_mode->vtotal - adjusted_mode->vsync_start;
u16 vact_end = vact_st + vdisplay; u16 vact_end = vact_st + vdisplay;
int ret; int ret, ret_clk;
uint32_t val; uint32_t val;
/* /*
...@@ -915,7 +915,8 @@ static int vop_crtc_mode_set(struct drm_crtc *crtc, ...@@ -915,7 +915,8 @@ static int vop_crtc_mode_set(struct drm_crtc *crtc,
default: default:
DRM_ERROR("unsupport connector_type[%d]\n", DRM_ERROR("unsupport connector_type[%d]\n",
vop->connector_type); vop->connector_type);
return -EINVAL; ret = -EINVAL;
goto out;
}; };
VOP_CTRL_SET(vop, out_mode, vop->connector_out_mode); VOP_CTRL_SET(vop, out_mode, vop->connector_out_mode);
...@@ -938,7 +939,7 @@ static int vop_crtc_mode_set(struct drm_crtc *crtc, ...@@ -938,7 +939,7 @@ static int vop_crtc_mode_set(struct drm_crtc *crtc,
ret = vop_crtc_mode_set_base(crtc, x, y, fb); ret = vop_crtc_mode_set_base(crtc, x, y, fb);
if (ret) if (ret)
return ret; goto out;
/* /*
* reset dclk, take all mode config affect, so the clk would run in * reset dclk, take all mode config affect, so the clk would run in
...@@ -949,13 +950,14 @@ static int vop_crtc_mode_set(struct drm_crtc *crtc, ...@@ -949,13 +950,14 @@ static int vop_crtc_mode_set(struct drm_crtc *crtc,
reset_control_deassert(vop->dclk_rst); reset_control_deassert(vop->dclk_rst);
clk_set_rate(vop->dclk, adjusted_mode->clock * 1000); clk_set_rate(vop->dclk, adjusted_mode->clock * 1000);
ret = clk_enable(vop->dclk); out:
if (ret < 0) { ret_clk = clk_enable(vop->dclk);
dev_err(vop->dev, "failed to enable dclk - %d\n", ret); if (ret_clk < 0) {
return ret; dev_err(vop->dev, "failed to enable dclk - %d\n", ret_clk);
return ret_clk;
} }
return 0; return ret;
} }
static void vop_crtc_commit(struct drm_crtc *crtc) static void vop_crtc_commit(struct drm_crtc *crtc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment