summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/smi_501.c11
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;