[PATCH] drm/radeon/kms: fix pll algo quirk function
Corbin Simpson
mostawesomedude at gmail.com
Thu Feb 10 14:46:56 PST 2011
On Thu, Feb 10, 2011 at 1:56 PM, Alex Deucher <alexdeucher at gmail.com> wrote:
> 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 at gmail.com>
>
> Signed-off-by: Alex Deucher <alexdeucher at gmail.com>
> Cc: stable at kernel.org
> ---
> 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
I can get behind this.
Reviewed-by: Corbin Simpson <MostAwesomeDude at gmail.com>
--
When the facts change, I change my mind. What do you do, sir? ~ Keynes
Corbin Simpson
<MostAwesomeDude at gmail.com>
More information about the dri-devel
mailing list