Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1219826ybl; Wed, 8 Jan 2020 13:11:15 -0800 (PST) X-Google-Smtp-Source: APXvYqxb4HXl3ojUYpLDR4L+EysJL1egIZBd48eR35B8Ov/W0oMy7Z2wLVvSImjyLDdRFpGMRjLm X-Received: by 2002:aca:b7c5:: with SMTP id h188mr509690oif.100.1578517875161; Wed, 08 Jan 2020 13:11:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578517875; cv=none; d=google.com; s=arc-20160816; b=yxHAfmeHUQ1E7BwmNdaYjxEQ/aVHlhwEOy99drfabMrAUdnxRVRRpUlLmEbgMvv3Cd HD2HopITui3GzZxazkt5hsAFPkdUDV2R3vxiq+s/U8ij4i/PoBZGyIoXD5EsiZ+MHCZe sYfonHGEMjwNKfmfLHt7aIbo3FogqL9YzVO30Sj84u2862o4t68E87c+hUyBmSxuw+Im t3T4H1VmBTSZTzzessrRePrnoW5PPok8j8x5glJiIeyfPsZg9xjSeZ3r0TpENmTn1Le1 2tuWB0IvKB3abDDU4+qfHskJg7S82iHlIZtZAsu+bC+SDIFGt7iAzI6zmgJ/6dS6A9Pl XcTQ== 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:cc:to :references:in-reply-to:message-id:date:subject:from:dkim-signature; bh=kvEiAQjl/OxAvtM+IX3ZURXJtqGWvCvtd2Q+tKQM1BA=; b=j+CRvhEXHwgFwR8wjCp0q05m8borQChtzcc17ae6qnUXRkUftjIP9GhPHx3gSLXJ8d bn9nocdo8K8nK7yXfzR+N3jprB2VsABFqafzJQZuSF8EXiVinNJB8a7mrmgW/3heSv+e +4VDa5Ion7Gq6u4ehKa/LvM0swq4AaaXFxzxdBmLZmHJEjQRA7CoAuuujuf+sp/YmVBq 1A0rqPqxk7Mf8OJQlg75t1P4V38Nz+7Ro/E6D6C6LCNf4w4ejLjWZ3RfYGsdo7TJjDqT CXyXTpRw4rUeKK8fv3IGPQwaQfUihp0jCMVdzVjYVSwcgOxYKfrG5mE66oYHSzyn7z+h DMVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kwiboo.se header.s=001 header.b=iz+qXBkM; 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 p26si2657012oto.240.2020.01.08.13.11.01; Wed, 08 Jan 2020 13:11:15 -0800 (PST) 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=@kwiboo.se header.s=001 header.b=iz+qXBkM; 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 S1727629AbgAHVIf (ORCPT + 99 others); Wed, 8 Jan 2020 16:08:35 -0500 Received: from o1.b.az.sendgrid.net ([208.117.55.133]:28580 "EHLO o1.b.az.sendgrid.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726836AbgAHVHt (ORCPT ); Wed, 8 Jan 2020 16:07:49 -0500 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: =?us-ascii?Q?TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxA?= =?us-ascii?Q?fZekEeQsTe+RrMu3cja6a0hx+0AeuHEQuiq3zZ5?= =?us-ascii?Q?XraD34ofAE4bYf4Q8jqDlwDF8lHreCjGZjdQ8I6?= =?us-ascii?Q?ZTvRsXMwExxThJZrfy5gYdtShlKcwsO0C4cJXA3?= =?us-ascii?Q?egBYZs8UAeewURAlvbdKCzgplHJ+hmtJoRQLNE1?= =?us-ascii?Q?3+gcaj28nWaV1UV1F=2FhtmA6PByNn=2FP=2F7NzhS9cI?= =?us-ascii?Q?6cyFVhvBJk2b7LEPpkVEQ=3D=3D?= To: Heiko Stuebner , Sandy Huang Cc: Jonas Karlman , Kishon Vijay Abraham I , Zheng Yang , linux-rockchip@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, -- 2.17.1