[PATCH] drm/rockchip: Properly adjust to a true clock in adjusted_mode
Mark yao
mark.yao at rock-chips.com
Tue Aug 9 03:28:54 UTC 2016
On 2016年08月09日 03:29, Sean Paul wrote:
> From: Douglas Anderson <dianders at chromium.org>
>
> 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.
Good, applied to my drm fixes.
Thanks
> Signed-off-by: Douglas Anderson <dianders at chromium.org>
> Signed-off-by: Sean Paul <seanpaul at chromium.org>
> ---
> drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index 31744fe..1bbffaf 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -891,7 +891,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;
> }
--
Mark Yao
More information about the dri-devel
mailing list