From 63cc8451cd4f38be2003efff1e085449700fe064 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Wed, 22 Dec 2010 14:20:43 -0500 Subject: [PATCH] drm/radeon/kms: add new PREFER_CLOSEST_HIGHER pll flag 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 --- 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 3bca929..d40885e 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c @@ -909,6 +909,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 12bdeab..61473fa 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