Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1481114rwd; Thu, 15 Jun 2023 11:04:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7nyZ9qrrjzSDwswuEWcf3/dr/P/0jHcWCiZu9IDbgVpaBsMFmHlTOskJKC6SAUkthVQ/j3 X-Received: by 2002:a17:906:fe46:b0:974:1838:88d8 with SMTP id wz6-20020a170906fe4600b00974183888d8mr16833319ejb.57.1686852264883; Thu, 15 Jun 2023 11:04:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686852264; cv=none; d=google.com; s=arc-20160816; b=TTtJHPizoRHcKaVXR4csvroeR7V4H6oAFkdHbNbYQMoqLv7ZZ4nC4C075rFRKClI87 nT/ahY7JHWmtt18vDWeUcV0U9dfu7WYI1q2+Y4oe7JZZxiN70psycjO6fOwems53O2z3 7fk7AmuPqWZEBDP8B5pPQ4wvYgG8B2aFSvjo80OoqVo6EnVCO13fobhXb0ZZ0j2XKRUm ygqEDyX6bxTsSsgxwVdq+P39TLBvIz+BTn04RZ69N6qDNduK3AOBc8L3TZ1UXhp4gT8c yMsFONcTKczXTycDvlv506wFvGxJzaAsN1FgxqEg6BHi9b1sEokSL/aC4mnwJmWMrNVp tH4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:mime-version :references:in-reply-to:message-id:date:subject:from:dkim-signature; bh=8ooaJ/fJ3+j9OCaEbuWbdYU2/7sjkqEhUDQuCiE/jIU=; b=B8BoIPnaTCHlgY2HieU/NW569nIohU9XVVHLVRLagpFroLjs/pzfl97EOyAKAI+bMl 3OeKlRJAuqKKCp/jKYDNWV8yLwGY/QvZIGwi15uRJttESqpLFI56MCIhw8xig6KmVNoF wg+vIBCb7s67YzhaRMpjHrJuAiynQKa9RNQyCqjRRhauuUwG9szf/lsY3066rHpkUdaa eKUg0Oe3UIH+IO1H1buoG1VNDVRKpLNws4xaGde7vIo5Awc1BGQCpaLf3yNgTQQKRs46 Pt7cHZDS7rEjJFYGvEkJi45+RCTIAs/9ZbGRLyX3oSI7pAPpCUnjF/29XqkV5nv8z5So W+Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kwiboo.se header.s=s1 header.b=NRpURhpC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=kwiboo.se Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ov30-20020a170906fc1e00b00982a0f134b0si1110972ejb.40.2023.06.15.11.04.00; Thu, 15 Jun 2023 11:04:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kwiboo.se header.s=s1 header.b=NRpURhpC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=kwiboo.se Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235649AbjFORPa (ORCPT + 99 others); Thu, 15 Jun 2023 13:15:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230247AbjFORP3 (ORCPT ); Thu, 15 Jun 2023 13:15:29 -0400 Received: from s.wrqvtbkv.outbound-mail.sendgrid.net (s.wrqvtbkv.outbound-mail.sendgrid.net [149.72.123.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 743D2199 for ; Thu, 15 Jun 2023 10:15:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type:cc:content-type:from:subject:to; s=s1; bh=8ooaJ/fJ3+j9OCaEbuWbdYU2/7sjkqEhUDQuCiE/jIU=; b=NRpURhpCccrMdm7W1pDACKs/yei/UGUXGihmLRCubNDdsy4SP5ySgOshUxQHX0PygiF9 qjKpT7tTGUI0wkXm0Ag+Gnr5KvQ1BiewqOUkT2GuOzby5GquhHmwAZvYW28C6PSYaRtS0k 0W/5eaQybcD6ByNQ+s2x07Z9g65gJhjfz7nn9KPab6NlT3gAVPV753UMxdDYPbSvSzckJb /VxLRTo80LHb36mrh5o33voD4e3l0sPkRmb7kjyVvbkRVu3NDBwqzlr4PXVqYGFe8xEbzT vgJV7qhQhYVKlgduYSDd93cfh6bgEdR695Dc04W0+usTM5dmkcGxqartrTiu8Q1g== Received: by filterdrecv-8684c58db7-nd6mk with SMTP id filterdrecv-8684c58db7-nd6mk-1-648B45FA-20 2023-06-15 17:10:18.776312499 +0000 UTC m=+3087108.038527950 Received: from bionic.localdomain (unknown) by geopod-ismtpd-2 (SG) with ESMTP id zaywGFtjRWCk_6Nh7Lu_Fw Thu, 15 Jun 2023 17:10:18.316 +0000 (UTC) From: Jonas Karlman Subject: [PATCH v4 2/6] phy/rockchip: inno-hdmi: round fractal pixclock in rk3328 recalc_rate Date: Thu, 15 Jun 2023 17:10:19 +0000 (UTC) Message-Id: <20230615171005.2251032-3-jonas@kwiboo.se> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230615171005.2251032-1-jonas@kwiboo.se> References: <20230615171005.2251032-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxA?= =?us-ascii?Q?fZekEeQsTe+RrMu3cja6a0h3SYu5hEq4KgBns7F?= =?us-ascii?Q?iO7aTPDjxDTYhEBYiJEY=2FNOI1OekR9=2FtXSs=2F5zA?= =?us-ascii?Q?LrTs1XRDkOP3mQmWIORiMAV6wOjsV7lWurnKala?= =?us-ascii?Q?Jb6cMvIYPAupx+yroKrTd1A1fAObONiD1MM=2Fe1I?= =?us-ascii?Q?cyVvxa5d6RUYE4hakJ=2FND=2F2nWw1kaIUd5JSn3o?= To: Vinod Koul , Kishon Vijay Abraham I , Heiko Stuebner , Zheng Yang Cc: Alex Bee , linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Jonas Karlman , Kishon Vijay Abraham I X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 --- v3: - no change 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 f348e5347d81..7d412f771f6c 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.40.1