U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dang Huynh <danct12@riseup.net>
To: Anatolij Gustschin <agust@denx.de>,
	Simon Glass <sjg@chromium.org>,
	 Philipp Tomsich <philipp.tomsich@vrull.eu>,
	 Kever Yang <kever.yang@rock-chips.com>,
	Tom Rini <trini@konsulko.com>,
	 Nicolas Frattaroli <frattaroli.nicolas@gmail.com>,
	 Jonas Karlman <jonas@kwiboo.se>, Ondrej Jirman <megi@xff.cz>,
	 Dragan Simic <dsimic@manjaro.org>,
	Svyatoslav Ryhel <clamor95@gmail.com>,
	 Lukasz Majewski <lukma@denx.de>,
	Sean Anderson <seanga2@gmail.com>
Cc: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>,
	u-boot@lists.denx.de,  Piotr Zalewski <pZ010001011111@proton.me>,
	Dang Huynh <danct12@riseup.net>
Subject: [PATCH v3 12/12] clk: rockchip: rk3568: Use assigned VPLL clock when possible
Date: Sat, 12 Apr 2025 21:27:14 +0700	[thread overview]
Message-ID: <20250412-vop2-pt2-v3-12-7c796db335e9@riseup.net> (raw)
In-Reply-To: <20250412-vop2-pt2-v3-0-7c796db335e9@riseup.net>

This matches how VPLL is configured under Linux and avoid weird
behaviors when VPLL is reconfigured under Linux.

Signed-off-by: Dang Huynh <danct12@riseup.net>
---
 drivers/clk/rockchip/clk_rk3568.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/rockchip/clk_rk3568.c b/drivers/clk/rockchip/clk_rk3568.c
index 533031caead6818fe41774c9efee969fdd428dbc..cd0e24d77dcc5ce69b75f23eb6d62582b452a986 100644
--- a/drivers/clk/rockchip/clk_rk3568.c
+++ b/drivers/clk/rockchip/clk_rk3568.c
@@ -1820,7 +1820,11 @@ static ulong rk3568_dclk_vop_set_clk(struct rk3568_clk_priv *priv,
 			     ((div - 1) << DCLK0_VOP_DIV_SHIFT));
 		rk3568_pmu_pll_set_rate(priv, HPLL, div * rate);
 	} else if (sel == DCLK_VOP_SEL_VPLL) {
-		div = DIV_ROUND_UP(RK3568_VOP_PLL_LIMIT_FREQ, rate);
+		if (priv->vpll_hz)
+			div = DIV_ROUND_UP(priv->vpll_hz, rate);
+		else
+			div = DIV_ROUND_UP(RK3568_VOP_PLL_LIMIT_FREQ, rate);
+
 		rk_clrsetreg(&cru->clksel_con[conid],
 			     DCLK0_VOP_DIV_MASK | DCLK0_VOP_SEL_MASK,
 			     (DCLK_VOP_SEL_VPLL << DCLK0_VOP_SEL_SHIFT) |

-- 
2.49.0


      parent reply	other threads:[~2025-04-12 14:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-12 14:27 [PATCH v3 00/12] Rockchip VOP2 support Dang Huynh
2025-04-12 14:27 ` [PATCH v3 01/12] video: rockchip: dw-mipi-dsi: Depend on CONFIG_VIDEO_BRIDGE Dang Huynh
2025-04-12 14:27 ` [PATCH v3 02/12] video: rockchip: dw_mipi_dsi: Improve pixel clock calculations Dang Huynh
2025-04-12 14:27 ` [PATCH v3 03/12] video: rockchip: dw_mipi_dsi: Proceed when external PHY is not defined Dang Huynh
2025-04-12 14:27 ` [PATCH v3 04/12] video: rockchip: dw-mipi-dsi: Add get_display_timing support Dang Huynh
2025-04-12 14:27 ` [PATCH v3 05/12] video: Add BOE TH101MB31IG002-28A MIPI-DSI panel Dang Huynh
2025-04-12 14:27 ` [PATCH v3 06/12] video: rockchip: Add VOP2 support Dang Huynh
2025-04-12 14:27 ` [PATCH v3 07/12] video: rockchip: vop2: Add video bridge support Dang Huynh
2025-04-12 14:27 ` [PATCH v3 08/12] dts: rockchip: rk356x: Prerelocate VOP in U-Boot proper Dang Huynh
2025-04-13 14:33   ` Jonas Karlman
2025-04-15 13:15     ` Dang Huynh
2025-04-12 14:27 ` [PATCH v3 09/12] configs: quartz64: Enable vidconsole Dang Huynh
2025-04-12 14:27 ` [PATCH v3 10/12] video: rockchip: Add HDMI support for RK3568 Dang Huynh
2025-04-13 15:10   ` Jonas Karlman
2025-04-12 14:27 ` [PATCH v3 11/12] configs: pinetab2-rk3566: Enable video and USB keyboard Dang Huynh
2025-04-13 15:26   ` Jonas Karlman
2025-04-15 13:29     ` Dang Huynh
2025-04-15 15:52       ` Jonas Karlman
2025-04-19  4:22         ` Dang Huynh
2025-04-12 14:27 ` Dang Huynh [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250412-vop2-pt2-v3-12-7c796db335e9@riseup.net \
    --to=danct12@riseup.net \
    --cc=agust@denx.de \
    --cc=clamor95@gmail.com \
    --cc=dsimic@manjaro.org \
    --cc=frattaroli.nicolas@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=kever.yang@rock-chips.com \
    --cc=lukma@denx.de \
    --cc=megi@xff.cz \
    --cc=pZ010001011111@proton.me \
    --cc=philipp.tomsich@vrull.eu \
    --cc=seanga2@gmail.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox