From patchwork Thu Feb 10 21:56:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 547541 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 p1ALuTj1016898 for ; Thu, 10 Feb 2011 21:56:52 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 28B369E819 for ; Thu, 10 Feb 2011 13:56:29 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qy0-f177.google.com (mail-qy0-f177.google.com [209.85.216.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 19C009E793 for ; Thu, 10 Feb 2011 13:56:17 -0800 (PST) Received: by qyk27 with SMTP id 27so1610972qyk.15 for ; Thu, 10 Feb 2011 13:56:17 -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; bh=x+FyORvA5MiTYTiwEB7uo9B2O+N6ltsAUYBl8/kC/SA=; b=ownrsTgIMfqoYeo1IqDGJXqnHxlSi+QcaHoh5PHmR7RwRU3ZhSwF9bnDySWEzA+tim yhlJ2ZRceDCAavwa0nS+RqKsRbzd3SeLZPjEudLF17/uNHWXEJneuR8O0PkU2eH6SVvy n/vunSDNXteBNiVrveEjc3yG+3itl1P0UNk80= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=tjtD48/104W+az9Bm0QwuPIY/RfVhlUO+KuW507Y9oIQKLbgNQL6INRQD7lveVhne5 bO3AdpapVWqOY/X2oEX9+vNPWZP89CK3YOHH2kV1OggaIvcm49RswUB01eHiZidlnFE8 trWb3VWwdxaNwuYOaa11xN2O2JpFs/bbmjWzs= Received: by 10.224.11.130 with SMTP id t2mr18159445qat.234.1297374977201; Thu, 10 Feb 2011 13:56:17 -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.15 (version=SSLv3 cipher=OTHER); Thu, 10 Feb 2011 13:56:16 -0800 (PST) From: Alex Deucher To: airlied@gmail.com, dri-devel@lists.freedesktop.org Subject: [PATCH] drm/radeon/kms: fix pll algo quirk function Date: Thu, 10 Feb 2011 16:56:05 -0500 Message-Id: <1297374966-2201-1-git-send-email-alexdeucher@gmail.com> X-Mailer: git-send-email 1.7.1.1 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:00 +0000 (UTC) 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);