[PATCH 1/2] drm/radeon/kms: add new PREFER_CLOSEST_HIGHER pll flag

Alex Deucher alexdeucher at gmail.com
Mon Jan 10 09:23:49 PST 2011


Partner to the existing PREFER_CLOSEST_LOWER.  A new flag
to prefer slightly higher target frequencies if the target
cannot be hit exactly.

Signed-off-by: Alex Deucher <alexdeucher at gmail.com>
---
 drivers/gpu/drm/radeon/radeon_display.c |    5 +++++
 drivers/gpu/drm/radeon/radeon_mode.h    |    5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 5c9451e..0eae4a4 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -908,6 +908,11 @@ void radeon_compute_pll(struct radeon_pll *pll,
 							error = 0xffffffff;
 						else
 							error = freq - current_freq;
+					} else if (pll->flags & RADEON_PLL_PREFER_CLOSEST_HIGHER) {
+						if (freq > current_freq)
+							error = 0xffffffff;
+						else
+							error = current_freq - freq;
 					} else
 						error = abs(current_freq - freq);
 					vco_diff = abs(vco - best_vco);
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index 162f36b..6b92dec 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -147,8 +147,9 @@ struct radeon_tmds_pll {
 #define RADEON_PLL_PREFER_HIGH_POST_DIV (1 << 9)
 #define RADEON_PLL_USE_FRAC_FB_DIV      (1 << 10)
 #define RADEON_PLL_PREFER_CLOSEST_LOWER (1 << 11)
-#define RADEON_PLL_USE_POST_DIV         (1 << 12)
-#define RADEON_PLL_IS_LCD               (1 << 13)
+#define RADEON_PLL_PREFER_CLOSEST_HIGHER (1 << 12)
+#define RADEON_PLL_USE_POST_DIV         (1 << 13)
+#define RADEON_PLL_IS_LCD               (1 << 14)
 
 struct radeon_pll {
 	/* reference frequency */
-- 
1.7.1.1



More information about the dri-devel mailing list