Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3132713ybi; Thu, 18 Jul 2019 21:40:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwVYp0qnfoOsdJemgT6sr97JguLGUxoSo7QlL6Y1QzZlQQ6js1zJRkhUxqx6pEWOposjbxe X-Received: by 2002:a17:902:8d92:: with SMTP id v18mr55073888plo.211.1563511213554; Thu, 18 Jul 2019 21:40:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563511213; cv=none; d=google.com; s=arc-20160816; b=wi1tLbdCV8gn+d6NRgBhQFKK0Z4S7B+UIjkT+gfu+AOvvt4rP7WePg9MelSJbRNRU/ aTKCCAiTNo1jwQO5UuC4Y6PmTnOgbe6m3eUa/YCNDJL3sWO7Z58pjlAj3h+VRqrgedNO 7K881LF3+C+brZ/YkAWFJ2TquXoHBsIl7xccotLwfEZrD9pw8cA8ycYwjkJQqX8FVGsP K/Vt5E8zJ+F4gwaFq5EN4oi3gm2B/9+8DKHaWH0QZdv5czr1UlhqdpS71lS/h4sPXFvr XtVpRngPXazP2e0jSvQbceJFh9UsMr2wimk1wh2ZSfHlmBgXf6+bkS2AIUqhLDc68znH WVrg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+2iVB5S5pQqCzIfTwTgoTsuaDDeCvIdjwiu2E9pVseU=; b=zc49YHs7Jc/GrImD7ZlVYiaXtc+R9ZaIYnQvbnumKuCU9uVMR9r8A+fLX0+vP38pBx HJdXa/FDCqolvzbsIR7KOhKXh0yULR9b3SfFH9vJHDAE/ESqMHTRX6l5M42BXMR3tlXT uUKac6I9qfPn0LOQcH9jRx89S3YxhC7A/tFhUccZv4AbjeTUOMlj0Wf0WtzohCSSL1xf o6oqo9FJzkqGXPtCxdOzi+jZp6z9iQ4a91Rxs4WnLJpjO3xN0+1q6Aan6mCTdVnVbGr1 Va5Z3ymg0ggLEdlwQVoKUMTRRHFrRcV8wTbQ4FW7K/DH/xKKT4kOjWKho1Vo9XuMAogX 0eJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Noyvf9Qc; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f8si883051pfn.43.2019.07.18.21.39.57; Thu, 18 Jul 2019 21:40:13 -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=Noyvf9Qc; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728506AbfGSD7H (ORCPT + 99 others); Thu, 18 Jul 2019 23:59:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:58446 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728412AbfGSD7C (ORCPT ); Thu, 18 Jul 2019 23:59:02 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 408BC21855; Fri, 19 Jul 2019 03:59:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563508741; bh=OL3m8w6JGxXEraNlHHkKWsgAzjb1zehLVVJ4wLcvjK4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Noyvf9QcqpGUU9jPpQwgH1JpxRYb1KMQODZ14fH8cG9DbErhZm7nHSfrmlJi04l7q QIOTqmD8mz5Wr0Z9UQBsFwhscumvEAXGZ5LQxpK7YHFgecUNSHcTSkKSn8SY+qti2S t7KbtqZXPztLUDMl547ApaQ98+xVs9+mhBPCNATY= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Douglas Anderson , Sean Paul , Yakir Yang , Heiko Stuebner , Sasha Levin , dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org Subject: [PATCH AUTOSEL 5.2 062/171] drm/rockchip: Properly adjust to a true clock in adjusted_mode Date: Thu, 18 Jul 2019 23:54:53 -0400 Message-Id: <20190719035643.14300-62-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190719035643.14300-1-sashal@kernel.org> References: <20190719035643.14300-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Douglas Anderson [ 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