From d4bd42a4b27a32ffe2052a658b0df9a5ba68ee2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= Date: Mon, 14 Aug 2023 07:28:11 +0200 Subject: [PATCH 212/464] clk: sunxi-ng: sun50i-a64: Switch parent of MIPI-DSI to periph0(1x) This makes video0(1x) clock less constrained, and improves compatibility with external monitors on Pinephone when using both internal display and HDMI output at once. Signed-off-by: Ondrej Jirman --- drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c index 93beedb0428e..4d35c3dd05d0 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c +++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c @@ -954,6 +954,8 @@ static struct ccu_rate_reset_nb sun50i_a64_pll_video0_reset_tcon0_nb = { .common = &pll_video0_clk.common, }; +#define CCU_MIPI_DSI_CLK 0x168 + static int sun50i_a64_ccu_probe(struct platform_device *pdev) { void __iomem *reg; @@ -970,9 +972,15 @@ static int sun50i_a64_ccu_probe(struct platform_device *pdev) writel(val | (0 << 16), reg + SUN50I_A64_PLL_AUDIO_REG); ret = of_property_read_u32_index(of_chosen, "p-boot,framebuffer-start", 0, &val); - if (ret) + if (ret) { writel(0x515, reg + SUN50I_A64_PLL_MIPI_REG); + /* Set MIPI-DSI clock parent to periph0(1x), so that video0(1x) is free to change. */ + val = readl(reg + CCU_MIPI_DSI_CLK); + val &= 0x30f; + val |= (2 << 8) | ((4 - 1) << 0); /* M-1 */ + writel(val, reg + CCU_MIPI_DSI_CLK); + } /* Set PLL MIPI as parent for TCON0 */ val = readl(reg + SUN50I_A64_TCON0_CLK_REG); val &= ~GENMASK(26, 24); -- 2.34.1