From: Chris Zhong Date: Wed, 6 Jan 2016 04:03:53 +0000 (+0800) Subject: UPSTREAM: drm/rockchip: return a true clock rate to adjusted_mode X-Git-Tag: firefly_0821_release~3147 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d6fce1adfbe01a2edf27fa8678570d035d8e9a22;p=firefly-linux-kernel-4.4.55.git UPSTREAM: drm/rockchip: return a true clock rate to adjusted_mode Since the mipi dsi driver need to use the clock of vop to make the calculation of Blanking. But sometimes the clock driver can not set a accurate clock_rate for vop, get it by clk_round_rate before mode_set, so we can get the true value. Change-Id: I04e6a499763258c2e16a09e3a59cf3a1e4593706 Signed-off-by: Chris Zhong Acked-by: Mark Yao (cherry picked from commit b59b8de3149736e5094cb786978a1ba8d6d55b34) --- diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index f5b3da2f92d7..056cac3f0fb1 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -878,9 +878,14 @@ static bool vop_crtc_mode_fixup(struct drm_crtc *crtc, const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { + struct vop *vop = to_vop(crtc); + if (adjusted_mode->htotal == 0 || adjusted_mode->vtotal == 0) return false; + adjusted_mode->clock = + clk_round_rate(vop->dclk, mode->clock * 1000) / 1000; + return true; }