From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 398C3C79F8C for ; Mon, 7 Sep 2026 03:21:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7QobthMK5G9I2A7NFBQ1zUqUk9L+SHrltkEwmK7SAUg=; b=gY4Uqu7XsIwpK1 OHPGubJlPZnS5wbWaPemL4cIYGic+W3h8e5AJysIKrqtqo8ECAZrT+bh/sKN8IzzjVLDlkYzUonhZ MMRPx67IA7YAzcbuNodpEBHTl/vej7nViPldsniE1c43BvSS2ud6iY0HsEhrwxlLPi8aGsV18BCvE GsFrHXJKMBSExDqBwnyRYlMnhb72Sy/FshXaF8E/ks8M4R2uCN3i3yHTwZeIDbWtAh6RI5v1O7dCj /pBGwebgVP2dvK0aCuKLM1PNvs2WdlJLkwH0J9lXN76RI7i/TmXZBZpLUq8KVyNF4CPSdYXqmKzkt kbvWwhjQiJ7nmzNhjhKg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x3Puq-00000005l82-0mNt; Mon, 07 Sep 2026 03:21:04 +0000 Received: from mail-m16023653228.xmail.ntesmail.com ([160.236.53.228]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x3Pum-00000005l6z-19zv; Mon, 07 Sep 2026 03:21:01 +0000 Received: from [172.16.12.90] (unknown [61.154.14.86]) by smtp.qiye.163.com (Hmail) with ESMTP id 4cbfd4e16; Mon, 7 Sep 2026 11:20:53 +0800 (GMT+08:00) Message-ID: <6e96691c-5d52-4e00-a15b-2a2b21f65fe3@rock-chips.com> Date: Mon, 7 Sep 2026 11:20:51 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 16/19] phy: rockchip: inno-hdmi: Use the common Innosilicon PHY helpers To: Michal Wilczynski Cc: Vinod Koul , Neil Armstrong , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Andrzej Hajda , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , David Airlie , Simona Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Lee Jones , Andy Yan , Philipp Zabel , Emil Renner Berthing , Hal Feng , Michael Turquette , Stephen Boyd , Brian Masney , Heiko Stuebner , Conor Dooley , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Dominique Belhachemi , Brian Masney , Jerome Brunet , linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, mfd@lists.linux.dev, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, Andy Yan , Marek Szyprowski , Maud Spierings , Graham Markall , Icenowy Zheng References: <20260904-jh7110-clean-send-v3-0-484f9ae72715@samsung.com> <20260904-jh7110-clean-send-v3-16-484f9ae72715@samsung.com> Content-Language: en-US From: Chaoyi Chen In-Reply-To: <20260904-jh7110-clean-send-v3-16-484f9ae72715@samsung.com> X-HM-Tid: 0aa079e20e8103a7kunmae2afc193611e7 X-HM-MType: 1 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWRgWCB1ZQUpXWS1ZQUlXWQ8JGhUIEh9ZQVkaTEsZVh4aS0xLGBgaGkgdTlYVFA kWGhdVEwETFhoSFyQUDg9ZV1kYEgtZQVlNSlVKTk9VSk9VQ01ZV1kWGg8SFR0UWUFZT0tIVUpLSE pKQkxVSktLVUpCS0tZBg++ DKIM-Signature: a=rsa-sha256; b=J+pH9aqjliwdMdP6kenDUDgsFo2GFjCulzu+UU8+Z1ovBsC62FGnk1cwrTWEL9+KGDNq4sdEgsK8gJdOHqlSNOH6d50lhGEQHf8B2L81S4cAX6catva+VVg4ikamy9CzRb2ncewysvwvV2ttkQX5ECW8n63q1jQhUmujT/P3DbQ=; c=relaxed/relaxed; s=default; d=rock-chips.com; v=1; bh=TOMJc+Y8LFdspZYjJ1TLplIIrOzasQxKAI43UPHgqhM=; h=date:mime-version:subject:message-id:from; X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260906_202100_632167_2ADB8037 X-CRM114-Status: GOOD ( 15.25 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Hello Michal, On 9/4/2026 9:27 PM, Michal Wilczynski wrote: > The RK3328 pre-PLL programming, its table lookup and its recalc_rate and > determine_rate implementations are the generic Innosilicon ones, so drop > the local copies and use the shared helpers instead. > > The RK3228 pre-PLL sits at different register addresses, so it keeps its > own register level code and only shares the table lookup. > > The now unused RK3328 pre-PLL register macros go with it, as does the > local pre-PLL config lookup wrapper; both call sites already have the > TMDS clock to hand and call inno_hdmi_phy_pre_pll_lookup() directly. > > The RK3328 recalc_rate used to log the pre-PLL output as "vco". The > shared helper logs it too, and reports the actual VCO frequency > alongside the rate, which is the value with the 1.4-3.2 GHz constraint. > > The register writes, their order and the values written are unchanged. > No functional change intended. > > Signed-off-by: Michal Wilczynski > --- > drivers/phy/rockchip/Kconfig | 1 + > drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 165 ++++---------------------- > 2 files changed, 26 insertions(+), 140 deletions(-) > [...] > > @@ -915,39 +858,11 @@ unsigned long inno_hdmi_phy_rk3328_clk_recalc_rate(struct clk_hw *hw, > unsigned long parent_rate) > { > struct inno_hdmi_phy *inno = to_inno_hdmi_phy(hw); > - unsigned long frac; > - u8 nd, no_a, no_b, no_d; > - u64 vco; > - u16 nf; > - > - nd = inno_read(inno, 0xa1) & RK3328_PRE_PLL_PRE_DIV_MASK; > - nf = ((inno_read(inno, 0xa2) & RK3328_PRE_PLL_FB_DIV_11_8_MASK) << 8); > - nf |= inno_read(inno, 0xa3); > - vco = parent_rate * nf; > - > - if (!(inno_read(inno, 0xa2) & RK3328_PRE_PLL_FRAC_DIV_DISABLE)) { > - frac = inno_read(inno, 0xd3) | > - (inno_read(inno, 0xd2) << 8) | > - (inno_read(inno, 0xd1) << 16); > - vco += DIV_ROUND_CLOSEST(parent_rate * frac, (1 << 24)); > - } > - > - if (inno_read(inno, 0xa0) & RK3328_PCLK_VCO_DIV_5_MASK) { > - do_div(vco, nd * 5); > - } else { > - no_a = inno_read(inno, 0xa5) & RK3328_PRE_PLL_PCLK_DIV_A_MASK; > - no_b = inno_read(inno, 0xa5) & RK3328_PRE_PLL_PCLK_DIV_B_MASK; > - no_b >>= RK3328_PRE_PLL_PCLK_DIV_B_SHIFT; > - no_b += 2; > - no_d = inno_read(inno, 0xa6) & RK3328_PRE_PLL_PCLK_DIV_D_MASK; > - > - do_div(vco, (nd * (no_a == 1 ? no_b : no_a) * no_d * 2)); > - } > > - inno->pixclock = DIV_ROUND_CLOSEST((unsigned long)vco, 1000) * 1000; > + inno->pixclock = inno_hdmi_phy_pre_pll_recalc_rate(&inno->pre_pll, > + parent_rate); > > - dev_dbg(inno->dev, "%s rate %lu vco %llu\n", > - __func__, inno->pixclock, vco); > + dev_dbg(inno->dev, "%s rate %lu\n", __func__, inno->pixclock); > The printing here is redundant, because it has already been handled in inno_hdmi_phy_pre_pll_recalc_rate(). Reviewed-by: Chaoyi Chen > return inno->pixclock; > } -- Best, Chaoyi _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv