Skip to content

Commit

Permalink
drm/rockchip: Properly adjust to a true clock in adjusted_mode
Browse files Browse the repository at this point in the history
When fixing up the clock in vop_crtc_mode_fixup() we're not doing it
quite correctly.  Specifically if we've got the true clock 266666667 Hz,
we'll perform this calculation:
   266666667 / 1000 => 266666

Later when we try to set the clock we'll do clk_set_rate(266666 *
1000).  The common clock framework won't actually pick the proper clock
in this case since it always wants clocks <= the specified one.

Let's solve this by using DIV_ROUND_UP.

Fixes: b59b8de ("drm/rockchip: return a true clock rate to adjusted_mode")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Yakir Yang <ykk@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20190614224730.98622-1-dianders@chromium.org
  • Loading branch information
dianders authored and mmind committed Jun 16, 2019
1 parent 5d4d823 commit 99b9683
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/gpu/drm/rockchip/rockchip_drm_vop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,8 @@ static bool vop_crtc_mode_fixup(struct drm_crtc *crtc,
struct vop *vop = to_vop(crtc);

adjusted_mode->clock =
clk_round_rate(vop->dclk, mode->clock * 1000) / 1000;
DIV_ROUND_UP(clk_round_rate(vop->dclk, mode->clock * 1000),
1000);

return true;
}
Expand Down

0 comments on commit 99b9683

Please sign in to comment.