Skip to content

Commit d45618c

Browse files
committed
Merge tag 'mediatek-drm-fixes-5.10' of https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux into drm-fixes
Mediatek DRM Fixes for Linux 5.10 1. Remove unused variable. 2. Modify horizontal front/back porch byte formula. Signed-off-by: Dave Airlie <airlied@redhat.com> From: Chun-Kuang Hu <chunkuang.hu@kernel.org> Link: https://patchwork.freedesktop.org/patch/msgid/20201123234131.387-1-chunkuang.hu@kernel.org
2 parents 5929dd8 + 487778f commit d45618c

2 files changed

Lines changed: 22 additions & 48 deletions

File tree

drivers/gpu/drm/mediatek/mtk_dpi.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -522,15 +522,6 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
522522
return 0;
523523
}
524524

525-
static void mtk_dpi_encoder_destroy(struct drm_encoder *encoder)
526-
{
527-
drm_encoder_cleanup(encoder);
528-
}
529-
530-
static const struct drm_encoder_funcs mtk_dpi_encoder_funcs = {
531-
.destroy = mtk_dpi_encoder_destroy,
532-
};
533-
534525
static int mtk_dpi_bridge_attach(struct drm_bridge *bridge,
535526
enum drm_bridge_attach_flags flags)
536527
{

drivers/gpu/drm/mediatek/mtk_dsi.c

Lines changed: 22 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,10 @@ static void mtk_dsi_config_vdo_timing(struct mtk_dsi *dsi)
444444
u32 horizontal_sync_active_byte;
445445
u32 horizontal_backporch_byte;
446446
u32 horizontal_frontporch_byte;
447+
u32 horizontal_front_back_byte;
448+
u32 data_phy_cycles_byte;
447449
u32 dsi_tmp_buf_bpp, data_phy_cycles;
450+
u32 delta;
448451
struct mtk_phy_timing *timing = &dsi->phy_timing;
449452

450453
struct videomode *vm = &dsi->vm;
@@ -466,50 +469,30 @@ static void mtk_dsi_config_vdo_timing(struct mtk_dsi *dsi)
466469
horizontal_sync_active_byte = (vm->hsync_len * dsi_tmp_buf_bpp - 10);
467470

468471
if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE)
469-
horizontal_backporch_byte = vm->hback_porch * dsi_tmp_buf_bpp;
472+
horizontal_backporch_byte = vm->hback_porch * dsi_tmp_buf_bpp - 10;
470473
else
471474
horizontal_backporch_byte = (vm->hback_porch + vm->hsync_len) *
472-
dsi_tmp_buf_bpp;
475+
dsi_tmp_buf_bpp - 10;
473476

474477
data_phy_cycles = timing->lpx + timing->da_hs_prepare +
475-
timing->da_hs_zero + timing->da_hs_exit;
476-
477-
if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) {
478-
if ((vm->hfront_porch + vm->hback_porch) * dsi_tmp_buf_bpp >
479-
data_phy_cycles * dsi->lanes + 18) {
480-
horizontal_frontporch_byte =
481-
vm->hfront_porch * dsi_tmp_buf_bpp -
482-
(data_phy_cycles * dsi->lanes + 18) *
483-
vm->hfront_porch /
484-
(vm->hfront_porch + vm->hback_porch);
485-
486-
horizontal_backporch_byte =
487-
horizontal_backporch_byte -
488-
(data_phy_cycles * dsi->lanes + 18) *
489-
vm->hback_porch /
490-
(vm->hfront_porch + vm->hback_porch);
491-
} else {
492-
DRM_WARN("HFP less than d-phy, FPS will under 60Hz\n");
493-
horizontal_frontporch_byte = vm->hfront_porch *
494-
dsi_tmp_buf_bpp;
495-
}
478+
timing->da_hs_zero + timing->da_hs_exit + 3;
479+
480+
delta = dsi->mode_flags & MIPI_DSI_MODE_VIDEO_BURST ? 18 : 12;
481+
482+
horizontal_frontporch_byte = vm->hfront_porch * dsi_tmp_buf_bpp;
483+
horizontal_front_back_byte = horizontal_frontporch_byte + horizontal_backporch_byte;
484+
data_phy_cycles_byte = data_phy_cycles * dsi->lanes + delta;
485+
486+
if (horizontal_front_back_byte > data_phy_cycles_byte) {
487+
horizontal_frontporch_byte -= data_phy_cycles_byte *
488+
horizontal_frontporch_byte /
489+
horizontal_front_back_byte;
490+
491+
horizontal_backporch_byte -= data_phy_cycles_byte *
492+
horizontal_backporch_byte /
493+
horizontal_front_back_byte;
496494
} else {
497-
if ((vm->hfront_porch + vm->hback_porch) * dsi_tmp_buf_bpp >
498-
data_phy_cycles * dsi->lanes + 12) {
499-
horizontal_frontporch_byte =
500-
vm->hfront_porch * dsi_tmp_buf_bpp -
501-
(data_phy_cycles * dsi->lanes + 12) *
502-
vm->hfront_porch /
503-
(vm->hfront_porch + vm->hback_porch);
504-
horizontal_backporch_byte = horizontal_backporch_byte -
505-
(data_phy_cycles * dsi->lanes + 12) *
506-
vm->hback_porch /
507-
(vm->hfront_porch + vm->hback_porch);
508-
} else {
509-
DRM_WARN("HFP less than d-phy, FPS will under 60Hz\n");
510-
horizontal_frontporch_byte = vm->hfront_porch *
511-
dsi_tmp_buf_bpp;
512-
}
495+
DRM_WARN("HFP + HBP less than d-phy, FPS will under 60Hz\n");
513496
}
514497

515498
writel(horizontal_sync_active_byte, dsi->regs + DSI_HSA_WC);

0 commit comments

Comments
 (0)