From 1fce058d7f063b481a274b0a653ffad94f5e9b23 Mon Sep 17 00:00:00 2001
From: Alex Deucher <alexdeucher@gmail.com>
Date: Tue, 8 Feb 2011 16:13:27 -0500
Subject: [PATCH] drm/radeon/kms: fix pll algo quirk function
I'm sick of fighting this. Just add a new pick_pll_algo()
function and quirk specific boards as they are reported.
Add a quirk for the pll algo selection on the MacBookPro2,2.
Reported-by: Justin P. Mattock <justinmattock@gmail.com>
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
---
drivers/gpu/drm/radeon/atombios_crtc.c | 39 +++++++++++++++++++++++++++-----
1 files changed, 33 insertions(+), 6 deletions(-)
@@ -839,6 +839,32 @@ static void atombios_crtc_program_pll(struct drm_crtc *crtc,
atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);
}
+#define RADEON_PLL_ALGO_LEGACY 0
+#define RADEON_PLL_ALGO_AVIVO 1
+
+static int atombios_crtc_pick_pll_algo(struct drm_crtc *crtc, struct drm_display_mode *mode)
+{
+ struct drm_device *dev = crtc->dev;
+ struct radeon_device *rdev = dev->dev_private;
+
+ /* board specific quirks */
+ /* funky macbooks */
+ if ((dev->pdev->device == 0x71C5) &&
+ (dev->pdev->subsystem_vendor == 0x106b) &&
+ (dev->pdev->subsystem_device == 0x0080)) {
+ return RADEON_PLL_ALGO_LEGACY;
+ }
+
+ /* defaults */
+ /* rv515 seems happier with the old algo */
+ if (rdev->family == CHIP_RV515)
+ return RADEON_PLL_ALGO_LEGACY;
+ else if (ASIC_IS_AVIVO(rdev))
+ return RADEON_PLL_ALGO_AVIVO;
+
+ return RADEON_PLL_ALGO_LEGACY;
+}
+
static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode)
{
struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
@@ -957,16 +983,17 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode
/* adjust pixel clock as needed */
adjusted_clock = atombios_adjust_pll(crtc, mode, pll, ss_enabled, &ss);
- /* rv515 seems happier with the old algo */
- if (rdev->family == CHIP_RV515)
+ switch (atombios_crtc_pick_pll_algo(crtc, mode)) {
+ case RADEON_PLL_ALGO_LEGACY:
+ default:
radeon_compute_pll_legacy(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div,
&ref_div, &post_div);
- else if (ASIC_IS_AVIVO(rdev))
+ break;
+ case RADEON_PLL_ALGO_AVIVO:
radeon_compute_pll_avivo(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div,
&ref_div, &post_div);
- else
- radeon_compute_pll_legacy(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div,
- &ref_div, &post_div);
+ break;
+ };
atombios_crtc_program_ss(crtc, ATOM_DISABLE, radeon_crtc->pll_id, &ss);
--
1.7.1.1