Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3787804ybi; Mon, 29 Jul 2019 12:37:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqzbqdk6lQFpoB0/+AIsVTcnFNLSGdndTPZvan+UCKKYRaCVDUedgfJcjWB0aKWh1jspyJhb X-Received: by 2002:a63:7c0d:: with SMTP id x13mr65852976pgc.360.1564429054306; Mon, 29 Jul 2019 12:37:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564429054; cv=none; d=google.com; s=arc-20160816; b=W/HkQWIcQVhG3cKLlak1m/W1iiADVMpxTP7pCUFU4hnA+9veEgg/iS/Twl61FR1u9f O0tHZYdnDI5+TCvt94y0GtU2aevwWXg5GMOC6UTCQLNJ5rHlh3WqDK5idYUneWbg0Rb7 98Cs2iItY60kztzb0G2R1z8GjS0GZYWyeyDloc8sP9Zh/GE8NZJdMza7F/58T9N4BDpK 4t1wcHsxHea/r4qD0YDWs3/JMH/i3xUv6edXey/H4eTFddxcCDgGeJlwaCGxr6KVm6TW k9xWvxd12Fy3uT2QIV/jN9NL5LPuYc9Q+ltXvH5wZT2Kg3WkSIG6WnsrUAOg5vCF834L yxow== 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=lh2vXhysDD3/HHFSu9zadpTBoyQgZjk/zQdNPTeR59A=; b=tljIA2CKy8qx9la8ydGCLfSeEHwOmS0lJTceu1ImBEsnnYZRaf6xe+YPRWHTST7a9S AxgGvRUgbQqdTWPWPUCROj2uEwFOd7J8brD1Db3+TEthFGV1bhINQskk0vtmi/DqdOvz bvzhvkYM1taM/sAe9oqrGWNeqcVJLWVlvcBRpcJbgV/EP2HFhkOB7H9SGPfn/yuY/P4r EpJ8C3sEkEiG4WnkkMQ/oncxCLonMAXgAyI4QND7o2VwpP+q4mAOaK+/fj0nRfHZaZ6a q5qVlDZ75yXDWNC0edzdFyxbRT+UKX+GwisoZA4uL6qDTpENNxqjjoWi2sUZbrBldkyc yfCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uQMgaW+O; 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 a65si1990323pgc.213.2019.07.29.12.37.19; Mon, 29 Jul 2019 12:37:34 -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=uQMgaW+O; 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 S2388558AbfG2Tfz (ORCPT + 99 others); Mon, 29 Jul 2019 15:35:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:50234 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388543AbfG2Tfx (ORCPT ); Mon, 29 Jul 2019 15:35:53 -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 E7674217D9; Mon, 29 Jul 2019 19:35:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428952; bh=nfaBBkNgqTdKnb9X8BDpa8JKZUUFpkBnv5zNHO/Pxv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uQMgaW+O0kIyeipChtOksdgENJzYVNrYFhDj6OcorELugI6z5+NZMZe0JFZf5Qmo6 gX2BNoux7ZoBqUtz+JmDcENW7XGb/H4HnAjiY2fBQSXWtqKhDK8bF7p/gzX5WMupVq aimw7amSr2vot1Levsuq01E8djDtYys2/J80NsYE= 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 4.14 239/293] drm/rockchip: Properly adjust to a true clock in adjusted_mode Date: Mon, 29 Jul 2019 21:22:10 +0200 Message-Id: <20190729190842.772487729@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@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 f1fa8d5c9b52..7010424b2f89 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -861,7 +861,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