From patchwork Thu Feb 10 21:56:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 547551 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1ALvBqu017300 for ; Thu, 10 Feb 2011 21:57:31 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 04D549EEA3 for ; Thu, 10 Feb 2011 13:57:11 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qy0-f170.google.com (mail-qy0-f170.google.com [209.85.216.170]) by gabe.freedesktop.org (Postfix) with ESMTP id EB4AB9E793 for ; Thu, 10 Feb 2011 13:56:22 -0800 (PST) Received: by qyk10 with SMTP id 10so2915097qyk.15 for ; Thu, 10 Feb 2011 13:56:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=awui6F+1JhVpj0SzjaKcWardnbci/nW3xkvZf/VFS2s=; b=blyX9ju8lgwCZsZeXlsFi5F8sPNizggDouEjPvi2RxQYJODH3FAgu6BRqE3EiJbl0C Sn1anXNiUL9ehSPqmqtOsOoiFrPUmUlJ3Ut30VM8437m1ThMsbt1oEdei3esv0HfyH+e O1AJqRXvw/qJ2NIz2M9o7dJK4Q4UB7V9dTwT0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=RUBt0Kfa6UvH3ZZxaOhRYlY1tX4/d39b6BB19EkrBpncZlpDJ1ou4eqbhp9Ga/iCvc pk2ZL+uDU1ArQePx3YKgai4N/+0XZxjaSRPqmEcP65z6D22p3jSI9XV6js1JRDheJ2Hl aP3s50P/ypmv1Aplld4Y1OkQXyrkC/wLUQ4j4= Received: by 10.224.37.142 with SMTP id x14mr17925159qad.237.1297374980046; Thu, 10 Feb 2011 13:56:20 -0800 (PST) Received: from localhost.localdomain (static-74-96-105-7.washdc.fios.verizon.net [74.96.105.7]) by mx.google.com with ESMTPS id e29sm37726qck.39.2011.02.10.13.56.18 (version=SSLv3 cipher=OTHER); Thu, 10 Feb 2011 13:56:19 -0800 (PST) From: Alex Deucher To: airlied@gmail.com, dri-devel@lists.freedesktop.org Subject: [PATCH] drm/radeon/kms: pll quirk cleanup Date: Thu, 10 Feb 2011 16:56:06 -0500 Message-Id: <1297374966-2201-2-git-send-email-alexdeucher@gmail.com> X-Mailer: git-send-email 1.7.1.1 In-Reply-To: <1297374966-2201-1-git-send-email-alexdeucher@gmail.com> References: <1297374966-2201-1-git-send-email-alexdeucher@gmail.com> Cc: stable@kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 10 Feb 2011 21:57:45 +0000 (UTC) diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 4a505ba..cc6bdd8 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c @@ -31,6 +31,11 @@ #include "atom.h" #include "atom-bits.h" +static enum radeon_pll_algo +atombios_crtc_pick_pll_algo(struct drm_crtc *crtc, + struct drm_display_mode *mode, + uint32_t active_device); + static void atombios_overscan_setup(struct drm_crtc *crtc, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) @@ -519,6 +524,7 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, /* reset the pll flags */ pll->flags = 0; + pll->algo = RADEON_PLL_ALGO_LEGACY; if (ASIC_IS_AVIVO(rdev)) { if ((rdev->family == CHIP_RS600) || @@ -584,6 +590,7 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, if (encoder->encoder_type == DRM_MODE_ENCODER_LVDS) pll->flags |= RADEON_PLL_USE_REF_DIV; } + pll->algo = atombios_crtc_pick_pll_algo(crtc, mode, radeon_encoder->active_device); break; } } @@ -839,29 +846,54 @@ 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) +static enum radeon_pll_algo +atombios_crtc_pick_pll_algo(struct drm_crtc *crtc, + struct drm_display_mode *mode, + uint32_t active_device) { struct drm_device *dev = crtc->dev; - struct radeon_device *rdev = dev->dev_private; /* board specific quirks */ - /* funky macbooks */ + + /* legacy algo */ + /* macbookpro2,2 */ 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) + /* Thinkpad T60 */ + if ((dev->pdev->device == 0x7145) && + (dev->pdev->subsystem_vendor == 0x17aa) && + (dev->pdev->subsystem_device == 0x2006)) { return RADEON_PLL_ALGO_LEGACY; - else if (ASIC_IS_AVIVO(rdev)) + } + + /* Acer RS880 */ + if ((dev->pdev->device == 0x9712) && + (dev->pdev->subsystem_vendor == 0x1025) && + (dev->pdev->subsystem_device == 0x027d)) { + return RADEON_PLL_ALGO_LEGACY; + } + + /* avivo algo */ + /* PC Partner RV630 */ + if ((dev->pdev->device == 0x9589) && + (dev->pdev->subsystem_vendor == 0x174b) && + (dev->pdev->subsystem_device == 0xe410)) { return RADEON_PLL_ALGO_AVIVO; + } + + /* Toshiba Satellite A100 */ + if ((dev->pdev->device == 0x71C5) && + (dev->pdev->subsystem_vendor == 0x1179) && + (dev->pdev->subsystem_device == 0xff10)) { + return RADEON_PLL_ALGO_AVIVO; + } + /* default to the legacy algo */ return RADEON_PLL_ALGO_LEGACY; } @@ -983,7 +1015,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); - switch (atombios_crtc_pick_pll_algo(crtc, mode)) { + switch (pll->algo) { case RADEON_PLL_ALGO_LEGACY: default: radeon_compute_pll_legacy(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div, diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index a670caa..1d760c6 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h @@ -151,6 +151,12 @@ struct radeon_tmds_pll { #define RADEON_PLL_IS_LCD (1 << 13) #define RADEON_PLL_PREFER_MINM_OVER_MAXP (1 << 14) +/* pll algo */ +enum radeon_pll_algo { + RADEON_PLL_ALGO_LEGACY, + RADEON_PLL_ALGO_AVIVO +}; + struct radeon_pll { /* reference frequency */ uint32_t reference_freq; @@ -183,6 +189,8 @@ struct radeon_pll { /* pll id */ uint32_t id; + /* pll algo */ + enum radeon_pll_algo algo; }; struct radeon_i2c_chan {