diff options
| author | Andrey Gusakov <andrey.gusakov@cogentembedded.com> | 2017-11-07 11:56:22 -0500 |
|---|---|---|
| committer | Andrzej Hajda <a.hajda@samsung.com> | 2017-11-30 01:56:08 -0500 |
| commit | 66d1c3b94d5d59e4325e61a78d520f92c043d645 (patch) | |
| tree | 71480f2b2e2e3a7ab8387b4008bf14dfa5d9bd59 | |
| parent | f3b8adbe1911f66fd3cab1aaa74f0f66b7ceda25 (diff) | |
drm/bridge: tc358767: fix timing calculations
Fields in HTIM01 and HTIM02 regs should be even.
Recomended thresh_dly value is max_tu_symbol.
Remove set of VPCTRL0.VSDELAY as it is related to DSI input
interface. Currently driver supports only DPI.
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1510073785-16108-5-git-send-email-andrey.gusakov@cogentembedded.com
| -rw-r--r-- | drivers/gpu/drm/bridge/tc358767.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 7334cb2121a3..b916346b933a 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c | |||
| @@ -659,6 +659,14 @@ static int tc_set_video_mode(struct tc_data *tc, struct drm_display_mode *mode) | |||
| 659 | int lower_margin = mode->vsync_start - mode->vdisplay; | 659 | int lower_margin = mode->vsync_start - mode->vdisplay; |
| 660 | int vsync_len = mode->vsync_end - mode->vsync_start; | 660 | int vsync_len = mode->vsync_end - mode->vsync_start; |
| 661 | 661 | ||
| 662 | /* | ||
| 663 | * Recommended maximum number of symbols transferred in a transfer unit: | ||
| 664 | * DIV_ROUND_UP((input active video bandwidth in bytes) * tu_size, | ||
| 665 | * (output active video bandwidth in bytes)) | ||
| 666 | * Must be less than tu_size. | ||
| 667 | */ | ||
| 668 | max_tu_symbol = TU_SIZE_RECOMMENDED - 1; | ||
| 669 | |||
| 662 | dev_dbg(tc->dev, "set mode %dx%d\n", | 670 | dev_dbg(tc->dev, "set mode %dx%d\n", |
| 663 | mode->hdisplay, mode->vdisplay); | 671 | mode->hdisplay, mode->vdisplay); |
| 664 | dev_dbg(tc->dev, "H margin %d,%d sync %d\n", | 672 | dev_dbg(tc->dev, "H margin %d,%d sync %d\n", |
| @@ -668,13 +676,18 @@ static int tc_set_video_mode(struct tc_data *tc, struct drm_display_mode *mode) | |||
| 668 | dev_dbg(tc->dev, "total: %dx%d\n", mode->htotal, mode->vtotal); | 676 | dev_dbg(tc->dev, "total: %dx%d\n", mode->htotal, mode->vtotal); |
| 669 | 677 | ||
| 670 | 678 | ||
| 671 | /* LCD Ctl Frame Size */ | 679 | /* |
| 672 | tc_write(VPCTRL0, (0x40 << 20) /* VSDELAY */ | | 680 | * LCD Ctl Frame Size |
| 681 | * datasheet is not clear of vsdelay in case of DPI | ||
| 682 | * assume we do not need any delay when DPI is a source of | ||
| 683 | * sync signals | ||
| 684 | */ | ||
| 685 | tc_write(VPCTRL0, (0 << 20) /* VSDELAY */ | | ||
| 673 | OPXLFMT_RGB888 | FRMSYNC_DISABLED | MSF_DISABLED); | 686 | OPXLFMT_RGB888 | FRMSYNC_DISABLED | MSF_DISABLED); |
| 674 | tc_write(HTIM01, (left_margin << 16) | /* H back porch */ | 687 | tc_write(HTIM01, (ALIGN(left_margin, 2) << 16) | /* H back porch */ |
| 675 | (hsync_len << 0)); /* Hsync */ | 688 | (ALIGN(hsync_len, 2) << 0)); /* Hsync */ |
| 676 | tc_write(HTIM02, (right_margin << 16) | /* H front porch */ | 689 | tc_write(HTIM02, (ALIGN(right_margin, 2) << 16) | /* H front porch */ |
| 677 | (mode->hdisplay << 0)); /* width */ | 690 | (ALIGN(mode->hdisplay, 2) << 0)); /* width */ |
| 678 | tc_write(VTIM01, (upper_margin << 16) | /* V back porch */ | 691 | tc_write(VTIM01, (upper_margin << 16) | /* V back porch */ |
| 679 | (vsync_len << 0)); /* Vsync */ | 692 | (vsync_len << 0)); /* Vsync */ |
| 680 | tc_write(VTIM02, (lower_margin << 16) | /* V front porch */ | 693 | tc_write(VTIM02, (lower_margin << 16) | /* V front porch */ |
| @@ -693,7 +706,7 @@ static int tc_set_video_mode(struct tc_data *tc, struct drm_display_mode *mode) | |||
| 693 | /* DP Main Stream Attributes */ | 706 | /* DP Main Stream Attributes */ |
| 694 | vid_sync_dly = hsync_len + left_margin + mode->hdisplay; | 707 | vid_sync_dly = hsync_len + left_margin + mode->hdisplay; |
| 695 | tc_write(DP0_VIDSYNCDELAY, | 708 | tc_write(DP0_VIDSYNCDELAY, |
| 696 | (0x003e << 16) | /* thresh_dly */ | 709 | (max_tu_symbol << 16) | /* thresh_dly */ |
| 697 | (vid_sync_dly << 0)); | 710 | (vid_sync_dly << 0)); |
| 698 | 711 | ||
| 699 | tc_write(DP0_TOTALVAL, (mode->vtotal << 16) | (mode->htotal)); | 712 | tc_write(DP0_TOTALVAL, (mode->vtotal << 16) | (mode->htotal)); |
| @@ -709,13 +722,6 @@ static int tc_set_video_mode(struct tc_data *tc, struct drm_display_mode *mode) | |||
| 709 | tc_write(DPIPXLFMT, VS_POL_ACTIVE_LOW | HS_POL_ACTIVE_LOW | | 722 | tc_write(DPIPXLFMT, VS_POL_ACTIVE_LOW | HS_POL_ACTIVE_LOW | |
| 710 | DE_POL_ACTIVE_HIGH | SUB_CFG_TYPE_CONFIG1 | DPI_BPP_RGB888); | 723 | DE_POL_ACTIVE_HIGH | SUB_CFG_TYPE_CONFIG1 | DPI_BPP_RGB888); |
| 711 | 724 | ||
| 712 | /* | ||
| 713 | * Recommended maximum number of symbols transferred in a transfer unit: | ||
| 714 | * DIV_ROUND_UP((input active video bandwidth in bytes) * tu_size, | ||
| 715 | * (output active video bandwidth in bytes)) | ||
| 716 | * Must be less than tu_size. | ||
| 717 | */ | ||
| 718 | max_tu_symbol = TU_SIZE_RECOMMENDED - 1; | ||
| 719 | tc_write(DP0_MISC, (max_tu_symbol << 23) | (TU_SIZE_RECOMMENDED << 16) | | 725 | tc_write(DP0_MISC, (max_tu_symbol << 23) | (TU_SIZE_RECOMMENDED << 16) | |
| 720 | BPC_8); | 726 | BPC_8); |
| 721 | 727 | ||
