Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

time: move PIT_TICK_RATE to linux/timex.h

PIT_TICK_RATE is currently defined in four architectures, but in three
different places. While linux/timex.h is not the perfect place for it, it
is still a reasonable replacement for those drivers that traditionally use
asm/timex.h to get CLOCK_TICK_RATE and expect it to be the PIT frequency.

Note that for Alpha, the actual value changed from 1193182UL to 1193180UL.
This is unlikely to make a difference, and probably can only improve
accuracy. There was a discussion on the correct value of CLOCK_TICK_RATE
a few years ago, after which every existing instance was getting changed
to 1193182. According to the specification, it should be
1193181.818181...

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Len Brown <lenb@kernel.org>
Cc: john stultz <johnstul@us.ibm.com>
Cc: Dmitry Torokhov <dtor@mail.ru>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Arnd Bergmann and committed by
Linus Torvalds
08604bd9 03347e25

+12 -21
-7
arch/alpha/include/asm/8253pit.h
··· 1 1 /* 2 2 * 8253/8254 Programmable Interval Timer 3 3 */ 4 - 5 - #ifndef _8253PIT_H 6 - #define _8253PIT_H 7 - 8 - #define PIT_TICK_RATE 1193180UL 9 - 10 - #endif
+1
arch/alpha/kernel/sys_ruffian.c
··· 14 14 #include <linux/sched.h> 15 15 #include <linux/pci.h> 16 16 #include <linux/ioport.h> 17 + #include <linux/timex.h> 17 18 #include <linux/init.h> 18 19 19 20 #include <asm/ptrace.h>
-2
arch/mips/include/asm/i8253.h
··· 12 12 #define PIT_CH0 0x40 13 13 #define PIT_CH2 0x42 14 14 15 - #define PIT_TICK_RATE 1193182UL 16 - 17 15 extern spinlock_t i8253_lock; 18 16 19 17 extern void setup_pit_timer(void);
-7
arch/powerpc/include/asm/8253pit.h
··· 1 - #ifndef _ASM_POWERPC_8253PIT_H 2 - #define _ASM_POWERPC_8253PIT_H 3 - 4 1 /* 5 2 * 8253/8254 Programmable Interval Timer 6 3 */ 7 - 8 - #define PIT_TICK_RATE 1193182UL 9 - 10 - #endif /* _ASM_POWERPC_8253PIT_H */
+1 -3
arch/x86/include/asm/timex.h
··· 4 4 #include <asm/processor.h> 5 5 #include <asm/tsc.h> 6 6 7 - /* The PIT ticks at this frequency (in HZ): */ 8 - #define PIT_TICK_RATE 1193182 9 - 7 + /* Assume we use the PIT time source for the clock tick */ 10 8 #define CLOCK_TICK_RATE PIT_TICK_RATE 11 9 12 10 #define ARCH_HAS_READ_CURRENT_TIMER
+1
arch/x86/kernel/i8253.c
··· 7 7 #include <linux/spinlock.h> 8 8 #include <linux/jiffies.h> 9 9 #include <linux/module.h> 10 + #include <linux/timex.h> 10 11 #include <linux/delay.h> 11 12 #include <linux/init.h> 12 13 #include <linux/io.h>
+1
arch/x86/kernel/tsc.c
··· 9 9 #include <linux/delay.h> 10 10 #include <linux/clocksource.h> 11 11 #include <linux/percpu.h> 12 + #include <linux/timex.h> 12 13 13 14 #include <asm/hpet.h> 14 15 #include <asm/timer.h>
+1
drivers/clocksource/acpi_pm.c
··· 18 18 19 19 #include <linux/acpi_pmtmr.h> 20 20 #include <linux/clocksource.h> 21 + #include <linux/timex.h> 21 22 #include <linux/errno.h> 22 23 #include <linux/init.h> 23 24 #include <linux/pci.h>
+1 -1
drivers/input/joystick/analog.c
··· 35 35 #include <linux/input.h> 36 36 #include <linux/gameport.h> 37 37 #include <linux/jiffies.h> 38 - #include <asm/timex.h> 38 + #include <linux/timex.h> 39 39 40 40 #define DRIVER_DESC "Analog joystick and gamepad driver" 41 41
+1
drivers/input/misc/pcspkr.c
··· 17 17 #include <linux/init.h> 18 18 #include <linux/input.h> 19 19 #include <linux/platform_device.h> 20 + #include <linux/timex.h> 20 21 #include <asm/io.h> 21 22 22 23 MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
+3
include/linux/timex.h
··· 280 280 281 281 int read_current_timer(unsigned long *timer_val); 282 282 283 + /* The clock frequency of the i8253/i8254 PIT */ 284 + #define PIT_TICK_RATE 1193182ul 285 + 283 286 #endif /* KERNEL */ 284 287 285 288 #endif /* LINUX_TIMEX_H */
+1
sound/drivers/pcsp/pcsp.h
··· 10 10 #define __PCSP_H__ 11 11 12 12 #include <linux/hrtimer.h> 13 + #include <linux/timex.h> 13 14 #if defined(CONFIG_MIPS) || defined(CONFIG_X86) 14 15 /* Use the global PIT lock ! */ 15 16 #include <asm/i8253.h>
+1 -1
sound/oss/pas2_pcm.c
··· 17 17 18 18 #include <linux/init.h> 19 19 #include <linux/spinlock.h> 20 - #include <asm/timex.h> 20 + #include <linux/timex.h> 21 21 #include "sound_config.h" 22 22 23 23 #include "pas2.h"