Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4083429ybi; Mon, 29 Jul 2019 18:54:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqx3HXLo5BAECnstbAQGihQxkCc1B9ukAaxH6o07Ua7r7K4m1r2LHc10pXBfM7fbonKW9Ypl X-Received: by 2002:a63:c008:: with SMTP id h8mr105318160pgg.427.1564451669440; Mon, 29 Jul 2019 18:54:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564451669; cv=none; d=google.com; s=arc-20160816; b=Cjxp9wNujKqoTGAku6XT5hnLHcJS8bFQjsDdnKTR/kEPz/mum1S4f3ntBVcdFxD8+7 ByCXDADadPrnZn9gbGKyoaWaM5jYBqpImcGGObTUoka+U8LgLAUdDfavgeurMyaZ7ry0 EFiKFaV5VB/9wATEnbyPWMkdjmQWYm2MoNZsFZlySbyTXfyPZSrTI2thv2wiPcW4C9tI neA2ElkdjMQcf32x2oNN/7b2rFGKnMMMy0nFkjgmRk3ZhIESgQEM1wH0LOrA3YEUgRqv nym7Cgj6Jd+M5VFDQJd8mJQ1rGYGjzA99nYjmiYton0dAVfA34T34lRFn+gwfaYZTZVF n3mQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bbywfWcIIOSV8lg207fIj1E8vLtTnSYVxYTnpSzYEUU=; b=LE4wIw/8QiJLJOsUDTd2FmAW59rD+w3Y9XB8zz62zduinYbEHxcJmEo35h+atIv7qi MuGcwJeLa51iRxcMDfJ2gGzEgnzC9xotKynEEou3TDrxmBub8tFs/uBdOxPtsCDxXt2d XyjveAvH5LMETSgZwN9TPkKq22YzQ+lt6ub8i73BG+hOI3yfDv4qDXO7FB7e66n91s5E QsBr6zZZ0JUFAHpJWKncWeAJroSIC5ucyEIm894vaZSjRJmP4A2FXFKEZBxLoMP+aJ5g UVBWdVPI4pUS9u463x9eupEvFQGo5das5db26qhtRZJcuAqpWdTq8g/U6oxZKmt8UuDm 4jog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LpAGVNcs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s14si30516354pgj.347.2019.07.29.18.54.14; Mon, 29 Jul 2019 18:54:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LpAGVNcs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389925AbfG2TsV (ORCPT + 99 others); Mon, 29 Jul 2019 15:48:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:38362 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729729AbfG2TsQ (ORCPT ); Mon, 29 Jul 2019 15:48:16 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0516820C01; Mon, 29 Jul 2019 19:48:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429696; bh=kTu5OqvrgpLJAICy736VvCxhpsfGdUpXfh8eyIoGUHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LpAGVNcs7BQMZ3hNG54Bjaq6D58AQ2gBwMwJc6kQAlByTgAaButqHbnLSx0YDDdF9 rJCn10hYjX24AY71bgkbpVI0ekfSuTF19u6AEyzY5b0DD6/m8253XU0xoylZY34q20 IEAjN2ZUrGyvPX9/xgsJ9LPUpEUUAQIZ5kjegzog= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Anderson , Sean Paul , Yakir Yang , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.2 064/215] drm/rockchip: Properly adjust to a true clock in adjusted_mode Date: Mon, 29 Jul 2019 21:21:00 +0200 Message-Id: <20190729190751.575791553@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190739.971253303@linuxfoundation.org> References: <20190729190739.971253303@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 99b9683f2142b20bad78e61f7f829e8714e45685 ] 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: b59b8de31497 ("drm/rockchip: return a true clock rate to adjusted_mode") Signed-off-by: Douglas Anderson Signed-off-by: Sean Paul Reviewed-by: Yakir Yang Signed-off-by: Heiko Stuebner Link: https://patchwork.freedesktop.org/patch/msgid/20190614224730.98622-1-dianders@chromium.org Signed-off-by: Sasha Levin --- 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 12ed5265a90b..09046135e720 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -1011,7 +1011,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; } -- 2.20.1