Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3793340ybi; Mon, 29 Jul 2019 12:44:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqzH0494F5I6TeB3byXzo+r5SWODbJwkzBzqRzFSVKLIA+FIM5eWuvXu2gM0hw35v3xbEGcM X-Received: by 2002:a17:90a:2385:: with SMTP id g5mr116314817pje.12.1564429469003; Mon, 29 Jul 2019 12:44:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564429468; cv=none; d=google.com; s=arc-20160816; b=Cau2sK56+myy41A7OgLcSh/W9VyHegabiXCKSBiPHh72vWVh+1qfbvxLF/7cJkoaMk GONDadxNVG3Gu6Tp2p242puyjXqqzv1nllCU6tQ17CO+XyNFDUEldAKlFtx7tlLRj8vD +0M6rrm5WycVZ/dORhnSrikISIGdGNLVxYzRckKF4re+01YG4K1R9vCMqXARIqeU8D9L OSxyVKjD0znCM659XjKzddng1cGKNETIdpmvMcIubcCcrMMhmxnGzDjQBckxD4qztBME jLDhauJg+bRTGFWl27jvJm+/Mds75R087Wds1zcnalQRm8cMqWI9Ns7LkLflkpY6/ElP TwyQ== 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=vtn2o0dwQkdqhh+XhBZp3Pl1etNg+I0w0em8cag9qIk=; b=uB5cPtfjuAC5qZIJFfTfxaJ62n/fFbeIOQKjBzCN42eItEL7l+aIcW2wnJuOWBfUN6 qXjieMELTnWFKav/wSY+Y9PQDCUxf0Bf0kYLVzNkrrppsnwcaUa6GiluVKH60JHMrhx7 ACW1EVE6plIdv2esrAUv4/S+vvdGpsJIf3gQs/uY0L4A+60kLHl9vqQJflGYZs4NRLOU YVfHwxHJr1M7WjmjfyJN39RpnC6x2ixr+LBx94UnA1of8gGyX9xpNIHKvUYT7NJ6lCYy 6ENCEkb2GTMxEgZ87lN/ecgvvBPuvglJY7BcxgZjrq4YBPR0aQhYXnOCjNEMvgbNnJc4 ZHHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=k+GH9r+f; 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 r190si27186009pfr.102.2019.07.29.12.44.14; Mon, 29 Jul 2019 12:44:28 -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=k+GH9r+f; 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 S2389585AbfG2TnD (ORCPT + 99 others); Mon, 29 Jul 2019 15:43:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:59104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389581AbfG2TnB (ORCPT ); Mon, 29 Jul 2019 15:43:01 -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 6DC4B2171F; Mon, 29 Jul 2019 19:43:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429380; bh=X5Xg3XBNCA1cU1UmBXIds2rJiSWnOVbdRjrzqcUfyTI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k+GH9r+f5ErBhuIpSwsgycSksBPL2+ZM1nCfAeTR1hLknVAOPKNfcDrH86M9cv+Dc YySkMJa/YSmMOJZLOn2hnSl0IBHZmhXWAQa2QLb7nUP1/i0nK236bqyNw15h9S2ytq a5In8Zn0vML9SjO6ah5t4ANM3gimlpfe9VHjk6vg= 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.19 031/113] drm/rockchip: Properly adjust to a true clock in adjusted_mode Date: Mon, 29 Jul 2019 21:21:58 +0200 Message-Id: <20190729190703.328928636@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190655.455345569@linuxfoundation.org> References: <20190729190655.455345569@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 f8f9ae6622eb..873624a11ce8 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -880,7 +880,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