* [PATCH v6 00/12] Add DU support for RZ/V2H(P) SoC
@ 2025-05-30 16:58 Prabhakar
2025-05-30 16:58 ` [PATCH v6 01/12] dt-bindings: display: renesas,rzg2l-du: Add " Prabhakar
` (11 more replies)
0 siblings, 12 replies; 21+ messages in thread
From: Prabhakar @ 2025-05-30 16:58 UTC (permalink / raw)
To: Biju Das, Laurent Pinchart, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
Geert Uytterhoeven, Magnus Damm
Cc: dri-devel, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Hi All,
This patch series adds support for the Display Unit (DU) and prepares
the MIPI DSI driver to support the Renesas RZ/V2H(P) SoC. These patches
were originally part of series [0], but I have split them into two parts
to make them easier to review and merge.
This patch series does not have any clock dependencies, so it can be
merged independently via the DU tree. The remaining patches from series
[0] will be sent as a follow-up series, which can be merged via the
Clock/DU tree as they have dependencies on the clock driver.
[0] https://lore.kernel.org/all/20250430204112.342123-1-prabhakar.mahadev-lad.rj@bp.renesas.com/
v5->v6:
- Added reviewed tag from Biju and Laurent
- Updated commit messages
- Dropped parentheses around the calculation
- Added min_dclk above max_dclk in rzg2l_mipi_dsi_hw_info
- Renamed dphy_late_init to dphy_startup_late_init
v4->v5:
- Split up the series
- Added Reviewed-by tag from Biju
- Dropped feature flags for reset and LPCLK
- Patch 07/12 is new.
v3->v4:
- Corrected parameter name in rzv2h_dsi_get_pll_parameters_values()
description freq_millihz
- Used MILLI instead of KILO
- Made use of mul_u32_u32() for multiplication
- In rzv2h_dphy_find_ulpsexit() made the array static const.
v2->v3:
- Update the commit message for patch 1/15 to clarify the purpose
of `renesas-rzv2h-dsi.h` header
- Used mul_u32_u32() in rzv2h_cpg_plldsi_div_determine_rate()
- Replaced *_mhz to *_millihz for clarity
- Updated u64->u32 for fvco limits
- Initialized the members in declaration order for
RZV2H_CPG_PLL_DSI_LIMITS() macro
- Used clk_div_mask() in rzv2h_cpg_plldsi_div_recalc_rate()
- Replaced `unsigned long long` with u64
- Dropped rzv2h_cpg_plldsi_clk_recalc_rate() and reused
rzv2h_cpg_pll_clk_recalc_rate() instead
- In rzv2h_cpg_plldsi_div_set_rate() followed the same style
of RMW-operation as done in the other functions
- Renamed rzv2h_cpg_plldsi_set_rate() to rzv2h_cpg_pll_set_rate()
- Dropped rzv2h_cpg_plldsi_clk_register() and reused
rzv2h_cpg_pll_clk_register() instead
- Added a guard in renesas-rzv2h-dsi.h header
- Reverted CSDIV0_DIVCTL2() to use DDIV_PACK()
- Renamed plleth_lpclk_div4 -> cdiv4_plleth_lpclk
- Renamed plleth_lpclk -> plleth_lpclk_gear
- Collected reviewed tag from Krzysztof for patch 3/15
- Dropped !dsi->info check in rzg2l_mipi_dsi_probe() as it
is not needed.
- Simplified V2H DSI timings array to save space
- Switched to use fsleep() instead of udelay()
v1->v2:
- Rebased the changes on top of v6.15-rc1
- Kept the sort order for schema validation
- Added `port@1: false` for RZ/V2H(P) SoC
- Added enum for RZ/V2H as suggested by Krzysztof as the list
will grow in the future (while adding RZ/G3E SoC).
- Added Reviewed-by tag from Biju and Krzysztof.
- Replaced individual flags as reset flag
- Dropped unused macros
- Added missing LPCLK flag to rzvv2h info
- Dropped FCP and VSP documentation patch and sent them separately
Cheers,
Prabhakar
Lad Prabhakar (12):
dt-bindings: display: renesas,rzg2l-du: Add support for RZ/V2H(P) SoC
drm: renesas: rz-du: Add support for RZ/V2H(P) SoC
drm: renesas: rz-du: mipi_dsi: Add min check for VCLK range
drm: renesas: rz-du: mipi_dsi: Simplify HSFREQ calculation
drm: renesas: rz-du: mipi_dsi: Use VCLK for HSFREQ calculation
drm: renesas: rz-du: mipi_dsi: Add OF data support
drm: renesas: rz-du: mipi_dsi: Make "rst" reset control optional for
RZ/V2H(P)
drm: renesas: rz-du: mipi_dsi: Use mHz for D-PHY frequency
calculations
drm: renesas: rz-du: mipi_dsi: Add feature flag for 16BPP support
drm: renesas: rz-du: mipi_dsi: Add dphy_late_init() callback for
RZ/V2H(P)
drm: renesas: rz-du: mipi_dsi: Add function pointers for configuring
VCLK and mode validation
drm: renesas: rz-du: mipi_dsi: Add support for LPCLK clock handling
.../bindings/display/renesas,rzg2l-du.yaml | 23 ++-
drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c | 11 ++
.../gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 144 ++++++++++++++----
.../drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h | 2 -
4 files changed, 146 insertions(+), 34 deletions(-)
--
2.49.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v6 01/12] dt-bindings: display: renesas,rzg2l-du: Add support for RZ/V2H(P) SoC
2025-05-30 16:58 [PATCH v6 00/12] Add DU support for RZ/V2H(P) SoC Prabhakar
@ 2025-05-30 16:58 ` Prabhakar
2025-05-31 6:35 ` Biju Das
2025-05-30 16:58 ` [PATCH v6 02/12] drm: renesas: rz-du: " Prabhakar
` (10 subsequent siblings)
11 siblings, 1 reply; 21+ messages in thread
From: Prabhakar @ 2025-05-30 16:58 UTC (permalink / raw)
To: Biju Das, Laurent Pinchart, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
Geert Uytterhoeven, Magnus Damm
Cc: dri-devel, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Fabrizio Castro, Lad Prabhakar, Krzysztof Kozlowski
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
The DU block on the RZ/V2H(P) SoC is identical to the one found on the
RZ/G2L SoC. However, it only supports the DSI interface, whereas the
RZ/G2L supports both DSI and DPI interfaces.
Due to this difference, a SoC-specific compatible string
'renesas,r9a09g057-du' is added for the RZ/V2H(P) SoC.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
v5->v6:
- Added reviewed tag from Laurent
v4->v5:
- Added reviewed tag from Biju
v3->v4:
- No changes
v2->v3:
- Collected reviewed tag from Krzysztof
v1->v2:
- Kept the sort order for schema validation
- Added `port@1: false` for RZ/V2H(P) SoC
---
.../bindings/display/renesas,rzg2l-du.yaml | 23 ++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/display/renesas,rzg2l-du.yaml b/Documentation/devicetree/bindings/display/renesas,rzg2l-du.yaml
index 95e3d5e74b87..1e32d14b6edb 100644
--- a/Documentation/devicetree/bindings/display/renesas,rzg2l-du.yaml
+++ b/Documentation/devicetree/bindings/display/renesas,rzg2l-du.yaml
@@ -20,6 +20,7 @@ properties:
- enum:
- renesas,r9a07g043u-du # RZ/G2UL
- renesas,r9a07g044-du # RZ/G2{L,LC}
+ - renesas,r9a09g057-du # RZ/V2H(P)
- items:
- enum:
- renesas,r9a07g054-du # RZ/V2L
@@ -101,7 +102,12 @@ allOf:
required:
- port@0
- else:
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: renesas,r9a07g044-du
+ then:
properties:
ports:
properties:
@@ -113,6 +119,21 @@ allOf:
required:
- port@0
- port@1
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: renesas,r9a09g057-du
+ then:
+ properties:
+ ports:
+ properties:
+ port@0:
+ description: DSI
+ port@1: false
+
+ required:
+ - port@0
examples:
# RZ/G2L DU
--
2.49.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 02/12] drm: renesas: rz-du: Add support for RZ/V2H(P) SoC
2025-05-30 16:58 [PATCH v6 00/12] Add DU support for RZ/V2H(P) SoC Prabhakar
2025-05-30 16:58 ` [PATCH v6 01/12] dt-bindings: display: renesas,rzg2l-du: Add " Prabhakar
@ 2025-05-30 16:58 ` Prabhakar
2025-05-31 6:36 ` Biju Das
2025-05-30 16:58 ` [PATCH v6 03/12] drm: renesas: rz-du: mipi_dsi: Add min check for VCLK range Prabhakar
` (9 subsequent siblings)
11 siblings, 1 reply; 21+ messages in thread
From: Prabhakar @ 2025-05-30 16:58 UTC (permalink / raw)
To: Biju Das, Laurent Pinchart, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
Geert Uytterhoeven, Magnus Damm
Cc: dri-devel, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
The LCD controller (LCDC) on the RZ/V2H(P) SoC is composed of Frame
Compression Processor (FCPVD), Video Signal Processor (VSPD), and
Display Unit (DU).
There is one LCDC unit available on the RZ/V2H(P) SoC which is connected
to the DSI.
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>
---
v5->v6:
- Added reviewed tag from Laurent
v4->v5:
- Added reviewed tag from Biju
v3->v4:
- No changes
v2->v3:
- No changes
v1->v2:
- No changes
---
drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c b/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c
index 5e40f0c1e7b0..e1aa6a719529 100644
--- a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c
+++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c
@@ -50,9 +50,20 @@ static const struct rzg2l_du_device_info rzg2l_du_r9a07g044_info = {
}
};
+static const struct rzg2l_du_device_info rzg2l_du_r9a09g057_info = {
+ .channels_mask = BIT(0),
+ .routes = {
+ [RZG2L_DU_OUTPUT_DSI0] = {
+ .possible_outputs = BIT(0),
+ .port = 0,
+ },
+ },
+};
+
static const struct of_device_id rzg2l_du_of_table[] = {
{ .compatible = "renesas,r9a07g043u-du", .data = &rzg2l_du_r9a07g043u_info },
{ .compatible = "renesas,r9a07g044-du", .data = &rzg2l_du_r9a07g044_info },
+ { .compatible = "renesas,r9a09g057-du", .data = &rzg2l_du_r9a09g057_info },
{ /* sentinel */ }
};
--
2.49.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 03/12] drm: renesas: rz-du: mipi_dsi: Add min check for VCLK range
2025-05-30 16:58 [PATCH v6 00/12] Add DU support for RZ/V2H(P) SoC Prabhakar
2025-05-30 16:58 ` [PATCH v6 01/12] dt-bindings: display: renesas,rzg2l-du: Add " Prabhakar
2025-05-30 16:58 ` [PATCH v6 02/12] drm: renesas: rz-du: " Prabhakar
@ 2025-05-30 16:58 ` Prabhakar
2025-05-30 16:58 ` [PATCH v6 04/12] drm: renesas: rz-du: mipi_dsi: Simplify HSFREQ calculation Prabhakar
` (8 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Prabhakar @ 2025-05-30 16:58 UTC (permalink / raw)
To: Biju Das, Laurent Pinchart, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
Geert Uytterhoeven, Magnus Damm
Cc: dri-devel, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
The VCLK range for Renesas RZ/G2L SoC is 5.803 MHz to 148.5 MHz. Add a
minimum clock check in the mode_valid callback to ensure that the clock
value does not fall below the valid range.
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>
---
v5->v6:
- Updated commit message
- Added reviewed tag from Laurent
v4->v5:
- No changes
v3->v4:
- No changes
v2->v3:
- No changes
v1->v2:
- Added reviewed tag from Biju
---
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
index dc6ab012cdb6..6aca10920c8e 100644
--- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
+++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
@@ -585,6 +585,9 @@ rzg2l_mipi_dsi_bridge_mode_valid(struct drm_bridge *bridge,
if (mode->clock > 148500)
return MODE_CLOCK_HIGH;
+ if (mode->clock < 5803)
+ return MODE_CLOCK_LOW;
+
return MODE_OK;
}
--
2.49.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 04/12] drm: renesas: rz-du: mipi_dsi: Simplify HSFREQ calculation
2025-05-30 16:58 [PATCH v6 00/12] Add DU support for RZ/V2H(P) SoC Prabhakar
` (2 preceding siblings ...)
2025-05-30 16:58 ` [PATCH v6 03/12] drm: renesas: rz-du: mipi_dsi: Add min check for VCLK range Prabhakar
@ 2025-05-30 16:58 ` Prabhakar
2025-05-30 16:58 ` [PATCH v6 05/12] drm: renesas: rz-du: mipi_dsi: Use VCLK for " Prabhakar
` (7 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Prabhakar @ 2025-05-30 16:58 UTC (permalink / raw)
To: Biju Das, Laurent Pinchart, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
Geert Uytterhoeven, Magnus Damm
Cc: dri-devel, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Simplify the high-speed clock frequency (HSFREQ) calculation by removing
the redundant multiplication and division by 8. The updated equation:
hsfreq = mode->clock * bpp / dsi->lanes;
produces the same result while improving readability and clarity.
Additionally, update the comment to clarify the relationship between HS
clock bit frequency, HS byte clock frequency, and HSFREQ.
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>
---
v5->v6:
- Updated commit message
- Dropped parentheses around the calculation
- Added reviewed tag from Laurent
v4->v5:
- No changes
v3->v4:
- No changes
v2->v3:
- No changes
v1->v2:
- Added Reviewed-by tag from Biju
---
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
index 6aca10920c8e..e8ca6a521e0f 100644
--- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
+++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
@@ -277,10 +277,10 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
* hsclk: DSI HS Byte clock frequency (Hz)
* lanes: number of data lanes
*
- * hsclk(bit) = hsclk(byte) * 8
+ * hsclk(bit) = hsclk(byte) * 8 = hsfreq
*/
bpp = mipi_dsi_pixel_format_to_bpp(dsi->format);
- hsfreq = (mode->clock * bpp * 8) / (8 * dsi->lanes);
+ hsfreq = mode->clock * bpp / dsi->lanes;
ret = pm_runtime_resume_and_get(dsi->dev);
if (ret < 0)
--
2.49.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 05/12] drm: renesas: rz-du: mipi_dsi: Use VCLK for HSFREQ calculation
2025-05-30 16:58 [PATCH v6 00/12] Add DU support for RZ/V2H(P) SoC Prabhakar
` (3 preceding siblings ...)
2025-05-30 16:58 ` [PATCH v6 04/12] drm: renesas: rz-du: mipi_dsi: Simplify HSFREQ calculation Prabhakar
@ 2025-05-30 16:58 ` Prabhakar
2025-06-02 9:42 ` Laurent Pinchart
2025-05-30 16:59 ` [PATCH v6 06/12] drm: renesas: rz-du: mipi_dsi: Add OF data support Prabhakar
` (6 subsequent siblings)
11 siblings, 1 reply; 21+ messages in thread
From: Prabhakar @ 2025-05-30 16:58 UTC (permalink / raw)
To: Biju Das, Laurent Pinchart, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
Geert Uytterhoeven, Magnus Damm
Cc: dri-devel, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
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>
---
v5->v6:
- Dropped parentheses around the calculation of `hsfreq_max`.
- Changed dev_info() to dev_dbg
v4->v5:
- Added dev_info() to print the VCLK rate if it doesn't match the
requested rate.
- Added Reviewed-by tag from Biju
v3->v4:
- Used MILLI instead of KILO
v2->v3:
- No changes
v1->v2:
- No changes
---
.../gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 30 +++++++++++--------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
index e8ca6a521e0f..4d4521a231cb 100644
--- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
+++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
@@ -8,6 +8,7 @@
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/iopoll.h>
+#include <linux/math.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_graph.h>
@@ -15,6 +16,7 @@
#include <linux/pm_runtime.h>
#include <linux/reset.h>
#include <linux/slab.h>
+#include <linux/units.h>
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
@@ -199,7 +201,7 @@ static int rzg2l_mipi_dsi_dphy_init(struct rzg2l_mipi_dsi *dsi,
/* All DSI global operation timings are set with recommended setting */
for (i = 0; i < ARRAY_SIZE(rzg2l_mipi_dsi_global_timings); ++i) {
dphy_timings = &rzg2l_mipi_dsi_global_timings[i];
- if (hsfreq <= dphy_timings->hsfreq_max)
+ if (hsfreq <= dphy_timings->hsfreq_max * KILO)
break;
}
@@ -258,7 +260,7 @@ static void rzg2l_mipi_dsi_dphy_exit(struct rzg2l_mipi_dsi *dsi)
static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
const struct drm_display_mode *mode)
{
- unsigned long hsfreq;
+ unsigned long hsfreq, vclk_rate;
unsigned int bpp;
u32 txsetr;
u32 clstptsetr;
@@ -269,6 +271,12 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
u32 golpbkt;
int ret;
+ ret = pm_runtime_resume_and_get(dsi->dev);
+ if (ret < 0)
+ return ret;
+
+ clk_set_rate(dsi->vclk, mode->clock * KILO);
+
/*
* Relationship between hsclk and vclk must follow
* vclk * bpp = hsclk * 8 * lanes
@@ -280,13 +288,11 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
* hsclk(bit) = hsclk(byte) * 8 = hsfreq
*/
bpp = mipi_dsi_pixel_format_to_bpp(dsi->format);
- hsfreq = mode->clock * bpp / dsi->lanes;
-
- ret = pm_runtime_resume_and_get(dsi->dev);
- if (ret < 0)
- return ret;
-
- clk_set_rate(dsi->vclk, mode->clock * 1000);
+ vclk_rate = clk_get_rate(dsi->vclk);
+ if (vclk_rate != mode->clock * KILO)
+ dev_dbg(dsi->dev, "Requested vclk rate %lu, actual %lu mismatch\n",
+ mode->clock * KILO, vclk_rate);
+ hsfreq = DIV_ROUND_CLOSEST_ULL(vclk_rate * bpp, dsi->lanes);
ret = rzg2l_mipi_dsi_dphy_init(dsi, hsfreq);
if (ret < 0)
@@ -304,12 +310,12 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
* - data lanes: maximum 4 lanes
* Therefore maximum hsclk will be 891 Mbps.
*/
- if (hsfreq > 445500) {
+ if (hsfreq > 445500000) {
clkkpt = 12;
clkbfht = 15;
clkstpt = 48;
golpbkt = 75;
- } else if (hsfreq > 250000) {
+ } else if (hsfreq > 250000000) {
clkkpt = 7;
clkbfht = 8;
clkstpt = 27;
@@ -754,7 +760,7 @@ static int rzg2l_mipi_dsi_probe(struct platform_device *pdev)
* mode->clock and format are not available. So initialize DPHY with
* timing parameters for 80Mbps.
*/
- ret = rzg2l_mipi_dsi_dphy_init(dsi, 80000);
+ ret = rzg2l_mipi_dsi_dphy_init(dsi, 80000000);
if (ret < 0)
goto err_phy;
--
2.49.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 06/12] drm: renesas: rz-du: mipi_dsi: Add OF data support
2025-05-30 16:58 [PATCH v6 00/12] Add DU support for RZ/V2H(P) SoC Prabhakar
` (4 preceding siblings ...)
2025-05-30 16:58 ` [PATCH v6 05/12] drm: renesas: rz-du: mipi_dsi: Use VCLK for " Prabhakar
@ 2025-05-30 16:59 ` Prabhakar
2025-05-30 16:59 ` [PATCH v6 07/12] drm: renesas: rz-du: mipi_dsi: Make "rst" reset control optional for RZ/V2H(P) Prabhakar
` (5 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Prabhakar @ 2025-05-30 16:59 UTC (permalink / raw)
To: Biju Das, Laurent Pinchart, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
Geert Uytterhoeven, Magnus Damm
Cc: dri-devel, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
In preparation for adding support for the Renesas RZ/V2H(P) SoC, this patch
introduces a mechanism to pass SoC-specific information via OF data in the
DSI driver. This enables the driver to adapt dynamically to various
SoC-specific requirements without hardcoding configurations.
The MIPI DSI interface on the RZ/V2H(P) SoC is nearly identical to the one
on the RZ/G2L SoC. While the LINK registers are shared between the two
SoCs, the D-PHY registers differ. Also the VCLK range differs on both these
SoCs. To accommodate these differences `struct rzg2l_mipi_dsi_hw_info` is
introduced and as now passed as OF data.
These changes lay the groundwork for the upcoming RZ/V2H(P) SoC support by
allowing SoC-specific data to be passed through OF.
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>
---
v5->v6:
- Added min_dclk above max_dclk in rzg2l_mipi_dsi_hw_info
- Added Reviewed-by tag from Laurent
v4->v5:
- Dropped RZ_MIPI_DSI_FEATURE_DPHY_RST feature flag
- Added Reviewed tag from Biju
v3->v4:
- No changes
v2->v3:
- Dropped !dsi->info check in rzg2l_mipi_dsi_probe() as it is not needed.
v1->v2:
- Added DPHY_RST as feature flag
---
.../gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 51 ++++++++++++++-----
.../drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h | 2 -
2 files changed, 38 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
index 4d4521a231cb..2c03cad66711 100644
--- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
+++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
@@ -28,10 +28,23 @@
#include "rzg2l_mipi_dsi_regs.h"
+struct rzg2l_mipi_dsi;
+
+struct rzg2l_mipi_dsi_hw_info {
+ int (*dphy_init)(struct rzg2l_mipi_dsi *dsi, unsigned long hsfreq);
+ void (*dphy_exit)(struct rzg2l_mipi_dsi *dsi);
+ u32 phy_reg_offset;
+ u32 link_reg_offset;
+ unsigned long min_dclk;
+ unsigned long max_dclk;
+};
+
struct rzg2l_mipi_dsi {
struct device *dev;
void __iomem *mmio;
+ const struct rzg2l_mipi_dsi_hw_info *info;
+
struct reset_control *rstc;
struct reset_control *arstc;
struct reset_control *prstc;
@@ -164,22 +177,22 @@ static const struct rzg2l_mipi_dsi_timings rzg2l_mipi_dsi_global_timings[] = {
static void rzg2l_mipi_dsi_phy_write(struct rzg2l_mipi_dsi *dsi, u32 reg, u32 data)
{
- iowrite32(data, dsi->mmio + reg);
+ iowrite32(data, dsi->mmio + dsi->info->phy_reg_offset + reg);
}
static void rzg2l_mipi_dsi_link_write(struct rzg2l_mipi_dsi *dsi, u32 reg, u32 data)
{
- iowrite32(data, dsi->mmio + LINK_REG_OFFSET + reg);
+ iowrite32(data, dsi->mmio + dsi->info->link_reg_offset + reg);
}
static u32 rzg2l_mipi_dsi_phy_read(struct rzg2l_mipi_dsi *dsi, u32 reg)
{
- return ioread32(dsi->mmio + reg);
+ return ioread32(dsi->mmio + dsi->info->phy_reg_offset + reg);
}
static u32 rzg2l_mipi_dsi_link_read(struct rzg2l_mipi_dsi *dsi, u32 reg)
{
- return ioread32(dsi->mmio + LINK_REG_OFFSET + reg);
+ return ioread32(dsi->mmio + dsi->info->link_reg_offset + reg);
}
/* -----------------------------------------------------------------------------
@@ -294,7 +307,7 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
mode->clock * KILO, vclk_rate);
hsfreq = DIV_ROUND_CLOSEST_ULL(vclk_rate * bpp, dsi->lanes);
- ret = rzg2l_mipi_dsi_dphy_init(dsi, hsfreq);
+ ret = dsi->info->dphy_init(dsi, hsfreq);
if (ret < 0)
goto err_phy;
@@ -337,7 +350,7 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
return 0;
err_phy:
- rzg2l_mipi_dsi_dphy_exit(dsi);
+ dsi->info->dphy_exit(dsi);
pm_runtime_put(dsi->dev);
return ret;
@@ -345,7 +358,7 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
static void rzg2l_mipi_dsi_stop(struct rzg2l_mipi_dsi *dsi)
{
- rzg2l_mipi_dsi_dphy_exit(dsi);
+ dsi->info->dphy_exit(dsi);
pm_runtime_put(dsi->dev);
}
@@ -588,10 +601,12 @@ rzg2l_mipi_dsi_bridge_mode_valid(struct drm_bridge *bridge,
const struct drm_display_info *info,
const struct drm_display_mode *mode)
{
- if (mode->clock > 148500)
+ struct rzg2l_mipi_dsi *dsi = bridge_to_rzg2l_mipi_dsi(bridge);
+
+ if (mode->clock > dsi->info->max_dclk)
return MODE_CLOCK_HIGH;
- if (mode->clock < 5803)
+ if (mode->clock < dsi->info->min_dclk)
return MODE_CLOCK_LOW;
return MODE_OK;
@@ -717,6 +732,8 @@ static int rzg2l_mipi_dsi_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, dsi);
dsi->dev = &pdev->dev;
+ dsi->info = of_device_get_match_data(&pdev->dev);
+
ret = drm_of_get_data_lanes_count_ep(dsi->dev->of_node, 1, 0, 1, 4);
if (ret < 0)
return dev_err_probe(dsi->dev, ret,
@@ -760,13 +777,13 @@ static int rzg2l_mipi_dsi_probe(struct platform_device *pdev)
* mode->clock and format are not available. So initialize DPHY with
* timing parameters for 80Mbps.
*/
- ret = rzg2l_mipi_dsi_dphy_init(dsi, 80000000);
+ ret = dsi->info->dphy_init(dsi, 80000000);
if (ret < 0)
goto err_phy;
txsetr = rzg2l_mipi_dsi_link_read(dsi, TXSETR);
dsi->num_data_lanes = min(((txsetr >> 16) & 3) + 1, num_data_lanes);
- rzg2l_mipi_dsi_dphy_exit(dsi);
+ dsi->info->dphy_exit(dsi);
pm_runtime_put(dsi->dev);
/* Initialize the DRM bridge. */
@@ -783,7 +800,7 @@ static int rzg2l_mipi_dsi_probe(struct platform_device *pdev)
return 0;
err_phy:
- rzg2l_mipi_dsi_dphy_exit(dsi);
+ dsi->info->dphy_exit(dsi);
pm_runtime_put(dsi->dev);
err_pm_disable:
pm_runtime_disable(dsi->dev);
@@ -798,8 +815,16 @@ static void rzg2l_mipi_dsi_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
}
+static const struct rzg2l_mipi_dsi_hw_info rzg2l_mipi_dsi_info = {
+ .dphy_init = rzg2l_mipi_dsi_dphy_init,
+ .dphy_exit = rzg2l_mipi_dsi_dphy_exit,
+ .link_reg_offset = 0x10000,
+ .min_dclk = 5803,
+ .max_dclk = 148500,
+};
+
static const struct of_device_id rzg2l_mipi_dsi_of_table[] = {
- { .compatible = "renesas,rzg2l-mipi-dsi" },
+ { .compatible = "renesas,rzg2l-mipi-dsi", .data = &rzg2l_mipi_dsi_info, },
{ /* sentinel */ }
};
diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h
index 1dbc16ec64a4..16efe4dc59f4 100644
--- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h
+++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h
@@ -41,8 +41,6 @@
#define DSIDPHYTIM3_THS_ZERO(x) ((x) << 0)
/* --------------------------------------------------------*/
-/* Link Registers */
-#define LINK_REG_OFFSET 0x10000
/* Link Status Register */
#define LINKSR 0x10
--
2.49.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 07/12] drm: renesas: rz-du: mipi_dsi: Make "rst" reset control optional for RZ/V2H(P)
2025-05-30 16:58 [PATCH v6 00/12] Add DU support for RZ/V2H(P) SoC Prabhakar
` (5 preceding siblings ...)
2025-05-30 16:59 ` [PATCH v6 06/12] drm: renesas: rz-du: mipi_dsi: Add OF data support Prabhakar
@ 2025-05-30 16:59 ` Prabhakar
2025-05-30 16:59 ` [PATCH v6 08/12] drm: renesas: rz-du: mipi_dsi: Use mHz for D-PHY frequency calculations Prabhakar
` (4 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Prabhakar @ 2025-05-30 16:59 UTC (permalink / raw)
To: Biju Das, Laurent Pinchart, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
Geert Uytterhoeven, Magnus Damm
Cc: dri-devel, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
In preparation for adding support for the Renesas RZ/V2H(P) SoC, make the
"rst" reset control optional in the MIPI DSI driver. The RZ/V2H(P) SoC
does not provide this reset line, and attempting to acquire it using the
mandatory API causes probe failure.
Switching to devm_reset_control_get_optional_exclusive() ensures
compatibility with both SoCs that provide this reset line and those that
do not, such as RZ/V2H(P).
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>
---
v5->v6:
- Added reviewed tag from Biju and Laurent
v4->v5:
- New patch
---
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
index 2c03cad66711..0e0659dfe5a5 100644
--- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
+++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
@@ -749,7 +749,7 @@ static int rzg2l_mipi_dsi_probe(struct platform_device *pdev)
if (IS_ERR(dsi->vclk))
return PTR_ERR(dsi->vclk);
- dsi->rstc = devm_reset_control_get_exclusive(dsi->dev, "rst");
+ dsi->rstc = devm_reset_control_get_optional_exclusive(dsi->dev, "rst");
if (IS_ERR(dsi->rstc))
return dev_err_probe(dsi->dev, PTR_ERR(dsi->rstc),
"failed to get rst\n");
--
2.49.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 08/12] drm: renesas: rz-du: mipi_dsi: Use mHz for D-PHY frequency calculations
2025-05-30 16:58 [PATCH v6 00/12] Add DU support for RZ/V2H(P) SoC Prabhakar
` (6 preceding siblings ...)
2025-05-30 16:59 ` [PATCH v6 07/12] drm: renesas: rz-du: mipi_dsi: Make "rst" reset control optional for RZ/V2H(P) Prabhakar
@ 2025-05-30 16:59 ` Prabhakar
2025-05-30 16:59 ` [PATCH v6 09/12] drm: renesas: rz-du: mipi_dsi: Add feature flag for 16BPP support Prabhakar
` (3 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Prabhakar @ 2025-05-30 16:59 UTC (permalink / raw)
To: Biju Das, Laurent Pinchart, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
Geert Uytterhoeven, Magnus Damm
Cc: dri-devel, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Pass the HSFREQ in milli-Hz to the `dphy_init()` callback to improve
precision, especially for the RZ/V2H(P) SoC, where PLL dividers require
high accuracy.
These changes prepare the driver for upcoming RZ/V2H(P) SoC support.
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>
---
v5->v6:
- No changes
v4->v5:
- Added Reviewed tag from Biju
v3->v4:
- Used MILLI instead of KILO
- Made use of mul_u32_u32() for multiplication
v2->v3:
- Replaced `unsigned long long` with `u64`
- Replaced *_mhz with *_millihz` in functions
v1->v2:
- No changes
---
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
index 0e0659dfe5a5..fd5d4551f39d 100644
--- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
+++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
@@ -31,7 +31,7 @@
struct rzg2l_mipi_dsi;
struct rzg2l_mipi_dsi_hw_info {
- int (*dphy_init)(struct rzg2l_mipi_dsi *dsi, unsigned long hsfreq);
+ int (*dphy_init)(struct rzg2l_mipi_dsi *dsi, u64 hsfreq_millihz);
void (*dphy_exit)(struct rzg2l_mipi_dsi *dsi);
u32 phy_reg_offset;
u32 link_reg_offset;
@@ -200,8 +200,9 @@ static u32 rzg2l_mipi_dsi_link_read(struct rzg2l_mipi_dsi *dsi, u32 reg)
*/
static int rzg2l_mipi_dsi_dphy_init(struct rzg2l_mipi_dsi *dsi,
- unsigned long hsfreq)
+ u64 hsfreq_millihz)
{
+ unsigned long hsfreq = DIV_ROUND_CLOSEST_ULL(hsfreq_millihz, MILLI);
const struct rzg2l_mipi_dsi_timings *dphy_timings;
unsigned int i;
u32 dphyctrl0;
@@ -274,6 +275,7 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
const struct drm_display_mode *mode)
{
unsigned long hsfreq, vclk_rate;
+ u64 hsfreq_millihz;
unsigned int bpp;
u32 txsetr;
u32 clstptsetr;
@@ -305,9 +307,9 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
if (vclk_rate != mode->clock * KILO)
dev_dbg(dsi->dev, "Requested vclk rate %lu, actual %lu mismatch\n",
mode->clock * KILO, vclk_rate);
- hsfreq = DIV_ROUND_CLOSEST_ULL(vclk_rate * bpp, dsi->lanes);
+ hsfreq_millihz = DIV_ROUND_CLOSEST_ULL(mul_u32_u32(vclk_rate, bpp * MILLI), dsi->lanes);
- ret = dsi->info->dphy_init(dsi, hsfreq);
+ ret = dsi->info->dphy_init(dsi, hsfreq_millihz);
if (ret < 0)
goto err_phy;
@@ -315,6 +317,7 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
txsetr = TXSETR_DLEN | TXSETR_NUMLANEUSE(dsi->lanes - 1) | TXSETR_CLEN;
rzg2l_mipi_dsi_link_write(dsi, TXSETR, txsetr);
+ hsfreq = DIV_ROUND_CLOSEST_ULL(hsfreq_millihz, MILLI);
/*
* Global timings characteristic depends on high speed Clock Frequency
* Currently MIPI DSI-IF just supports maximum FHD@60 with:
@@ -777,7 +780,7 @@ static int rzg2l_mipi_dsi_probe(struct platform_device *pdev)
* mode->clock and format are not available. So initialize DPHY with
* timing parameters for 80Mbps.
*/
- ret = dsi->info->dphy_init(dsi, 80000000);
+ ret = dsi->info->dphy_init(dsi, 80000000ULL * MILLI);
if (ret < 0)
goto err_phy;
--
2.49.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 09/12] drm: renesas: rz-du: mipi_dsi: Add feature flag for 16BPP support
2025-05-30 16:58 [PATCH v6 00/12] Add DU support for RZ/V2H(P) SoC Prabhakar
` (7 preceding siblings ...)
2025-05-30 16:59 ` [PATCH v6 08/12] drm: renesas: rz-du: mipi_dsi: Use mHz for D-PHY frequency calculations Prabhakar
@ 2025-05-30 16:59 ` Prabhakar
2025-05-30 16:59 ` [PATCH v6 10/12] drm: renesas: rz-du: mipi_dsi: Add dphy_late_init() callback for RZ/V2H(P) Prabhakar
` (2 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Prabhakar @ 2025-05-30 16:59 UTC (permalink / raw)
To: Biju Das, Laurent Pinchart, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
Geert Uytterhoeven, Magnus Damm
Cc: dri-devel, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Introduce the `RZ_MIPI_DSI_FEATURE_16BPP` flag in `rzg2l_mipi_dsi_hw_info`
to indicate support for 16BPP pixel formats. The RZ/V2H(P) SoC supports
16BPP, whereas this feature is missing on the RZ/G2L SoC.
Update the `mipi_dsi_host_attach()` function to check this flag before
allowing 16BPP formats. If the SoC does not support 16BPP, return an error
to prevent incorrect format selection.
This change enables finer-grained format support control for different
SoC variants.
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>
---
v5->v6:
- Added Reviewed-by tag from Laurent
v4->v5:
- Updated RZ_MIPI_DSI_FEATURE_16BPP macro to use BIT(0)
- Added Reviewed tag from Biju
v3->v4:
- No changes
v2->v3:
- No changes
v1->v2:
- Renamed RZ_MIPI_DSI_FEATURE_16BPP
---
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
index fd5d4551f39d..506b5503a725 100644
--- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
+++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
@@ -28,6 +28,8 @@
#include "rzg2l_mipi_dsi_regs.h"
+#define RZ_MIPI_DSI_FEATURE_16BPP BIT(0)
+
struct rzg2l_mipi_dsi;
struct rzg2l_mipi_dsi_hw_info {
@@ -37,6 +39,7 @@ struct rzg2l_mipi_dsi_hw_info {
u32 link_reg_offset;
unsigned long min_dclk;
unsigned long max_dclk;
+ u8 features;
};
struct rzg2l_mipi_dsi {
@@ -644,8 +647,16 @@ static int rzg2l_mipi_dsi_host_attach(struct mipi_dsi_host *host,
switch (mipi_dsi_pixel_format_to_bpp(device->format)) {
case 24:
+ break;
case 18:
break;
+ case 16:
+ if (!(dsi->info->features & RZ_MIPI_DSI_FEATURE_16BPP)) {
+ dev_err(dsi->dev, "Unsupported format 0x%04x\n",
+ device->format);
+ return -EINVAL;
+ }
+ break;
default:
dev_err(dsi->dev, "Unsupported format 0x%04x\n", device->format);
return -EINVAL;
--
2.49.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 10/12] drm: renesas: rz-du: mipi_dsi: Add dphy_late_init() callback for RZ/V2H(P)
2025-05-30 16:58 [PATCH v6 00/12] Add DU support for RZ/V2H(P) SoC Prabhakar
` (8 preceding siblings ...)
2025-05-30 16:59 ` [PATCH v6 09/12] drm: renesas: rz-du: mipi_dsi: Add feature flag for 16BPP support Prabhakar
@ 2025-05-30 16:59 ` Prabhakar
2025-05-30 16:59 ` [PATCH v6 11/12] drm: renesas: rz-du: mipi_dsi: Add function pointers for configuring VCLK and mode validation Prabhakar
2025-05-30 16:59 ` [PATCH v6 12/12] drm: renesas: rz-du: mipi_dsi: Add support for LPCLK clock handling Prabhakar
11 siblings, 0 replies; 21+ messages in thread
From: Prabhakar @ 2025-05-30 16:59 UTC (permalink / raw)
To: Biju Das, Laurent Pinchart, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
Geert Uytterhoeven, Magnus Damm
Cc: dri-devel, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Introduce the `dphy_late_init` callback in `rzg2l_mipi_dsi_hw_info` to
allow additional D-PHY register configurations after enabling data and
clock lanes. This is required for the RZ/V2H(P) SoC but not for the
RZ/G2L SoC.
Modify `rzg2l_mipi_dsi_startup()` to invoke `dphy_late_init` if defined,
ensuring SoC-specific initialization is performed only when necessary.
This change prepares for RZ/V2H(P) SoC support while maintaining
compatibility with existing platforms.
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>
---
v5->v6:
- Renamed dphy_late_init to dphy_startup_late_init
- Added Reviewed-by tag from Laurent
v4->v5:
- Added Reviewed tag from Biju
v3->v4:
- No changes
v2->v3:
- No changes
v1->v2:
- No changes
---
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
index 506b5503a725..ebbc6ac45484 100644
--- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
+++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
@@ -34,6 +34,7 @@ struct rzg2l_mipi_dsi;
struct rzg2l_mipi_dsi_hw_info {
int (*dphy_init)(struct rzg2l_mipi_dsi *dsi, u64 hsfreq_millihz);
+ void (*dphy_startup_late_init)(struct rzg2l_mipi_dsi *dsi);
void (*dphy_exit)(struct rzg2l_mipi_dsi *dsi);
u32 phy_reg_offset;
u32 link_reg_offset;
@@ -320,6 +321,9 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
txsetr = TXSETR_DLEN | TXSETR_NUMLANEUSE(dsi->lanes - 1) | TXSETR_CLEN;
rzg2l_mipi_dsi_link_write(dsi, TXSETR, txsetr);
+ if (dsi->info->dphy_startup_late_init)
+ dsi->info->dphy_startup_late_init(dsi);
+
hsfreq = DIV_ROUND_CLOSEST_ULL(hsfreq_millihz, MILLI);
/*
* Global timings characteristic depends on high speed Clock Frequency
--
2.49.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 11/12] drm: renesas: rz-du: mipi_dsi: Add function pointers for configuring VCLK and mode validation
2025-05-30 16:58 [PATCH v6 00/12] Add DU support for RZ/V2H(P) SoC Prabhakar
` (9 preceding siblings ...)
2025-05-30 16:59 ` [PATCH v6 10/12] drm: renesas: rz-du: mipi_dsi: Add dphy_late_init() callback for RZ/V2H(P) Prabhakar
@ 2025-05-30 16:59 ` Prabhakar
2025-05-30 16:59 ` [PATCH v6 12/12] drm: renesas: rz-du: mipi_dsi: Add support for LPCLK clock handling Prabhakar
11 siblings, 0 replies; 21+ messages in thread
From: Prabhakar @ 2025-05-30 16:59 UTC (permalink / raw)
To: Biju Das, Laurent Pinchart, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
Geert Uytterhoeven, Magnus Damm
Cc: dri-devel, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Introduce `dphy_conf_clks` and `dphy_mode_clk_check` callbacks in
`rzg2l_mipi_dsi_hw_info` to configure the VCLK and validate
supported display modes.
On the RZ/V2H(P) SoC, the DSI PLL dividers need to be as accurate as
possible. To ensure compatibility with both RZ/G2L and RZ/V2H(P) SoCs,
function pointers are introduced.
Modify `rzg2l_mipi_dsi_startup()` to use `dphy_conf_clks` for clock
configuration and `rzg2l_mipi_dsi_bridge_mode_valid()` to invoke
`dphy_mode_clk_check` for mode validation.
This change ensures proper operation across different SoC variants
by allowing fine-grained control over clock configuration and mode
validation.
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>
---
v5->v6:
- No changes
v4->v5:
- Added Reviewed tag from Biju
v3->v4:
- Replaced KILO with MILLI
v2->v3:
- Replaced unsigned long long with u64
v1->v2:
- No changes
---
.../gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 65 +++++++++++++------
1 file changed, 45 insertions(+), 20 deletions(-)
diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
index ebbc6ac45484..f9f2d883c40d 100644
--- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
+++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
@@ -36,6 +36,10 @@ struct rzg2l_mipi_dsi_hw_info {
int (*dphy_init)(struct rzg2l_mipi_dsi *dsi, u64 hsfreq_millihz);
void (*dphy_startup_late_init)(struct rzg2l_mipi_dsi *dsi);
void (*dphy_exit)(struct rzg2l_mipi_dsi *dsi);
+ int (*dphy_conf_clks)(struct rzg2l_mipi_dsi *dsi, unsigned long mode_freq,
+ u64 *hsfreq_millihz);
+ unsigned int (*dphy_mode_clk_check)(struct rzg2l_mipi_dsi *dsi,
+ unsigned long mode_freq);
u32 phy_reg_offset;
u32 link_reg_offset;
unsigned long min_dclk;
@@ -275,12 +279,39 @@ static void rzg2l_mipi_dsi_dphy_exit(struct rzg2l_mipi_dsi *dsi)
reset_control_assert(dsi->rstc);
}
+static int rzg2l_dphy_conf_clks(struct rzg2l_mipi_dsi *dsi, unsigned long mode_freq,
+ u64 *hsfreq_millihz)
+{
+ unsigned long vclk_rate;
+ unsigned int bpp;
+
+ clk_set_rate(dsi->vclk, mode_freq * KILO);
+ /*
+ * Relationship between hsclk and vclk must follow
+ * vclk * bpp = hsclk * 8 * lanes
+ * where vclk: video clock (Hz)
+ * bpp: video pixel bit depth
+ * hsclk: DSI HS Byte clock frequency (Hz)
+ * lanes: number of data lanes
+ *
+ * hsclk(bit) = hsclk(byte) * 8 = hsfreq
+ */
+ bpp = mipi_dsi_pixel_format_to_bpp(dsi->format);
+ vclk_rate = clk_get_rate(dsi->vclk);
+ if (vclk_rate != mode_freq * KILO)
+ dev_dbg(dsi->dev, "Requested vclk rate %lu, actual %lu mismatch\n",
+ mode_freq * KILO, vclk_rate);
+ *hsfreq_millihz = DIV_ROUND_CLOSEST_ULL(mul_u32_u32(vclk_rate, bpp * MILLI),
+ dsi->lanes);
+
+ return 0;
+}
+
static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
const struct drm_display_mode *mode)
{
- unsigned long hsfreq, vclk_rate;
+ unsigned long hsfreq;
u64 hsfreq_millihz;
- unsigned int bpp;
u32 txsetr;
u32 clstptsetr;
u32 lptrnstsetr;
@@ -294,24 +325,9 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
if (ret < 0)
return ret;
- clk_set_rate(dsi->vclk, mode->clock * KILO);
-
- /*
- * Relationship between hsclk and vclk must follow
- * vclk * bpp = hsclk * 8 * lanes
- * where vclk: video clock (Hz)
- * bpp: video pixel bit depth
- * hsclk: DSI HS Byte clock frequency (Hz)
- * lanes: number of data lanes
- *
- * hsclk(bit) = hsclk(byte) * 8 = hsfreq
- */
- bpp = mipi_dsi_pixel_format_to_bpp(dsi->format);
- vclk_rate = clk_get_rate(dsi->vclk);
- if (vclk_rate != mode->clock * KILO)
- dev_dbg(dsi->dev, "Requested vclk rate %lu, actual %lu mismatch\n",
- mode->clock * KILO, vclk_rate);
- hsfreq_millihz = DIV_ROUND_CLOSEST_ULL(mul_u32_u32(vclk_rate, bpp * MILLI), dsi->lanes);
+ ret = dsi->info->dphy_conf_clks(dsi, mode->clock, &hsfreq_millihz);
+ if (ret < 0)
+ goto err_phy;
ret = dsi->info->dphy_init(dsi, hsfreq_millihz);
if (ret < 0)
@@ -619,6 +635,14 @@ rzg2l_mipi_dsi_bridge_mode_valid(struct drm_bridge *bridge,
if (mode->clock < dsi->info->min_dclk)
return MODE_CLOCK_LOW;
+ if (dsi->info->dphy_mode_clk_check) {
+ enum drm_mode_status status;
+
+ status = dsi->info->dphy_mode_clk_check(dsi, mode->clock);
+ if (status != MODE_OK)
+ return status;
+ }
+
return MODE_OK;
}
@@ -836,6 +860,7 @@ static void rzg2l_mipi_dsi_remove(struct platform_device *pdev)
static const struct rzg2l_mipi_dsi_hw_info rzg2l_mipi_dsi_info = {
.dphy_init = rzg2l_mipi_dsi_dphy_init,
.dphy_exit = rzg2l_mipi_dsi_dphy_exit,
+ .dphy_conf_clks = rzg2l_dphy_conf_clks,
.link_reg_offset = 0x10000,
.min_dclk = 5803,
.max_dclk = 148500,
--
2.49.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 12/12] drm: renesas: rz-du: mipi_dsi: Add support for LPCLK clock handling
2025-05-30 16:58 [PATCH v6 00/12] Add DU support for RZ/V2H(P) SoC Prabhakar
` (10 preceding siblings ...)
2025-05-30 16:59 ` [PATCH v6 11/12] drm: renesas: rz-du: mipi_dsi: Add function pointers for configuring VCLK and mode validation Prabhakar
@ 2025-05-30 16:59 ` Prabhakar
2025-06-02 9:42 ` Laurent Pinchart
11 siblings, 1 reply; 21+ messages in thread
From: Prabhakar @ 2025-05-30 16:59 UTC (permalink / raw)
To: Biju Das, Laurent Pinchart, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
Geert Uytterhoeven, Magnus Damm
Cc: dri-devel, linux-renesas-soc, devicetree, linux-kernel, Prabhakar,
Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Add LPCLK clock support in the RZ/G2L MIPI DSI driver via the optional
clock API. This clock is required by some SoCs like RZ/V2H(P) for proper
DPHY configuration, whereas it is absent on others like RZ/G2L.
Introduce a new `lpclk` field in the `rzg2l_mipi_dsi` structure and
conditionally acquire the "lpclk" clock using `devm_clk_get_optional()`
during probe. This allows LPCLK-aware SoCs to pass the clock via device
tree without impacting existing platforms.
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>
---
v5->v6:
- No changes
v4->v5:
- Made use of devm_clk_get_optional() for lpclk
- Added Reviewed tag from Biju
v3->v4
- No changes
v2->v3:
- No changes
v1->v2:
- Added LPCLK as feature flag
---
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
index f9f2d883c40d..a31f9b6aa920 100644
--- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
+++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
@@ -62,6 +62,7 @@ struct rzg2l_mipi_dsi {
struct drm_bridge *next_bridge;
struct clk *vclk;
+ struct clk *lpclk;
enum mipi_dsi_pixel_format format;
unsigned int num_data_lanes;
@@ -791,6 +792,10 @@ static int rzg2l_mipi_dsi_probe(struct platform_device *pdev)
if (IS_ERR(dsi->vclk))
return PTR_ERR(dsi->vclk);
+ dsi->lpclk = devm_clk_get_optional(dsi->dev, "lpclk");
+ if (IS_ERR(dsi->lpclk))
+ return PTR_ERR(dsi->lpclk);
+
dsi->rstc = devm_reset_control_get_optional_exclusive(dsi->dev, "rst");
if (IS_ERR(dsi->rstc))
return dev_err_probe(dsi->dev, PTR_ERR(dsi->rstc),
--
2.49.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* RE: [PATCH v6 01/12] dt-bindings: display: renesas,rzg2l-du: Add support for RZ/V2H(P) SoC
2025-05-30 16:58 ` [PATCH v6 01/12] dt-bindings: display: renesas,rzg2l-du: Add " Prabhakar
@ 2025-05-31 6:35 ` Biju Das
2025-06-02 8:35 ` Lad, Prabhakar
0 siblings, 1 reply; 21+ messages in thread
From: Biju Das @ 2025-05-31 6:35 UTC (permalink / raw)
To: Prabhakar, Laurent Pinchart, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
Geert Uytterhoeven, Magnus Damm
Cc: dri-devel@lists.freedesktop.org,
linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, Fabrizio Castro,
Prabhakar Mahadev Lad, Krzysztof Kozlowski
Hi Prabhakar,
> -----Original Message-----
> From: Prabhakar <prabhakar.csengg@gmail.com>
> Sent: 30 May 2025 17:59
> Subject: [PATCH v6 01/12] dt-bindings: display: renesas,rzg2l-du: Add support for RZ/V2H(P) SoC
>
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> The DU block on the RZ/V2H(P) SoC is identical to the one found on the RZ/G2L SoC. However, it only
> supports the DSI interface, whereas the RZ/G2L supports both DSI and DPI interfaces.
>
> Due to this difference, a SoC-specific compatible string 'renesas,r9a09g057-du' is added for the
> RZ/V2H(P) SoC.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
This patch is already applied in drm-misc-next [1]
[1] https://cgit.freedesktop.org/drm/drm-misc/commit/?id=ed6a6d63513ee5199841c0a0dc2772ad944e63ee
> ---
> v5->v6:
> - Added reviewed tag from Laurent
>
> v4->v5:
> - Added reviewed tag from Biju
>
> v3->v4:
> - No changes
>
> v2->v3:
> - Collected reviewed tag from Krzysztof
>
> v1->v2:
> - Kept the sort order for schema validation
> - Added `port@1: false` for RZ/V2H(P) SoC
> ---
> .../bindings/display/renesas,rzg2l-du.yaml | 23 ++++++++++++++++++-
> 1 file changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/display/renesas,rzg2l-du.yaml
> b/Documentation/devicetree/bindings/display/renesas,rzg2l-du.yaml
> index 95e3d5e74b87..1e32d14b6edb 100644
> --- a/Documentation/devicetree/bindings/display/renesas,rzg2l-du.yaml
> +++ b/Documentation/devicetree/bindings/display/renesas,rzg2l-du.yaml
> @@ -20,6 +20,7 @@ properties:
> - enum:
> - renesas,r9a07g043u-du # RZ/G2UL
> - renesas,r9a07g044-du # RZ/G2{L,LC}
> + - renesas,r9a09g057-du # RZ/V2H(P)
> - items:
> - enum:
> - renesas,r9a07g054-du # RZ/V2L
> @@ -101,7 +102,12 @@ allOf:
>
> required:
> - port@0
> - else:
> + - if:
> + properties:
> + compatible:
> + contains:
> + const: renesas,r9a07g044-du
> + then:
> properties:
> ports:
> properties:
> @@ -113,6 +119,21 @@ allOf:
> required:
> - port@0
> - port@1
> + - if:
> + properties:
> + compatible:
> + contains:
> + const: renesas,r9a09g057-du
> + then:
> + properties:
> + ports:
> + properties:
> + port@0:
> + description: DSI
> + port@1: false
> +
> + required:
> + - port@0
>
> examples:
> # RZ/G2L DU
> --
> 2.49.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [PATCH v6 02/12] drm: renesas: rz-du: Add support for RZ/V2H(P) SoC
2025-05-30 16:58 ` [PATCH v6 02/12] drm: renesas: rz-du: " Prabhakar
@ 2025-05-31 6:36 ` Biju Das
2025-06-02 8:36 ` Lad, Prabhakar
0 siblings, 1 reply; 21+ messages in thread
From: Biju Das @ 2025-05-31 6:36 UTC (permalink / raw)
To: Prabhakar, Laurent Pinchart, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
Geert Uytterhoeven, Magnus Damm
Cc: dri-devel@lists.freedesktop.org,
linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, Fabrizio Castro,
Prabhakar Mahadev Lad
Hi Prabhakar,
> -----Original Message-----
> From: Prabhakar <prabhakar.csengg@gmail.com>
> Sent: 30 May 2025 17:59
> Subject: [PATCH v6 02/12] drm: renesas: rz-du: Add support for RZ/V2H(P) SoC
>
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> The LCD controller (LCDC) on the RZ/V2H(P) SoC is composed of Frame Compression Processor (FCPVD),
> Video Signal Processor (VSPD), and Display Unit (DU).
>
> There is one LCDC unit available on the RZ/V2H(P) SoC which is connected to the DSI.
>
> 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>
This patch is already applied in drm-misc-next [1]
[1] https://cgit.freedesktop.org/drm/drm-misc/commit/?id=1f957fbb88b61eaf5ac9bf2db6bc2e54121a4359
Cheers,
Biju
> ---
> v5->v6:
> - Added reviewed tag from Laurent
>
> v4->v5:
> - Added reviewed tag from Biju
>
> v3->v4:
> - No changes
>
> v2->v3:
> - No changes
>
> v1->v2:
> - No changes
> ---
> drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c b/drivers/gpu/drm/renesas/rz-
> du/rzg2l_du_drv.c
> index 5e40f0c1e7b0..e1aa6a719529 100644
> --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c
> +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c
> @@ -50,9 +50,20 @@ static const struct rzg2l_du_device_info rzg2l_du_r9a07g044_info = {
> }
> };
>
> +static const struct rzg2l_du_device_info rzg2l_du_r9a09g057_info = {
> + .channels_mask = BIT(0),
> + .routes = {
> + [RZG2L_DU_OUTPUT_DSI0] = {
> + .possible_outputs = BIT(0),
> + .port = 0,
> + },
> + },
> +};
> +
> static const struct of_device_id rzg2l_du_of_table[] = {
> { .compatible = "renesas,r9a07g043u-du", .data = &rzg2l_du_r9a07g043u_info },
> { .compatible = "renesas,r9a07g044-du", .data = &rzg2l_du_r9a07g044_info },
> + { .compatible = "renesas,r9a09g057-du", .data =
> +&rzg2l_du_r9a09g057_info },
> { /* sentinel */ }
> };
>
> --
> 2.49.0
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v6 01/12] dt-bindings: display: renesas,rzg2l-du: Add support for RZ/V2H(P) SoC
2025-05-31 6:35 ` Biju Das
@ 2025-06-02 8:35 ` Lad, Prabhakar
0 siblings, 0 replies; 21+ messages in thread
From: Lad, Prabhakar @ 2025-06-02 8:35 UTC (permalink / raw)
To: Biju Das
Cc: Laurent Pinchart, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
Geert Uytterhoeven, Magnus Damm, dri-devel@lists.freedesktop.org,
linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, Fabrizio Castro,
Prabhakar Mahadev Lad, Krzysztof Kozlowski
On Sat, May 31, 2025 at 7:35 AM Biju Das <biju.das.jz@bp.renesas.com> wrote:
>
> Hi Prabhakar,
>
> > -----Original Message-----
> > From: Prabhakar <prabhakar.csengg@gmail.com>
> > Sent: 30 May 2025 17:59
> > Subject: [PATCH v6 01/12] dt-bindings: display: renesas,rzg2l-du: Add support for RZ/V2H(P) SoC
> >
> > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> >
> > The DU block on the RZ/V2H(P) SoC is identical to the one found on the RZ/G2L SoC. However, it only
> > supports the DSI interface, whereas the RZ/G2L supports both DSI and DPI interfaces.
> >
> > Due to this difference, a SoC-specific compatible string 'renesas,r9a09g057-du' is added for the
> > RZ/V2H(P) SoC.
> >
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> > Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> > Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
>
> This patch is already applied in drm-misc-next [1]
> [1] https://cgit.freedesktop.org/drm/drm-misc/commit/?id=ed6a6d63513ee5199841c0a0dc2772ad944e63ee
>
Thanks Biju.
Cheers,
Prabhakar
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v6 02/12] drm: renesas: rz-du: Add support for RZ/V2H(P) SoC
2025-05-31 6:36 ` Biju Das
@ 2025-06-02 8:36 ` Lad, Prabhakar
0 siblings, 0 replies; 21+ messages in thread
From: Lad, Prabhakar @ 2025-06-02 8:36 UTC (permalink / raw)
To: Biju Das
Cc: Laurent Pinchart, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Philipp Zabel,
Geert Uytterhoeven, Magnus Damm, dri-devel@lists.freedesktop.org,
linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, Fabrizio Castro,
Prabhakar Mahadev Lad
On Sat, May 31, 2025 at 7:36 AM Biju Das <biju.das.jz@bp.renesas.com> wrote:
>
> Hi Prabhakar,
>
> > -----Original Message-----
> > From: Prabhakar <prabhakar.csengg@gmail.com>
> > Sent: 30 May 2025 17:59
> > Subject: [PATCH v6 02/12] drm: renesas: rz-du: Add support for RZ/V2H(P) SoC
> >
> > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> >
> > The LCD controller (LCDC) on the RZ/V2H(P) SoC is composed of Frame Compression Processor (FCPVD),
> > Video Signal Processor (VSPD), and Display Unit (DU).
> >
> > There is one LCDC unit available on the RZ/V2H(P) SoC which is connected to the DSI.
> >
> > 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>
>
> This patch is already applied in drm-misc-next [1]
> [1] https://cgit.freedesktop.org/drm/drm-misc/commit/?id=1f957fbb88b61eaf5ac9bf2db6bc2e54121a4359
>
Thanks Biju.
Cheers,
Prabhakar
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v6 05/12] drm: renesas: rz-du: mipi_dsi: Use VCLK for HSFREQ calculation
2025-05-30 16:58 ` [PATCH v6 05/12] drm: renesas: rz-du: mipi_dsi: Use VCLK for " Prabhakar
@ 2025-06-02 9:42 ` Laurent Pinchart
2025-06-02 10:09 ` Lad, Prabhakar
0 siblings, 1 reply; 21+ messages in thread
From: Laurent Pinchart @ 2025-06-02 9:42 UTC (permalink / raw)
To: Prabhakar
Cc: Biju Das, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Philipp Zabel, Geert Uytterhoeven, Magnus Damm,
dri-devel, linux-renesas-soc, devicetree, linux-kernel,
Fabrizio Castro, Lad Prabhakar
Hi Prabhakar,
Thank you for the patch.
On Fri, May 30, 2025 at 05:58:59PM +0100, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> 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>
> ---
> v5->v6:
> - Dropped parentheses around the calculation of `hsfreq_max`.
> - Changed dev_info() to dev_dbg
>
> v4->v5:
> - Added dev_info() to print the VCLK rate if it doesn't match the
> requested rate.
> - Added Reviewed-by tag from Biju
>
> v3->v4:
> - Used MILLI instead of KILO
>
> v2->v3:
> - No changes
>
> v1->v2:
> - No changes
> ---
> .../gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 30 +++++++++++--------
> 1 file changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
> index e8ca6a521e0f..4d4521a231cb 100644
> --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
> +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
> @@ -8,6 +8,7 @@
> #include <linux/delay.h>
> #include <linux/io.h>
> #include <linux/iopoll.h>
> +#include <linux/math.h>
> #include <linux/module.h>
> #include <linux/of.h>
> #include <linux/of_graph.h>
> @@ -15,6 +16,7 @@
> #include <linux/pm_runtime.h>
> #include <linux/reset.h>
> #include <linux/slab.h>
> +#include <linux/units.h>
>
> #include <drm/drm_atomic.h>
> #include <drm/drm_atomic_helper.h>
> @@ -199,7 +201,7 @@ static int rzg2l_mipi_dsi_dphy_init(struct rzg2l_mipi_dsi *dsi,
> /* All DSI global operation timings are set with recommended setting */
> for (i = 0; i < ARRAY_SIZE(rzg2l_mipi_dsi_global_timings); ++i) {
> dphy_timings = &rzg2l_mipi_dsi_global_timings[i];
> - if (hsfreq <= dphy_timings->hsfreq_max)
> + if (hsfreq <= dphy_timings->hsfreq_max * KILO)
Why don't you modify hsfreq_max to also store the frequency in Hz ? That
would bring more consistency across the driver.
> break;
> }
>
> @@ -258,7 +260,7 @@ static void rzg2l_mipi_dsi_dphy_exit(struct rzg2l_mipi_dsi *dsi)
> static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
> const struct drm_display_mode *mode)
> {
> - unsigned long hsfreq;
> + unsigned long hsfreq, vclk_rate;
> unsigned int bpp;
> u32 txsetr;
> u32 clstptsetr;
> @@ -269,6 +271,12 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
> u32 golpbkt;
> int ret;
>
> + ret = pm_runtime_resume_and_get(dsi->dev);
> + if (ret < 0)
> + return ret;
> +
> + clk_set_rate(dsi->vclk, mode->clock * KILO);
> +
> /*
> * Relationship between hsclk and vclk must follow
> * vclk * bpp = hsclk * 8 * lanes
> @@ -280,13 +288,11 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
> * hsclk(bit) = hsclk(byte) * 8 = hsfreq
> */
> bpp = mipi_dsi_pixel_format_to_bpp(dsi->format);
> - hsfreq = mode->clock * bpp / dsi->lanes;
> -
> - ret = pm_runtime_resume_and_get(dsi->dev);
> - if (ret < 0)
> - return ret;
> -
> - clk_set_rate(dsi->vclk, mode->clock * 1000);
> + vclk_rate = clk_get_rate(dsi->vclk);
> + if (vclk_rate != mode->clock * KILO)
> + dev_dbg(dsi->dev, "Requested vclk rate %lu, actual %lu mismatch\n",
> + mode->clock * KILO, vclk_rate);
I would move those 4 lines just below clk_set_rate().
With those comments addressed,
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> + hsfreq = DIV_ROUND_CLOSEST_ULL(vclk_rate * bpp, dsi->lanes);
>
> ret = rzg2l_mipi_dsi_dphy_init(dsi, hsfreq);
> if (ret < 0)
> @@ -304,12 +310,12 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
> * - data lanes: maximum 4 lanes
> * Therefore maximum hsclk will be 891 Mbps.
> */
> - if (hsfreq > 445500) {
> + if (hsfreq > 445500000) {
> clkkpt = 12;
> clkbfht = 15;
> clkstpt = 48;
> golpbkt = 75;
> - } else if (hsfreq > 250000) {
> + } else if (hsfreq > 250000000) {
> clkkpt = 7;
> clkbfht = 8;
> clkstpt = 27;
> @@ -754,7 +760,7 @@ static int rzg2l_mipi_dsi_probe(struct platform_device *pdev)
> * mode->clock and format are not available. So initialize DPHY with
> * timing parameters for 80Mbps.
> */
> - ret = rzg2l_mipi_dsi_dphy_init(dsi, 80000);
> + ret = rzg2l_mipi_dsi_dphy_init(dsi, 80000000);
> if (ret < 0)
> goto err_phy;
>
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v6 12/12] drm: renesas: rz-du: mipi_dsi: Add support for LPCLK clock handling
2025-05-30 16:59 ` [PATCH v6 12/12] drm: renesas: rz-du: mipi_dsi: Add support for LPCLK clock handling Prabhakar
@ 2025-06-02 9:42 ` Laurent Pinchart
0 siblings, 0 replies; 21+ messages in thread
From: Laurent Pinchart @ 2025-06-02 9:42 UTC (permalink / raw)
To: Prabhakar
Cc: Biju Das, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Philipp Zabel, Geert Uytterhoeven, Magnus Damm,
dri-devel, linux-renesas-soc, devicetree, linux-kernel,
Fabrizio Castro, Lad Prabhakar
Hi Prabhakar,
Thank you for the patch.
On Fri, May 30, 2025 at 05:59:06PM +0100, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Add LPCLK clock support in the RZ/G2L MIPI DSI driver via the optional
> clock API. This clock is required by some SoCs like RZ/V2H(P) for proper
> DPHY configuration, whereas it is absent on others like RZ/G2L.
>
> Introduce a new `lpclk` field in the `rzg2l_mipi_dsi` structure and
> conditionally acquire the "lpclk" clock using `devm_clk_get_optional()`
> during probe. This allows LPCLK-aware SoCs to pass the clock via device
> tree without impacting existing platforms.
>
> 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>
> ---
> v5->v6:
> - No changes
>
> v4->v5:
> - Made use of devm_clk_get_optional() for lpclk
> - Added Reviewed tag from Biju
>
> v3->v4
> - No changes
>
> v2->v3:
> - No changes
>
> v1->v2:
> - Added LPCLK as feature flag
> ---
> drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
> index f9f2d883c40d..a31f9b6aa920 100644
> --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
> +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
> @@ -62,6 +62,7 @@ struct rzg2l_mipi_dsi {
> struct drm_bridge *next_bridge;
>
> struct clk *vclk;
> + struct clk *lpclk;
>
> enum mipi_dsi_pixel_format format;
> unsigned int num_data_lanes;
> @@ -791,6 +792,10 @@ static int rzg2l_mipi_dsi_probe(struct platform_device *pdev)
> if (IS_ERR(dsi->vclk))
> return PTR_ERR(dsi->vclk);
>
> + dsi->lpclk = devm_clk_get_optional(dsi->dev, "lpclk");
> + if (IS_ERR(dsi->lpclk))
> + return PTR_ERR(dsi->lpclk);
> +
This clock isn't used in this series, it will only be used when you will
submit the next version of "[PATCH v4 15/15] drm: renesas: rz-du:
mipi_dsi: Add support for RZ/V2H(P) SoC". As this patch doesn't bring
any used feature, I'm tempted to say it could be bundled with the
RZ/V2H(P) support patch.
> dsi->rstc = devm_reset_control_get_optional_exclusive(dsi->dev, "rst");
> if (IS_ERR(dsi->rstc))
> return dev_err_probe(dsi->dev, PTR_ERR(dsi->rstc),
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v6 05/12] drm: renesas: rz-du: mipi_dsi: Use VCLK for HSFREQ calculation
2025-06-02 9:42 ` Laurent Pinchart
@ 2025-06-02 10:09 ` Lad, Prabhakar
2025-06-02 11:10 ` Laurent Pinchart
0 siblings, 1 reply; 21+ messages in thread
From: Lad, Prabhakar @ 2025-06-02 10:09 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Biju Das, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Philipp Zabel, Geert Uytterhoeven, Magnus Damm,
dri-devel, linux-renesas-soc, devicetree, linux-kernel,
Fabrizio Castro, Lad Prabhakar
Hi Laurent,
Thank you for the review.
On Mon, Jun 2, 2025 at 10:42 AM Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>
> Hi Prabhakar,
>
> Thank you for the patch.
>
> On Fri, May 30, 2025 at 05:58:59PM +0100, Prabhakar wrote:
> > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> >
> > 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>
> > ---
> > v5->v6:
> > - Dropped parentheses around the calculation of `hsfreq_max`.
> > - Changed dev_info() to dev_dbg
> >
> > v4->v5:
> > - Added dev_info() to print the VCLK rate if it doesn't match the
> > requested rate.
> > - Added Reviewed-by tag from Biju
> >
> > v3->v4:
> > - Used MILLI instead of KILO
> >
> > v2->v3:
> > - No changes
> >
> > v1->v2:
> > - No changes
> > ---
> > .../gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 30 +++++++++++--------
> > 1 file changed, 18 insertions(+), 12 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
> > index e8ca6a521e0f..4d4521a231cb 100644
> > --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
> > +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
> > @@ -8,6 +8,7 @@
> > #include <linux/delay.h>
> > #include <linux/io.h>
> > #include <linux/iopoll.h>
> > +#include <linux/math.h>
> > #include <linux/module.h>
> > #include <linux/of.h>
> > #include <linux/of_graph.h>
> > @@ -15,6 +16,7 @@
> > #include <linux/pm_runtime.h>
> > #include <linux/reset.h>
> > #include <linux/slab.h>
> > +#include <linux/units.h>
> >
> > #include <drm/drm_atomic.h>
> > #include <drm/drm_atomic_helper.h>
> > @@ -199,7 +201,7 @@ static int rzg2l_mipi_dsi_dphy_init(struct rzg2l_mipi_dsi *dsi,
> > /* All DSI global operation timings are set with recommended setting */
> > for (i = 0; i < ARRAY_SIZE(rzg2l_mipi_dsi_global_timings); ++i) {
> > dphy_timings = &rzg2l_mipi_dsi_global_timings[i];
> > - if (hsfreq <= dphy_timings->hsfreq_max)
> > + if (hsfreq <= dphy_timings->hsfreq_max * KILO)
>
> Why don't you modify hsfreq_max to also store the frequency in Hz ? That
> would bring more consistency across the driver.
>
Agreed, I will add a separate patch for this.
> > break;
> > }
> >
> > @@ -258,7 +260,7 @@ static void rzg2l_mipi_dsi_dphy_exit(struct rzg2l_mipi_dsi *dsi)
> > static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
> > const struct drm_display_mode *mode)
> > {
> > - unsigned long hsfreq;
> > + unsigned long hsfreq, vclk_rate;
> > unsigned int bpp;
> > u32 txsetr;
> > u32 clstptsetr;
> > @@ -269,6 +271,12 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
> > u32 golpbkt;
> > int ret;
> >
> > + ret = pm_runtime_resume_and_get(dsi->dev);
> > + if (ret < 0)
> > + return ret;
> > +
> > + clk_set_rate(dsi->vclk, mode->clock * KILO);
> > +
> > /*
> > * Relationship between hsclk and vclk must follow
> > * vclk * bpp = hsclk * 8 * lanes
> > @@ -280,13 +288,11 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
> > * hsclk(bit) = hsclk(byte) * 8 = hsfreq
> > */
> > bpp = mipi_dsi_pixel_format_to_bpp(dsi->format);
> > - hsfreq = mode->clock * bpp / dsi->lanes;
> > -
> > - ret = pm_runtime_resume_and_get(dsi->dev);
> > - if (ret < 0)
> > - return ret;
> > -
> > - clk_set_rate(dsi->vclk, mode->clock * 1000);
> > + vclk_rate = clk_get_rate(dsi->vclk);
> > + if (vclk_rate != mode->clock * KILO)
> > + dev_dbg(dsi->dev, "Requested vclk rate %lu, actual %lu mismatch\n",
> > + mode->clock * KILO, vclk_rate);
>
> I would move those 4 lines just below clk_set_rate().
>
Agreed, I will move them in the next version.
Cheers,
Prabhakar
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v6 05/12] drm: renesas: rz-du: mipi_dsi: Use VCLK for HSFREQ calculation
2025-06-02 10:09 ` Lad, Prabhakar
@ 2025-06-02 11:10 ` Laurent Pinchart
0 siblings, 0 replies; 21+ messages in thread
From: Laurent Pinchart @ 2025-06-02 11:10 UTC (permalink / raw)
To: Lad, Prabhakar
Cc: Biju Das, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Philipp Zabel, Geert Uytterhoeven, Magnus Damm,
dri-devel, linux-renesas-soc, devicetree, linux-kernel,
Fabrizio Castro, Lad Prabhakar
On Mon, Jun 02, 2025 at 11:09:51AM +0100, Lad, Prabhakar wrote:
> On Mon, Jun 2, 2025 at 10:42 AM Laurent Pinchart wrote:
> > On Fri, May 30, 2025 at 05:58:59PM +0100, Prabhakar wrote:
> > > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > >
> > > 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>
> > > ---
> > > v5->v6:
> > > - Dropped parentheses around the calculation of `hsfreq_max`.
> > > - Changed dev_info() to dev_dbg
> > >
> > > v4->v5:
> > > - Added dev_info() to print the VCLK rate if it doesn't match the
> > > requested rate.
> > > - Added Reviewed-by tag from Biju
> > >
> > > v3->v4:
> > > - Used MILLI instead of KILO
> > >
> > > v2->v3:
> > > - No changes
> > >
> > > v1->v2:
> > > - No changes
> > > ---
> > > .../gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 30 +++++++++++--------
> > > 1 file changed, 18 insertions(+), 12 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
> > > index e8ca6a521e0f..4d4521a231cb 100644
> > > --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
> > > +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
> > > @@ -8,6 +8,7 @@
> > > #include <linux/delay.h>
> > > #include <linux/io.h>
> > > #include <linux/iopoll.h>
> > > +#include <linux/math.h>
> > > #include <linux/module.h>
> > > #include <linux/of.h>
> > > #include <linux/of_graph.h>
> > > @@ -15,6 +16,7 @@
> > > #include <linux/pm_runtime.h>
> > > #include <linux/reset.h>
> > > #include <linux/slab.h>
> > > +#include <linux/units.h>
> > >
> > > #include <drm/drm_atomic.h>
> > > #include <drm/drm_atomic_helper.h>
> > > @@ -199,7 +201,7 @@ static int rzg2l_mipi_dsi_dphy_init(struct rzg2l_mipi_dsi *dsi,
> > > /* All DSI global operation timings are set with recommended setting */
> > > for (i = 0; i < ARRAY_SIZE(rzg2l_mipi_dsi_global_timings); ++i) {
> > > dphy_timings = &rzg2l_mipi_dsi_global_timings[i];
> > > - if (hsfreq <= dphy_timings->hsfreq_max)
> > > + if (hsfreq <= dphy_timings->hsfreq_max * KILO)
> >
> > Why don't you modify hsfreq_max to also store the frequency in Hz ? That
> > would bring more consistency across the driver.
>
> Agreed, I will add a separate patch for this.
It's small and related, you can do it in the same patch.
>
> > > break;
> > > }
> > >
> > > @@ -258,7 +260,7 @@ static void rzg2l_mipi_dsi_dphy_exit(struct rzg2l_mipi_dsi *dsi)
> > > static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
> > > const struct drm_display_mode *mode)
> > > {
> > > - unsigned long hsfreq;
> > > + unsigned long hsfreq, vclk_rate;
> > > unsigned int bpp;
> > > u32 txsetr;
> > > u32 clstptsetr;
> > > @@ -269,6 +271,12 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
> > > u32 golpbkt;
> > > int ret;
> > >
> > > + ret = pm_runtime_resume_and_get(dsi->dev);
> > > + if (ret < 0)
> > > + return ret;
> > > +
> > > + clk_set_rate(dsi->vclk, mode->clock * KILO);
> > > +
> > > /*
> > > * Relationship between hsclk and vclk must follow
> > > * vclk * bpp = hsclk * 8 * lanes
> > > @@ -280,13 +288,11 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi,
> > > * hsclk(bit) = hsclk(byte) * 8 = hsfreq
> > > */
> > > bpp = mipi_dsi_pixel_format_to_bpp(dsi->format);
> > > - hsfreq = mode->clock * bpp / dsi->lanes;
> > > -
> > > - ret = pm_runtime_resume_and_get(dsi->dev);
> > > - if (ret < 0)
> > > - return ret;
> > > -
> > > - clk_set_rate(dsi->vclk, mode->clock * 1000);
> > > + vclk_rate = clk_get_rate(dsi->vclk);
> > > + if (vclk_rate != mode->clock * KILO)
> > > + dev_dbg(dsi->dev, "Requested vclk rate %lu, actual %lu mismatch\n",
> > > + mode->clock * KILO, vclk_rate);
> >
> > I would move those 4 lines just below clk_set_rate().
>
> Agreed, I will move them in the next version.
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2025-06-02 11:10 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-30 16:58 [PATCH v6 00/12] Add DU support for RZ/V2H(P) SoC Prabhakar
2025-05-30 16:58 ` [PATCH v6 01/12] dt-bindings: display: renesas,rzg2l-du: Add " Prabhakar
2025-05-31 6:35 ` Biju Das
2025-06-02 8:35 ` Lad, Prabhakar
2025-05-30 16:58 ` [PATCH v6 02/12] drm: renesas: rz-du: " Prabhakar
2025-05-31 6:36 ` Biju Das
2025-06-02 8:36 ` Lad, Prabhakar
2025-05-30 16:58 ` [PATCH v6 03/12] drm: renesas: rz-du: mipi_dsi: Add min check for VCLK range Prabhakar
2025-05-30 16:58 ` [PATCH v6 04/12] drm: renesas: rz-du: mipi_dsi: Simplify HSFREQ calculation Prabhakar
2025-05-30 16:58 ` [PATCH v6 05/12] drm: renesas: rz-du: mipi_dsi: Use VCLK for " Prabhakar
2025-06-02 9:42 ` Laurent Pinchart
2025-06-02 10:09 ` Lad, Prabhakar
2025-06-02 11:10 ` Laurent Pinchart
2025-05-30 16:59 ` [PATCH v6 06/12] drm: renesas: rz-du: mipi_dsi: Add OF data support Prabhakar
2025-05-30 16:59 ` [PATCH v6 07/12] drm: renesas: rz-du: mipi_dsi: Make "rst" reset control optional for RZ/V2H(P) Prabhakar
2025-05-30 16:59 ` [PATCH v6 08/12] drm: renesas: rz-du: mipi_dsi: Use mHz for D-PHY frequency calculations Prabhakar
2025-05-30 16:59 ` [PATCH v6 09/12] drm: renesas: rz-du: mipi_dsi: Add feature flag for 16BPP support Prabhakar
2025-05-30 16:59 ` [PATCH v6 10/12] drm: renesas: rz-du: mipi_dsi: Add dphy_late_init() callback for RZ/V2H(P) Prabhakar
2025-05-30 16:59 ` [PATCH v6 11/12] drm: renesas: rz-du: mipi_dsi: Add function pointers for configuring VCLK and mode validation Prabhakar
2025-05-30 16:59 ` [PATCH v6 12/12] drm: renesas: rz-du: mipi_dsi: Add support for LPCLK clock handling Prabhakar
2025-06-02 9:42 ` Laurent Pinchart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).