Re: [PATCH 0/4] clk/drm: renesas: Improve RZ/V2H(P) MIPI DSI PLL parameter selection
From: Tommaso Merciai
Date: Fri Dec 04 2026 - 04:59:02 EST
Hi Prabhakar,
Thanks for your series.
On Tue, Nov 03, 2026 at 05:20:53PM +0000, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
>
> Hi all,
>
> On RZ/V2H(P) and RZ/V2N the DSI HS clock is derived from the pixel clock
> produced by the CPG PLLDSI and its divider (HS clock = pixel clock *
> bpp / lanes), and the PLL in the DSI block has to reproduce it to within
> 0.5 Hz. A display mode is usable only if a single set of CPG parameters
> satisfies both the CPG and the DSI PLL constraints, but the two were
> checked one after the other instead of together:
>
> - Mode validation took the CPG parameters with the smallest frequency
> error and only then checked the DSI PLL. A divider that lost on CPG
> error alone was never tried against the DSI PLL, so modes were
> rejected although another divider or PLL setting would have worked.
> - The PLLDSI divider's .determine_rate() runs its own search when the
> clock is set, so it can pick parameters other than the ones the DSI
> driver validated.
>
> The first two patches add the clock-side support, the last two make the
> DSI driver use it:
>
> 1. Let the DSI driver cache the CPG divider parameters it validated,
> per PLLDSI instance, and have .determine_rate() reuse them when the
> requested rate matches.
> 2. Add rzv2h_cpg_get_pll_pars_validate(), which offers each candidate
> to a callback and returns the first one it accepts.
> rzv2h_get_pll_pars() becomes a wrapper passing a NULL validator, so
> existing callers are unchanged.
> 3. Evaluate every divider against the DSI PLL limits, keep the one with
> the smallest DSI PLL error and hand it to the CPG using the cache
> from patch 1.
> 4. If no divider gives a usable pair, search again using patch 2 and
> take the first CPG candidate that is at most 50 Hz off at the PLLDSI
> output and gives a DSI HS clock error below 0.5 Hz. 50 Hz is at most
> 2 ppm of the 25 MHz minimum PLLDSI output, so the pixel clock error
> stays negligible.
>
> The cache in patch 1 is indexed by PLLDSI instance and shared by all CPG
> instances, as the DSI driver only knows which instance it targets. If
> there is a cleaner way to hand the parameters over to the CPG, I am
> happy to rework it.
>
> Testing
> -------
> "modetest -c" on [RZ/V2H EVK] (DSI -> ADV7535 -> HDMI, 4 lanes,
> [monitor]) lists 27 modes instead of 21. No mode is lost, and these are
> the newly usable ones:
>
> mode refresh pixel clock
> 1920x1080 59.94 Hz 148352 kHz
> 1280x720 59.94 Hz 74176 kHz
> 720x480 60.00 Hz 27027 kHz
> 640x480 60.00 Hz 25200 kHz
> 640x480 59.94 Hz 25175 kHz
> 720x400 70.08 Hz 28320 kHz
>
> Dependencies
> ------------
> Based on next-20261102 plus two patches from Tommaso that are not in
> that tree:
>
> [1] clk: renesas: rzv2h: Forward PLLDSI mux rate requests to the parent
> [2] clk: renesas: rzv2h: Report the DSI duty cycle from the LVDS divider
>
> [1] https://lore.kernel.org/all/20261029-tm-ssgrlpcsrc-2083-v5-clk-duty-fixes-v1-1-47f23de6bdb1@xxxxxxxxxxxxxx/
> [2] https://lore.kernel.org/all/20261029-tm-ssgrlpcsrc-2083-v5-clk-duty-fixes-v1-2-47f23de6bdb1@xxxxxxxxxxxxxx/
>
> Geert, Biju: I would suggest taking everything via renesas-clk
> with an Ack from the DRM side, or providing an immutable branch with
> patches 1-2 for the DRM tree. Please let me know which you prefer.
I tested this series on my RZ/G3E display tree, where I have also DSI
support. Test was done using the following display pipeline:
DU0 | DU1 -> DSI
All 29 modes of my display are working fine.
Here my results:
=== CRTC 45 (index 0, profile dsi) .plldsi0 -> .plldsi0_csdiv -> .smux2_dsi0_clk -> dsi_0_vclk1, DU dot clock lcdc_0_clk_d ===
IDX MODE REQUESTED[Hz] plldsi0[Hz] plldsi0_csdiv[Hz] smux2_dsi0_clk[Hz] dsi_0_vclk1[Hz] ERROR[Hz] RESULT
0 1920x1080-60.00 148500000 297000000 148500000 148500000 148500000 0 OK
1 1920x1080-59.94 148352000 890111999 148352000 148352000 148352000 0 OK
2 1920x1080-50.00 148500000 297000000 148500000 148500000 148500000 0 OK
3 1680x1050-59.88 119000000 238000000 119000000 119000000 119000000 0 OK
4 1600x900-60.00 108000000 216000000 108000000 108000000 108000000 0 OK
5 1280x1024-75.02 135000000 270000000 135000000 135000000 135000000 0 OK
6 1280x1024-60.02 108000000 216000000 108000000 108000000 108000000 0 OK
7 1440x900-59.90 88750000 177500000 88750000 88750000 88750000 0 OK
8 1280x800-59.91 71000000 142000000 71000000 71000000 71000000 0 OK
9 1152x864-75.00 108000000 216000000 108000000 108000000 108000000 0 OK
10 1280x720-60.00 74250000 148500000 74250000 74250000 74250000 0 OK
11 1280x720-59.94 74176000 445056000 74176000 74176000 74176000 0 OK
12 1280x720-50.00 74250000 148500000 74250000 74250000 74250000 0 OK
13 1024x768-75.03 78750000 157500000 78750000 78750000 78750000 0 OK
14 1024x768-70.07 75000000 150000000 75000000 75000000 75000000 0 OK
15 1024x768-60.00 65000000 130000000 65000000 65000000 65000000 0 OK
16 832x624-74.55 57284000 114568001 57284001 57284001 57284001 1 OK
17 800x600-75.00 49500000 99000000 49500000 49500000 49500000 0 OK
18 800x600-72.19 50000000 100000000 50000000 50000000 50000000 0 OK
19 800x600-60.32 40000000 80000000 40000000 40000000 40000000 0 OK
20 800x600-56.25 36000000 72000000 36000000 36000000 36000000 0 OK
21 720x576-50.00 27000000 54000000 27000000 27000000 27000000 0 OK
22 720x480-60.00 27027000 54054001 27027001 27027001 27027001 1 OK
23 720x480-59.94 27000000 54000000 27000000 27000000 27000000 0 OK
24 640x480-75.00 31500000 63000000 31500000 31500000 31500000 0 OK
25 640x480-72.81 31500000 63000000 31500000 31500000 31500000 0 OK
26 640x480-66.67 30240000 60479999 30240000 30240000 30240000 0 OK
27 640x480-60.00 25200000 352799988 25199999 25199999 25199999 1 OK
28 640x480-59.94 25175000 50349998 25174999 25174999 25174999 1 OK
29 720x400-70.08 28320000 169919998 28320000 28320000 28320000 0 OK
lcdc_0_clk_d enable_count:
=== CRTC 60 (index 1, profile dsi) .plldsi1 -> .plldsi1_csdiv -> .smux2_dsi1_clk -> dsi_0_vclk2, DU dot clock lcdc_1_clk_d ===
IDX MODE REQUESTED[Hz] plldsi1[Hz] plldsi1_csdiv[Hz] smux2_dsi1_clk[Hz] dsi_0_vclk2[Hz] ERROR[Hz] RESULT
0 1920x1080-60.00 148500000 297000000 148500000 148500000 148500000 0 OK
1 1920x1080-59.94 148352000 296704010 148352005 148352005 148352005 5 OK
2 1920x1080-50.00 148500000 297000000 148500000 148500000 148500000 0 OK
3 1680x1050-59.88 119000000 238000000 119000000 119000000 119000000 0 OK
4 1600x900-60.00 108000000 216000000 108000000 108000000 108000000 0 OK
5 1280x1024-75.02 135000000 270000000 135000000 135000000 135000000 0 OK
6 1280x1024-60.02 108000000 216000000 108000000 108000000 108000000 0 OK
7 1440x900-59.90 88750000 177500000 88750000 88750000 88750000 0 OK
8 1280x800-59.91 71000000 142000000 71000000 71000000 71000000 0 OK
9 1152x864-75.00 108000000 216000000 108000000 108000000 108000000 0 OK
10 1280x720-60.00 74250000 148500000 74250000 74250000 74250000 0 OK
11 1280x720-59.94 74176000 445056000 74176000 74176000 74176000 0 OK
12 1280x720-50.00 74250000 148500000 74250000 74250000 74250000 0 OK
13 1024x768-75.03 78750000 157500000 78750000 78750000 78750000 0 OK
14 1024x768-70.07 75000000 150000000 75000000 75000000 75000000 0 OK
15 1024x768-60.00 65000000 130000000 65000000 65000000 65000000 0 OK
16 832x624-74.55 57284000 114568001 57284001 57284001 57284001 1 OK
17 800x600-75.00 49500000 99000000 49500000 49500000 49500000 0 OK
18 800x600-72.19 50000000 100000000 50000000 50000000 50000000 0 OK
19 800x600-60.32 40000000 80000000 40000000 40000000 40000000 0 OK
20 800x600-56.25 36000000 72000000 36000000 36000000 36000000 0 OK
21 720x576-50.00 27000000 54000000 27000000 27000000 27000000 0 OK
22 720x480-60.00 27027000 54054001 27027001 27027001 27027001 1 OK
23 720x480-59.94 27000000 54000000 27000000 27000000 27000000 0 OK
24 640x480-75.00 31500000 63000000 31500000 31500000 31500000 0 OK
25 640x480-72.81 31500000 63000000 31500000 31500000 31500000 0 OK
26 640x480-66.67 30240000 60479999 30240000 30240000 30240000 0 OK
27 640x480-60.00 25200000 352799988 25199999 25199999 25199999 1 OK
28 640x480-59.94 25175000 50349998 25174999 25174999 25174999 1 OK
29 720x400-70.08 28320000 169919998 28320000 28320000 28320000 0 OK
For all the series:
Tested-by: Tommaso Merciai <tommaso.merciai.xr@xxxxxxxxxxxxxx>
Kind regards,
Tommaso
>
> Cheers,
> Prabhakar
>
> Lad Prabhakar (4):
> clk: renesas: rzv2h-cpg: Allow MIPI DSI to reuse PLL divider
> parameters
> clk: renesas: rzv2h-cpg: Add validation hook to PLL parameter search
> drm: renesas: rz-du: mipi_dsi: Improve DSI PLL parameter selection and
> cache results
> drm: renesas: rz-du: mipi_dsi: Add fallback CPG PLLDSI parameter
> search
>
> drivers/clk/renesas/rzv2h-cpg-lib.c | 109 ++++++++++-
> drivers/clk/renesas/rzv2h-cpg.c | 15 +-
> .../gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 174 +++++++++++++++---
> include/linux/clk/renesas.h | 38 ++++
> 4 files changed, 300 insertions(+), 36 deletions(-)
>
> --
> 2.56.0
>