diff options
Diffstat (limited to 'drivers/gpu/drm/i915/intel_dsi_vbt.c')
| -rw-r--r-- | drivers/gpu/drm/i915/intel_dsi_vbt.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/drivers/gpu/drm/i915/intel_dsi_vbt.c b/drivers/gpu/drm/i915/intel_dsi_vbt.c index 91c07b0c8db9..4d6ffa7b3e7b 100644 --- a/drivers/gpu/drm/i915/intel_dsi_vbt.c +++ b/drivers/gpu/drm/i915/intel_dsi_vbt.c | |||
| @@ -647,6 +647,11 @@ bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id) | |||
| 647 | /* prepare count */ | 647 | /* prepare count */ |
| 648 | prepare_cnt = DIV_ROUND_UP(ths_prepare_ns * ui_den, ui_num * mul); | 648 | prepare_cnt = DIV_ROUND_UP(ths_prepare_ns * ui_den, ui_num * mul); |
| 649 | 649 | ||
| 650 | if (prepare_cnt > PREPARE_CNT_MAX) { | ||
| 651 | DRM_DEBUG_KMS("prepare count too high %u\n", prepare_cnt); | ||
| 652 | prepare_cnt = PREPARE_CNT_MAX; | ||
| 653 | } | ||
| 654 | |||
| 650 | /* exit zero count */ | 655 | /* exit zero count */ |
| 651 | exit_zero_cnt = DIV_ROUND_UP( | 656 | exit_zero_cnt = DIV_ROUND_UP( |
| 652 | (ths_prepare_hszero - ths_prepare_ns) * ui_den, | 657 | (ths_prepare_hszero - ths_prepare_ns) * ui_den, |
| @@ -662,32 +667,29 @@ bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id) | |||
| 662 | if (exit_zero_cnt < (55 * ui_den / ui_num) && (55 * ui_den) % ui_num) | 667 | if (exit_zero_cnt < (55 * ui_den / ui_num) && (55 * ui_den) % ui_num) |
| 663 | exit_zero_cnt += 1; | 668 | exit_zero_cnt += 1; |
| 664 | 669 | ||
| 670 | if (exit_zero_cnt > EXIT_ZERO_CNT_MAX) { | ||
| 671 | DRM_DEBUG_KMS("exit zero count too high %u\n", exit_zero_cnt); | ||
| 672 | exit_zero_cnt = EXIT_ZERO_CNT_MAX; | ||
| 673 | } | ||
| 674 | |||
| 665 | /* clk zero count */ | 675 | /* clk zero count */ |
| 666 | clk_zero_cnt = DIV_ROUND_UP( | 676 | clk_zero_cnt = DIV_ROUND_UP( |
| 667 | (tclk_prepare_clkzero - ths_prepare_ns) | 677 | (tclk_prepare_clkzero - ths_prepare_ns) |
| 668 | * ui_den, ui_num * mul); | 678 | * ui_den, ui_num * mul); |
| 669 | 679 | ||
| 680 | if (clk_zero_cnt > CLK_ZERO_CNT_MAX) { | ||
| 681 | DRM_DEBUG_KMS("clock zero count too high %u\n", clk_zero_cnt); | ||
| 682 | clk_zero_cnt = CLK_ZERO_CNT_MAX; | ||
| 683 | } | ||
| 684 | |||
| 670 | /* trail count */ | 685 | /* trail count */ |
| 671 | tclk_trail_ns = max(mipi_config->tclk_trail, mipi_config->ths_trail); | 686 | tclk_trail_ns = max(mipi_config->tclk_trail, mipi_config->ths_trail); |
| 672 | trail_cnt = DIV_ROUND_UP(tclk_trail_ns * ui_den, ui_num * mul); | 687 | trail_cnt = DIV_ROUND_UP(tclk_trail_ns * ui_den, ui_num * mul); |
| 673 | 688 | ||
| 674 | if (prepare_cnt > PREPARE_CNT_MAX || | 689 | if (trail_cnt > TRAIL_CNT_MAX) { |
| 675 | exit_zero_cnt > EXIT_ZERO_CNT_MAX || | 690 | DRM_DEBUG_KMS("trail count too high %u\n", trail_cnt); |
| 676 | clk_zero_cnt > CLK_ZERO_CNT_MAX || | ||
| 677 | trail_cnt > TRAIL_CNT_MAX) | ||
| 678 | DRM_DEBUG_DRIVER("Values crossing maximum limits, restricting to max values\n"); | ||
| 679 | |||
| 680 | if (prepare_cnt > PREPARE_CNT_MAX) | ||
| 681 | prepare_cnt = PREPARE_CNT_MAX; | ||
| 682 | |||
| 683 | if (exit_zero_cnt > EXIT_ZERO_CNT_MAX) | ||
| 684 | exit_zero_cnt = EXIT_ZERO_CNT_MAX; | ||
| 685 | |||
| 686 | if (clk_zero_cnt > CLK_ZERO_CNT_MAX) | ||
| 687 | clk_zero_cnt = CLK_ZERO_CNT_MAX; | ||
| 688 | |||
| 689 | if (trail_cnt > TRAIL_CNT_MAX) | ||
| 690 | trail_cnt = TRAIL_CNT_MAX; | 691 | trail_cnt = TRAIL_CNT_MAX; |
| 692 | } | ||
| 691 | 693 | ||
| 692 | /* B080 */ | 694 | /* B080 */ |
| 693 | intel_dsi->dphy_reg = exit_zero_cnt << 24 | trail_cnt << 16 | | 695 | intel_dsi->dphy_reg = exit_zero_cnt << 24 | trail_cnt << 16 | |
