Re: [BISECTED] commit 619efb1059 makes the MacBookPro2,2 screenflicker like its broken or half plugged in

From: Alex Deucher
Date: Tue Feb 08 2011 - 16:20:42 EST


On Tue, Feb 8, 2011 at 3:52 PM, Justin P. Mattock
<justinmattock@xxxxxxxxx> wrote:
> With the current HEAD Im getting screen flickering really bad to point where
> it looks like the screen is damaged and/or half plugged-in etc..
>
> the bisect pointed to here:
>
> commit 619efb105924d8cafa0c1dd9389e9ab506f5425d
>
> doing a git revert 619efb10592
> gets the screen working properly again.
> I havent looked much through the code to see if I can fix this. for the time
> being I'll revert this on my machine with the current, until later on.

The attached patch should fix it assuming I got your pci ids correct.
I'm done with the pll stuff; too may fixes break other boards. Just
add a quirk table and be done with it.

Alex

>
> lspci -vv shows my card info(let me know if you need anymore)
>
> 01:00.0 VGA compatible controller: ATI Technologies Inc M56P [Radeon
> Mobility X1600] (prog-if 00 [VGA controller])
>        Subsystem: Apple Computer Inc. MacBook Pro
>        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
> Stepping- SERR- FastB2B- DisINTx+
>        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
> <TAbort- <MAbort- >SERR- <PERR- INTx-
>        Latency: 0, Cache Line Size: 256 bytes
>        Interrupt: pin A routed to IRQ 42
>        Region 0: Memory at 40000000 (32-bit, prefetchable) [size=128M]
>        Region 1: I/O ports at 3000 [size=256]
>        Region 2: Memory at 50300000 (32-bit, non-prefetchable) [size=64K]
>        Expansion ROM at 50320000 [disabled] [size=128K]
>        Capabilities: <access denied>
>        Kernel driver in use: radeon
>        Kernel modules: radeon
>
>
> Justin P. Mattock
>
From 1fce058d7f063b481a274b0a653ffad94f5e9b23 Mon Sep 17 00:00:00 2001
From: Alex Deucher <alexdeucher@xxxxxxxxx>
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@xxxxxxxxx>

Signed-off-by: Alex Deucher <alexdeucher@xxxxxxxxx>
Cc: stable@xxxxxxxxxx
---
drivers/gpu/drm/radeon/atombios_crtc.c | 39 +++++++++++++++++++++++++++-----
1 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index dd4e3ac..4a505ba 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -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