aboutsummaryrefslogtreecommitdiff
path: root/src/northbridge/intel/gm45
diff options
context:
space:
mode:
Diffstat (limited to 'src/northbridge/intel/gm45')
-rw-r--r--src/northbridge/intel/gm45/gma.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/northbridge/intel/gm45/gma.c b/src/northbridge/intel/gm45/gma.c
index 026a165def..30c8d9a6e1 100644
--- a/src/northbridge/intel/gm45/gma.c
+++ b/src/northbridge/intel/gm45/gma.c
@@ -171,7 +171,8 @@ static void gma_init_lvds(const struct northbridge_intel_gm45_config *info,
u32 p = candp1 * pixel_p2;
u32 vco = DIV_ROUND_CLOSEST(BASE_FREQUENCY * m, candn + 2);
u32 dot = DIV_ROUND_CLOSEST(vco, p);
- u32 this_err = ABS(dot - target_frequency);
+ u32 this_err = MAX(dot, target_frequency) -
+ MIN(dot, target_frequency);
if (this_err < smallest_err) {
smallest_err = this_err;
pixel_n = candn;
@@ -477,7 +478,8 @@ static void gma_init_vga(const struct northbridge_intel_gm45_config *info,
u32 p = candp1 * pixel_p2;
u32 vco = DIV_ROUND_CLOSEST(BASE_FREQUENCY * m, candn + 2);
u32 dot = DIV_ROUND_CLOSEST(vco, p);
- u32 this_err = ABS(dot - target_frequency);
+ u32 this_err = MAX(dot, target_frequency) -
+ MIN(dot, target_frequency);
if (this_err < smallest_err) {
smallest_err= this_err;
pixel_n = candn;