diff options
author | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2008-10-16 15:11:36 -0300 |
---|---|---|
committer | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2008-10-16 15:11:36 -0300 |
commit | e020afa359434b4da06ef8509a3e504423f824d2 (patch) | |
tree | 900bffb6a41b98984cc59d9da42b67dd81d366b1 /src | |
parent | f686d1b4fdd11d3d969ff4db21128d7867c9044d (diff) |
Correct incorrect pll3 calculation.
Double value must be truncated when calculating the difference from the
possible clock and requested clock.
Diffstat (limited to 'src')
-rw-r--r-- | src/smi_501.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/smi_501.c b/src/smi_501.c index 7f2bbc5..99bbcdb 100644 --- a/src/smi_501.c +++ b/src/smi_501.c @@ -431,18 +431,11 @@ SMI501_FindPLLClock(double clock, int32_t *m, int32_t *n, int32_t *xclck) */ best = 0x7fffffff; - /* FIXME: The 12 multiplier was a wild guess (but it doesn't work with - * a 14 modifier, i.e. 288 works, but not 336), and actually it corrects - * the "flicker" on the panel, and will properly display output on a - * secondary panel/crt. - * So, should bug SMI about incorrect (non official) information, and - * also ask for better definition of K... - */ - frequency = 12 * 24 * 1000.0; + frequency = 24 * 1000; for (N = 2; N <= 24; N++) { for (K = 1; K <= 2; K++) { M = (clock * K) / frequency * N; - diff = (frequency * M / N) - (clock * K); + diff = ((int32_t)(frequency * M) / N) - (clock * K); /* Ensure M is larger then 0 and fits in 7 bits */ if (M > 0 && M < 0x80 && fabs(diff) < best) { *m = M; |