From patchwork Wed Jan 8 21:07:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 11324817 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CEF846C1 for ; Wed, 8 Jan 2020 21:12:59 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AD33920643 for ; Wed, 8 Jan 2020 21:12:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="iz+qXBkM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AD33920643 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kwiboo.se Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D732E6E34C; Wed, 8 Jan 2020 21:12:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from o1.b.az.sendgrid.net (o1.b.az.sendgrid.net [208.117.55.133]) by gabe.freedesktop.org (Postfix) with ESMTPS id 354F86E34B for ; Wed, 8 Jan 2020 21:12:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=from:subject:in-reply-to:references:to:cc:content-type: content-transfer-encoding; s=001; bh=kvEiAQjl/OxAvtM+IX3ZURXJtqGWvCvtd2Q+tKQM1BA=; b=iz+qXBkMROU4Y0sSg912VZwSCEh8GA+X8oCo3Y57gxmZst4OLeQbVHQsMjhFguhWx4hY qbFl+c1QHhCJ5vaNXZhZmyaKP/Fpz4pj5aSmEeHGmFTl8cFUZCN2hvzqXMfNqMI2HovO4s VUXaWV8kL4+X6BoSOPYzkTnnULMVZKiBY= Received: by filterdrecv-p3mdw1-56c97568b5-x76nl with SMTP id filterdrecv-p3mdw1-56c97568b5-x76nl-20-5E1644A3-76 2020-01-08 21:07:48.0331912 +0000 UTC m=+1974281.103082123 Received: from bionic.localdomain (unknown [98.128.173.80]) by ismtpd0005p1lon1.sendgrid.net (SG) with ESMTP id WNEkziO3RYi0w9ydGOW-yA Wed, 08 Jan 2020 21:07:47.836 +0000 (UTC) From: Jonas Karlman Subject: [PATCH v2 02/14] phy/rockchip: inno-hdmi: round fractal pixclock in rk3328 recalc_rate Date: Wed, 08 Jan 2020 21:07:48 +0000 (UTC) Message-Id: <20200108210740.28769-3-jonas@kwiboo.se> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200108210740.28769-1-jonas@kwiboo.se> References: <20200108210740.28769-1-jonas@kwiboo.se> X-SG-EID: TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxAfZekEeQsTe+RrMu3cja6a0hx+0AeuHEQuiq3zZ5XraD34ofAE4bYf4Q8jqDlwDF8lHreCjGZjdQ8I6ZTvRsXMwExxThJZrfy5gYdtShlKcwsPyMUVwGEDO0mcoFMv5NXaYglR7eOOgVUr+llj+QQWG2hwdt3pfOHwHEkghobRiZDVX6+VDiyB9jSGukUbUj1gz/jAbwFkVntI22Log4C3fwg== To: Heiko Stuebner , Sandy Huang X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jonas Karlman , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Kishon Vijay Abraham I , linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Zheng Yang MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Zheng Yang inno_hdmi_phy_rk3328_clk_recalc_rate() is returning a rate not found in the pre pll config table when the fractal divider is used. This can prevent proper power_on because a tmdsclock for the new rate is not found in the pre pll config table. Fix this by saving and returning a rounded pixel rate that exist in the pre pll config table. Fixes: 53706a116863 ("phy: add Rockchip Innosilicon hdmi phy") Signed-off-by: Zheng Yang Signed-off-by: Jonas Karlman --- drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c index b0ac1d3ee390..093d2334e8cd 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c @@ -745,10 +745,12 @@ unsigned long inno_hdmi_phy_rk3328_clk_recalc_rate(struct clk_hw *hw, do_div(vco, (nd * (no_a == 1 ? no_b : no_a) * no_d * 2)); } - inno->pixclock = vco; - dev_dbg(inno->dev, "%s rate %lu\n", __func__, inno->pixclock); + inno->pixclock = DIV_ROUND_CLOSEST((unsigned long)vco, 1000) * 1000; - return vco; + dev_dbg(inno->dev, "%s rate %lu vco %llu\n", + __func__, inno->pixclock, vco); + + return inno->pixclock; } static long inno_hdmi_phy_rk3328_clk_round_rate(struct clk_hw *hw,