blob: da3266f8ca9d2d2062a8fa05045fff13987f58d9 [file] [log] [blame]
From 54c257e2a6569bf5b29a020f7c004b2cd8e5bc7b Mon Sep 17 00:00:00 2001
From: Douglas Anderson <dianders@chromium.org>
Date: Fri, 14 Jun 2019 15:47:30 -0700
Subject: [PATCH] drm/rockchip: Base adjustments of the mode based on prev
adjustments
commit 527e4ca3b6d13c62340d7a8e2ac3d24800f72f4b upstream.
In vop_crtc_mode_fixup() we fixup the mode to show what we actually
will be able to achieve. However we should base our adjustments on
any previous adjustments that were made.
As an example, the dw_hdmi driver may wish to make some small
adjustments to clock rates in its atomic_check() function. If it
does, it will update the adjusted_mode. We shouldn't throw away those
adjustments.
NOTE: the version of the dw_hdmi driver upstream doesn't _actually_
make such adjustments, but downstream in Chrome OS it does. It is
plausible that one day we'll figure out how to cleanly make that
happen in an upstream-friendly way, so we should prepare by using the
right mode.
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20190614224730.98622-2-dianders@chromium.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 09046135e720..46d933d80ba7 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -1011,8 +1011,8 @@ static bool vop_crtc_mode_fixup(struct drm_crtc *crtc,
struct vop *vop = to_vop(crtc);
adjusted_mode->clock =
- DIV_ROUND_UP(clk_round_rate(vop->dclk, mode->clock * 1000),
- 1000);
+ DIV_ROUND_UP(clk_round_rate(vop->dclk,
+ adjusted_mode->clock * 1000), 1000);
return true;
}
--
2.7.4