From patchwork Mon Feb 14 16:43:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 556141 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 p1EGhWvw020498 for ; Mon, 14 Feb 2011 16:43:53 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BE2929E9F2 for ; Mon, 14 Feb 2011 08:43:31 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-vx0-f177.google.com (mail-vx0-f177.google.com [209.85.220.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 90EE69E7C2 for ; Mon, 14 Feb 2011 08:43:22 -0800 (PST) Received: by vxd2 with SMTP id 2so2637579vxd.36 for ; Mon, 14 Feb 2011 08:43:21 -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=LiJ3QIt17Ag1j+IEg7FzbAZE/G3RsxcsdTO1s2YHgF4=; b=rTWwFomxUjyGUdxTmtYFtSVvoIUgXayBdvJ9NlC9Y0U7Gk2ldBnTcwapiUCNgUtVE7 VjFxbCBLfbQWq5CTkH1HzOvhbYBBuyT9HKrTmH/d3Yt5+Sl2DYYNnAwM25zTe6pUMb3k b5smnc+ZT89tI2ACuuwuvM5qzbVTh5ngazCV0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=cnxl9+9GXRCS/6AauYMcPvyG04WufpiFYngJYuqBGLP+0sVpmLPUKy2jS4xEBil2rh vQAX1hUTzsdoUNWmwsFlvKW9pOhVCMEXcSR+GsGpoKulAXouzvOMdur/isvOuWqQodl3 5WBAqG56O8I2qlSnQpvwal74W5jFTkW5Q+m8g= Received: by 10.220.202.195 with SMTP id ff3mr1267391vcb.25.1297701800792; Mon, 14 Feb 2011 08:43: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 u14sm766406vcr.25.2011.02.14.08.43.18 (version=SSLv3 cipher=OTHER); Mon, 14 Feb 2011 08:43:19 -0800 (PST) From: Alex Deucher To: airlied@gmail.com, dri-devel@lists.freedesktop.org Subject: [PATCH 1/2] drm/radeon/kms: add bounds checking to avivo pll algo Date: Mon, 14 Feb 2011 11:43:10 -0500 Message-Id: <1297701791-1471-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]); Mon, 14 Feb 2011 16:43:53 +0000 (UTC) diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 2eff98c..0e65709 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c @@ -793,6 +793,11 @@ static void avivo_get_fb_div(struct radeon_pll *pll, tmp *= target_clock; *fb_div = tmp / pll->reference_freq; *frac_fb_div = tmp % pll->reference_freq; + + if (*fb_div > pll->max_feedback_div) + *fb_div = pll->max_feedback_div; + else if (*fb_div < pll->min_feedback_div) + *fb_div = pll->min_feedback_div; } static u32 avivo_get_post_div(struct radeon_pll *pll, @@ -826,6 +831,11 @@ static u32 avivo_get_post_div(struct radeon_pll *pll, post_div--; } + if (post_div > pll->max_post_div) + post_div = pll->max_post_div; + else if (post_div < pll->min_post_div) + post_div = pll->min_post_div; + return post_div; }