The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
To: Prabhakar <prabhakar.csengg@gmail.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>,
	Stephen Boyd <sboyd@kernel.org>,
	Brian Masney <bmasney+clk@redhat.com>,
	Jerome Brunet <jbrunet+clk@baylibre.com>,
	Biju Das <biju.das.jz@bp.renesas.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Prabhakar <prabhakar.csengg+renesas@gmail.com>,
	Fabrizio Castro <fabrizio.castro.jz@renesas.com>,
	Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: Re: [PATCH 0/4] clk/drm: renesas: Improve RZ/V2H(P) MIPI DSI PLL parameter selection
Date: Fri, 4 Dec 2026 10:58:36 +0100	[thread overview]
Message-ID: <axKOzHdCMC3_omj7@tom-desktop> (raw)
In-Reply-To: <20261103172057.617203-1-prabhakar.mahadev-lad.rj@bp.renesas.com>

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@bp.renesas.com>
> 
> 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@bp.renesas.com/
> [2] https://lore.kernel.org/all/20261029-tm-ssgrlpcsrc-2083-v5-clk-duty-fixes-v1-2-47f23de6bdb1@bp.renesas.com/
> 
> 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@bp.renesas.com>

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
> 

  parent reply	other threads:[~2026-12-04  9:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 17:20 [PATCH 0/4] clk/drm: renesas: Improve RZ/V2H(P) MIPI DSI PLL parameter selection Prabhakar
2026-11-03 17:20 ` [PATCH 1/4] clk: renesas: rzv2h-cpg: Allow MIPI DSI to reuse PLL divider parameters Prabhakar
2026-11-03 17:20 ` [PATCH 2/4] clk: renesas: rzv2h-cpg: Add validation hook to PLL parameter search Prabhakar
2026-11-03 17:20 ` [PATCH 3/4] drm: renesas: rz-du: mipi_dsi: Improve DSI PLL parameter selection and cache results Prabhakar
2026-11-03 17:20 ` [PATCH 4/4] drm: renesas: rz-du: mipi_dsi: Add fallback CPG PLLDSI parameter search Prabhakar
2026-12-04  9:58 ` Tommaso Merciai [this message]
2026-12-04 10:05 ` [PATCH 0/4] clk/drm: renesas: Improve RZ/V2H(P) MIPI DSI PLL parameter selection Biju Das

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=axKOzHdCMC3_omj7@tom-desktop \
    --to=tommaso.merciai.xr@bp.renesas.com \
    --cc=airlied@gmail.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=bmasney+clk@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=fabrizio.castro.jz@renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=jbrunet+clk@baylibre.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=prabhakar.csengg+renesas@gmail.com \
    --cc=prabhakar.csengg@gmail.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=sboyd@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.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