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

From: Alex Deucher
Date: Fri Feb 11 2011 - 03:27:10 EST


On Fri, Feb 11, 2011 at 1:59 AM, Alex Deucher <alexdeucher@xxxxxxxxx> wrote:
> On Thu, Feb 10, 2011 at 12:33 AM, Justin Mattock
> <justinmattock@xxxxxxxxx> wrote:
>>
>> On Feb 9, 2011, at 2:09 PM, Alex Deucher wrote:
>>
>>> On Tue, Feb 8, 2011 at 4:20 PM, Alex Deucher <alexdeucher@xxxxxxxxx>
>>> wrote:
>>>>
>>>> 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.
>>>>
>>>
>>> The attached patch builds on the previous one and fixes an additional
>>> regression.
>>>
>>> Alex
>>>
>>> <0001-drm-radeon-kms-pll-quirk-cleanup.patch>
>>
>> alright... didn't mean to keep you waiting(out of my office for most of the
>> day)..
>> Anyways patch applied, and everything looks good no screen jitters or
>> flickering etc..
>>
>> Reported-and-Tested-by: Justin P. Mattock<justinmattock@xxxxxxxxx>
>>
>> Thanks for sending this my way so my machine works..
>
> Justin, can you try without these patches, but with the following patch instead?
>

Better yet, can you try the attached patch on top of 2.6.38-rc4 or newer?

Alex

> diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c
> b/drivers/gpu/drm/radeon/atombios_crtc.c
> index cc6bdd8..2f9d113 100644
> --- a/drivers/gpu/drm/radeon/atombios_crtc.c
> +++ b/drivers/gpu/drm/radeon/atombios_crtc.c
> @@ -562,7 +562,7 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,
>                                }
>                        }
>  /* this might work properly with the new pll algo */
> -#if 0 /* doesn't work properly on some laptops */
> +#if 1 /* doesn't work properly on some laptops */
>                        /* use recommended ref_div for ss */
>                        if (radeon_encoder->devices &
> (ATOM_DEVICE_LCD_SUPPORT)) {
>                                if (ss_enabled) {
>
>
>>
>> cheers,
>>
>> Justin P. Mattock
>>
>
From e1c5703223d21441bcbdd222572e592984e5ae10 Mon Sep 17 00:00:00 2001
From: Alex Deucher <alexdeucher@xxxxxxxxx>
Date: Fri, 11 Feb 2011 02:25:51 -0500
Subject: [PATCH] drm/radeon/kms: hopefully fix pll issues for real

The problematic boards have a recommended reference divider
to be used when spread spectrum is enabled on the laptop panel.
Enable the use of the recommended reference divider along with
the new pll algo. This should hopefully fix the issues across
the board.

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

diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index dd4e3ac..638f926 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -555,8 +555,7 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,
dp_clock = dig_connector->dp_clock;
}
}
-/* this might work properly with the new pll algo */
-#if 0 /* doesn't work properly on some laptops */
+
/* use recommended ref_div for ss */
if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) {
if (ss_enabled) {
@@ -566,18 +565,15 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,
}
}
}
-#endif
+
if (ASIC_IS_AVIVO(rdev)) {
/* DVO wants 2x pixel clock if the DVO chip is in 12 bit mode */
if (radeon_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1)
adjusted_clock = mode->clock * 2;
if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT))
pll->flags |= RADEON_PLL_PREFER_CLOSEST_LOWER;
- /* rv515 needs more testing with this option */
- if (rdev->family != CHIP_RV515) {
- if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT))
- pll->flags |= RADEON_PLL_IS_LCD;
- }
+ if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT))
+ pll->flags |= RADEON_PLL_IS_LCD;
} else {
if (encoder->encoder_type != DRM_MODE_ENCODER_DAC)
pll->flags |= RADEON_PLL_NO_ODD_POST_DIV;
@@ -957,11 +953,7 @@ 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)
- radeon_compute_pll_legacy(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div,
- &ref_div, &post_div);
- else if (ASIC_IS_AVIVO(rdev))
+ if (ASIC_IS_AVIVO(rdev))
radeon_compute_pll_avivo(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div,
&ref_div, &post_div);
else
--
1.7.1.1