aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_ddi.c
diff options
context:
space:
mode:
authorPaulo Zanoni <paulo.r.zanoni@intel.com>2012-08-10 09:03:03 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-08-10 12:35:28 -0400
commit126e9be816e7c0322f5dac994f94d65a8fabcc56 (patch)
tree448a58326f9125987d8e3b3383240477f1051040 /drivers/gpu/drm/i915/intel_ddi.c
parent228d3e367c91af16d672fb8bff78b030acb5efc3 (diff)
drm/i915: try harder to find WR PLL clock settings
If we don't find the exact refresh rate, go with the next one. This makes some modes work for me. They won't have the best settings, but will at least have something. Just returning from this function when we don't find the perfect settings does not help us at all. Version 2: - Remove duplicate lines on the clock table. - Add back debug message with refresh, p, n2 and r2. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_ddi.c')
-rw-r--r--drivers/gpu/drm/i915/intel_ddi.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index ff03a3a57193..958422606bc7 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -267,7 +267,8 @@ struct wrpll_tmds_clock {
267 u16 r2; /* Reference divider */ 267 u16 r2; /* Reference divider */
268}; 268};
269 269
270/* Table of matching values for WRPLL clocks programming for each frequency */ 270/* Table of matching values for WRPLL clocks programming for each frequency.
271 * The code assumes this table is sorted. */
271static const struct wrpll_tmds_clock wrpll_tmds_clock_table[] = { 272static const struct wrpll_tmds_clock wrpll_tmds_clock_table[] = {
272 {19750, 38, 25, 18}, 273 {19750, 38, 25, 18},
273 {20000, 48, 32, 18}, 274 {20000, 48, 32, 18},
@@ -277,7 +278,6 @@ static const struct wrpll_tmds_clock wrpll_tmds_clock_table[] = {
277 {23000, 36, 23, 15}, 278 {23000, 36, 23, 15},
278 {23500, 40, 40, 23}, 279 {23500, 40, 40, 23},
279 {23750, 26, 16, 14}, 280 {23750, 26, 16, 14},
280 {23750, 26, 16, 14},
281 {24000, 36, 24, 15}, 281 {24000, 36, 24, 15},
282 {25000, 36, 25, 15}, 282 {25000, 36, 25, 15},
283 {25175, 26, 40, 33}, 283 {25175, 26, 40, 33},
@@ -437,7 +437,6 @@ static const struct wrpll_tmds_clock wrpll_tmds_clock_table[] = {
437 {108000, 8, 24, 15}, 437 {108000, 8, 24, 15},
438 {108108, 8, 173, 108}, 438 {108108, 8, 173, 108},
439 {109000, 6, 23, 19}, 439 {109000, 6, 23, 19},
440 {109000, 6, 23, 19},
441 {110000, 6, 22, 18}, 440 {110000, 6, 22, 18},
442 {110013, 6, 22, 18}, 441 {110013, 6, 22, 18},
443 {110250, 8, 49, 30}, 442 {110250, 8, 49, 30},
@@ -614,7 +613,6 @@ static const struct wrpll_tmds_clock wrpll_tmds_clock_table[] = {
614 {218250, 4, 42, 26}, 613 {218250, 4, 42, 26},
615 {218750, 4, 34, 21}, 614 {218750, 4, 34, 21},
616 {219000, 4, 47, 29}, 615 {219000, 4, 47, 29},
617 {219000, 4, 47, 29},
618 {220000, 4, 44, 27}, 616 {220000, 4, 44, 27},
619 {220640, 4, 49, 30}, 617 {220640, 4, 49, 30},
620 {220750, 4, 36, 22}, 618 {220750, 4, 36, 22},
@@ -658,7 +656,7 @@ void intel_ddi_mode_set(struct drm_encoder *encoder,
658 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder); 656 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
659 int port = intel_hdmi->ddi_port; 657 int port = intel_hdmi->ddi_port;
660 int pipe = intel_crtc->pipe; 658 int pipe = intel_crtc->pipe;
661 int p, n2, r2, valid=0; 659 int p, n2, r2;
662 u32 temp, i; 660 u32 temp, i;
663 661
664 /* On Haswell, we need to enable the clocks and prepare DDI function to 662 /* On Haswell, we need to enable the clocks and prepare DDI function to
@@ -666,26 +664,23 @@ void intel_ddi_mode_set(struct drm_encoder *encoder,
666 */ 664 */
667 DRM_DEBUG_KMS("Preparing HDMI DDI mode for Haswell on port %c, pipe %c\n", port_name(port), pipe_name(pipe)); 665 DRM_DEBUG_KMS("Preparing HDMI DDI mode for Haswell on port %c, pipe %c\n", port_name(port), pipe_name(pipe));
668 666
669 for (i=0; i < ARRAY_SIZE(wrpll_tmds_clock_table); i++) { 667 for (i = 0; i < ARRAY_SIZE(wrpll_tmds_clock_table); i++)
670 if (crtc->mode.clock == wrpll_tmds_clock_table[i].clock) { 668 if (crtc->mode.clock <= wrpll_tmds_clock_table[i].clock)
671 p = wrpll_tmds_clock_table[i].p; 669 break;
672 n2 = wrpll_tmds_clock_table[i].n2;
673 r2 = wrpll_tmds_clock_table[i].r2;
674 670
675 DRM_DEBUG_KMS("WR PLL clock: found settings for %dKHz refresh rate: p=%d, n2=%d, r2=%d\n", 671 if (i == ARRAY_SIZE(wrpll_tmds_clock_table))
676 crtc->mode.clock, 672 i--;
677 p, n2, r2);
678 673
679 valid = 1; 674 p = wrpll_tmds_clock_table[i].p;
680 break; 675 n2 = wrpll_tmds_clock_table[i].n2;
681 } 676 r2 = wrpll_tmds_clock_table[i].r2;
682 }
683 677
684 if (!valid) { 678 if (wrpll_tmds_clock_table[i].clock != crtc->mode.clock)
685 DRM_ERROR("Unable to find WR PLL clock settings for %dKHz refresh rate\n", 679 DRM_INFO("WR PLL: using settings for %dKHz on %dKHz mode\n",
686 crtc->mode.clock); 680 wrpll_tmds_clock_table[i].clock, crtc->mode.clock);
687 return; 681
688 } 682 DRM_DEBUG_KMS("WR PLL: %dKHz refresh rate with p=%d, n2=%d r2=%d\n",
683 crtc->mode.clock, p, n2, r2);
689 684
690 /* Enable LCPLL if disabled */ 685 /* Enable LCPLL if disabled */
691 temp = I915_READ(LCPLL_CTL); 686 temp = I915_READ(LCPLL_CTL);