diff options
author | Lucas Stach <l.stach@pengutronix.de> | 2020-11-21 18:23:05 +0100 |
---|---|---|
committer | Lucas Stach <l.stach@pengutronix.de> | 2021-07-21 22:27:09 +0200 |
commit | 2e2b6854895cfe7a1eb216def7fc870ba41dba06 (patch) | |
tree | dee891a2cedd3c497587de7da6958cb396aa4086 | |
parent | d4612a10b4c3ca74ec7344080639dfb945442cbf (diff) | |
download | linux-2e2b6854895cfe7a1eb216def7fc870ba41dba06.tar.gz linux-2e2b6854895cfe7a1eb216def7fc870ba41dba06.tar.xz |
drm/bridge: samsung-dsim: fix horizontal blanking
The horizontal blanking is specified in MIPI word counts and is now already
scaled to the format and lane count, but it still misses to take into account
the overhead of a MIPI packet. Without this overhead substracted the horizontal
blanking times are slightly off, which confuses some displays. Fix it.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
-rw-r--r-- | drivers/gpu/drm/bridge/samsung-dsim.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index 4f9c54d5cf7a..1ecbba2c5fca 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -736,27 +736,34 @@ static int samsung_dsim_init_link(struct samsung_dsim *dsi) return 0; } +#define MIPI_PKT_OVERHEAD 6 + static void samsung_dsim_set_display_mode(struct samsung_dsim *dsi) { struct drm_display_mode *m = &dsi->mode; unsigned int num_bits_resol = dsi->driver_data->num_bits_resol; - int bpp; u32 reg; if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO) { - bpp = mipi_dsi_pixel_format_to_bpp(dsi->format) / 8; + int bpp = mipi_dsi_pixel_format_to_bpp(dsi->format) / 8; + int hfp = (m->hsync_start - m->hdisplay) * bpp / dsi->lanes; + int hbp = (m->htotal - m->hsync_end) * bpp / dsi->lanes; + int hsa = (m->hsync_end - m->hsync_start) * bpp / dsi->lanes; + + hfp = max(hfp - MIPI_PKT_OVERHEAD, MIPI_PKT_OVERHEAD); + hbp = max(hbp - MIPI_PKT_OVERHEAD, MIPI_PKT_OVERHEAD); + hsa = max(hsa - MIPI_PKT_OVERHEAD, MIPI_PKT_OVERHEAD); reg = DSIM_CMD_ALLOW(0xf) | DSIM_STABLE_VFP(m->vsync_start - m->vdisplay) | DSIM_MAIN_VBP(m->vtotal - m->vsync_end); samsung_dsim_write(dsi, DSIM_MVPORCH_REG, reg); - reg = DSIM_MAIN_HFP((m->hsync_start - m->hdisplay) * bpp / dsi->lanes) - | DSIM_MAIN_HBP((m->htotal - m->hsync_end) * bpp / dsi->lanes); + reg = DSIM_MAIN_HFP(hfp) | DSIM_MAIN_HBP(hbp); samsung_dsim_write(dsi, DSIM_MHPORCH_REG, reg); reg = DSIM_MAIN_VSA(m->vsync_end - m->vsync_start) - | DSIM_MAIN_HSA((m->hsync_end - m->hsync_start) * bpp / dsi->lanes); + | DSIM_MAIN_HSA(hsa); samsung_dsim_write(dsi, DSIM_MSYNC_REG, reg); } reg = DSIM_MAIN_HRESOL(m->hdisplay, num_bits_resol) | |