Module Name:    src
Committed By:   jakllsch
Date:           Fri Jul 29 19:19:14 UTC 2011

Modified Files:
        src/sys/dev/ic: hpet.c

Log Message:
Use one more bit of precision when calculating frequency from period.
This makes the 4-times-NTSC color carrier get calculated to a
correct 14318180Hz, instead of 14318179Hz, which seems a bit odd.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ic/hpet.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/hpet.c
diff -u src/sys/dev/ic/hpet.c:1.11 src/sys/dev/ic/hpet.c:1.12
--- src/sys/dev/ic/hpet.c:1.11	Wed Jun 15 09:09:48 2011
+++ src/sys/dev/ic/hpet.c	Fri Jul 29 19:19:14 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: hpet.c,v 1.11 2011/06/15 09:09:48 jruoho Exp $ */
+/* $NetBSD: hpet.c,v 1.12 2011/07/29 19:19:14 jakllsch Exp $ */
 
 /*
  * Copyright (c) 2006 Nicolas Joly
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpet.c,v 1.11 2011/06/15 09:09:48 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpet.c,v 1.12 2011/07/29 19:19:14 jakllsch Exp $");
 
 #include <sys/systm.h>
 #include <sys/device.h>
@@ -87,7 +87,8 @@
 		aprint_error_dev(dv, "invalid timer period\n");
 		return;
 	}
-	tc->tc_frequency = 1000000000000000ULL / val;
+	val = (1000000000000000ULL * 2) / val;
+	tc->tc_frequency = (val / 2) + (val & 1);
 
 	/* Enable timer */
 	val = bus_space_read_4(sc->sc_memt, sc->sc_memh, HPET_CONFIG);

Reply via email to