Skip to content

Commit ca3e6fc

Browse files
committed
drm/bridge: cdns-dsi: Fix event mode
The timings calculation gets it wrong for DSI event mode, resulting in too large hbp value. Fix the issue by taking into account the pulse/event mode difference. Tested-by: Parth Pancholi <parth.pancholi@toradex.com> Reviewed-by: Jayesh Choudhary <j-choudhary@ti.com> Tested-by: Jayesh Choudhary <j-choudhary@ti.com> Reviewed-by: Devarsh Thakkar <devarsht@ti.com> Link: https://lore.kernel.org/r/20250723-cdns-dsi-impro-v5-13-e61cc06074c2@ideasonboard.com Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
1 parent ce4bc5c commit ca3e6fc

1 file changed

Lines changed: 20 additions & 11 deletions

File tree

drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,8 @@
418418
#define DSI_OUTPUT_PORT 0
419419
#define DSI_INPUT_PORT(inputid) (1 + (inputid))
420420

421-
#define DSI_HBP_FRAME_OVERHEAD 12
421+
#define DSI_HBP_FRAME_PULSE_OVERHEAD 12
422+
#define DSI_HBP_FRAME_EVENT_OVERHEAD 16
422423
#define DSI_HSA_FRAME_OVERHEAD 14
423424
#define DSI_HFP_FRAME_OVERHEAD 6
424425
#define DSI_HSS_VSS_VSE_FRAME_OVERHEAD 4
@@ -487,23 +488,31 @@ static int cdns_dsi_mode2cfg(struct cdns_dsi *dsi,
487488

488489
bpp = mipi_dsi_pixel_format_to_bpp(output->dev->format);
489490

490-
dsi_cfg->hbp = dpi_to_dsi_timing(dpi_hbp + (sync_pulse ? 0 : dpi_hsa),
491-
bpp, DSI_HBP_FRAME_OVERHEAD);
491+
if (sync_pulse) {
492+
dsi_cfg->hbp = dpi_to_dsi_timing(dpi_hbp, bpp,
493+
DSI_HBP_FRAME_PULSE_OVERHEAD);
492494

493-
if (sync_pulse)
494-
dsi_cfg->hsa =
495-
dpi_to_dsi_timing(dpi_hsa, bpp, DSI_HSA_FRAME_OVERHEAD);
495+
dsi_cfg->hsa = dpi_to_dsi_timing(dpi_hsa, bpp,
496+
DSI_HSA_FRAME_OVERHEAD);
497+
} else {
498+
dsi_cfg->hbp = dpi_to_dsi_timing(dpi_hbp + dpi_hsa, bpp,
499+
DSI_HBP_FRAME_EVENT_OVERHEAD);
500+
501+
dsi_cfg->hsa = 0;
502+
}
496503

497504
dsi_cfg->hact = dpi_to_dsi_timing(dpi_hact, bpp, 0);
498505

499506
dsi_cfg->hfp = dpi_to_dsi_timing(dpi_hfp, bpp, DSI_HFP_FRAME_OVERHEAD);
500507

501-
dsi_cfg->htotal = dsi_cfg->hbp + DSI_HBP_FRAME_OVERHEAD;
502-
if (output->dev->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE)
503-
dsi_cfg->htotal += dsi_cfg->hsa + DSI_HSA_FRAME_OVERHEAD;
508+
dsi_cfg->htotal = dsi_cfg->hact + dsi_cfg->hfp + DSI_HFP_FRAME_OVERHEAD;
504509

505-
dsi_cfg->htotal += dsi_cfg->hact;
506-
dsi_cfg->htotal += dsi_cfg->hfp + DSI_HFP_FRAME_OVERHEAD;
510+
if (sync_pulse) {
511+
dsi_cfg->htotal += dsi_cfg->hbp + DSI_HBP_FRAME_PULSE_OVERHEAD;
512+
dsi_cfg->htotal += dsi_cfg->hsa + DSI_HSA_FRAME_OVERHEAD;
513+
} else {
514+
dsi_cfg->htotal += dsi_cfg->hbp + DSI_HBP_FRAME_EVENT_OVERHEAD;
515+
}
507516

508517
return 0;
509518
}

0 commit comments

Comments
 (0)