summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorjakllsch <jakllsch@NetBSD.org>2011-07-29 19:19:14 +0000
committerjakllsch <jakllsch@NetBSD.org>2011-07-29 19:19:14 +0000
commit82a29cd91aecaa37b93975754423af997c3642fa (patch)
tree213091e81f6da7e05a553aafe05773a969aa0778 /sys/dev
parentae36cf9c860184798e3be42e50f136af094f6609 (diff)
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.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/hpet.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/dev/ic/hpet.c b/sys/dev/ic/hpet.c
index 4a836fe3fff..a18e375f358 100644
--- a/sys/dev/ic/hpet.c
+++ b/sys/dev/ic/hpet.c
@@ -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 @@ hpet_attach_subr(device_t dv)
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);