Skip to content

Commit fb797a7

Browse files
seebebijudas
authored andcommitted
drm: renesas: rz-du: mipi_dsi: Set DSI divider
Before the MIPI DSI clock source can be configured, the target divide ratio needs to be set. Signed-off-by: Chris Brandt <[email protected]> Reviewed-by: Biju Das <[email protected]> Tested-by: Biju Das <[email protected]> Fixes: 5a4326f ("clk: renesas: rzg2l: Remove DSI clock rate restrictions") Link: https://patch.msgid.link/[email protected] Signed-off-by: Biju Das <[email protected]>
1 parent 89ff453 commit fb797a7

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,7 @@ static int rzg2l_mipi_dsi_host_attach(struct mipi_dsi_host *host,
11221122
struct mipi_dsi_device *device)
11231123
{
11241124
struct rzg2l_mipi_dsi *dsi = host_to_rzg2l_mipi_dsi(host);
1125+
int bpp;
11251126
int ret;
11261127

11271128
if (device->lanes > dsi->num_data_lanes) {
@@ -1131,7 +1132,8 @@ static int rzg2l_mipi_dsi_host_attach(struct mipi_dsi_host *host,
11311132
return -EINVAL;
11321133
}
11331134

1134-
switch (mipi_dsi_pixel_format_to_bpp(device->format)) {
1135+
bpp = mipi_dsi_pixel_format_to_bpp(device->format);
1136+
switch (bpp) {
11351137
case 24:
11361138
break;
11371139
case 18:
@@ -1162,6 +1164,18 @@ static int rzg2l_mipi_dsi_host_attach(struct mipi_dsi_host *host,
11621164

11631165
drm_bridge_add(&dsi->bridge);
11641166

1167+
/*
1168+
* Report the required division ratio setting for the MIPI clock dividers.
1169+
*
1170+
* vclk * bpp = hsclk * 8 * num_lanes
1171+
*
1172+
* vclk * DSI_AB_divider = hsclk * 16
1173+
*
1174+
* which simplifies to...
1175+
* DSI_AB_divider = bpp * 2 / num_lanes
1176+
*/
1177+
rzg2l_cpg_dsi_div_set_divider(bpp * 2 / dsi->lanes, PLL5_TARGET_DSI);
1178+
11651179
return 0;
11661180
}
11671181

0 commit comments

Comments
 (0)