]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm: renesas: rz-du: mipi_dsi: Use VCLK for HSFREQ calculation
authorLad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Mon, 9 Jun 2025 22:56:24 +0000 (23:56 +0100)
committerBiju Das <biju.das.jz@bp.renesas.com>
Thu, 12 Jun 2025 18:42:27 +0000 (19:42 +0100)
commit3c55c4f05c7ac4fd741cbe92574598324f843d94
treef8bb76db6b4c21a1bf24e524d27ea04da5fa82bf
parent0425a20f8a49722d0508e917b4aef767bbc06ec8
drm: renesas: rz-du: mipi_dsi: Use VCLK for HSFREQ calculation

Update the RZ/G2L MIPI DSI driver to calculate HSFREQ using the actual
VCLK rate instead of the mode clock. The relationship between HSCLK and
VCLK is:

    vclk * bpp <= hsclk * 8 * lanes

Retrieve the VCLK rate using `clk_get_rate(dsi->vclk)`, ensuring that
HSFREQ accurately reflects the clock rate set in hardware, leading to
better precision in data transmission.

Additionally, use `DIV_ROUND_CLOSEST_ULL` for a more precise division
when computing `hsfreq`. Also, update unit conversions to use correct
scaling factors for better clarity and correctness.

Since `clk_get_rate()` returns the clock rate in Hz, update the HSFREQ
threshold comparisons to use Hz instead of kHz to ensure correct behavior.

Co-developed-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20250609225630.502888-4-prabhakar.mahadev-lad.rj@bp.renesas.com
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c