Skip to content

Commit

Permalink
time: move PIT_TICK_RATE to linux/timex.h
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
arndb authored and torvalds committed Jun 17, 2009
1 parent 03347e2 commit 08604bd
Show file tree
Hide file tree
Showing 13 changed files with 12 additions and 21 deletions.
7 changes: 0 additions & 7 deletions arch/alpha/include/asm/8253pit.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
/*
* 8253/8254 Programmable Interval Timer
*/

#ifndef _8253PIT_H
#define _8253PIT_H

#define PIT_TICK_RATE 1193180UL

#endif
1 change: 1 addition & 0 deletions arch/alpha/kernel/sys_ruffian.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <linux/sched.h>
#include <linux/pci.h>
#include <linux/ioport.h>
#include <linux/timex.h>
#include <linux/init.h>

#include <asm/ptrace.h>
Expand Down
2 changes: 0 additions & 2 deletions arch/mips/include/asm/i8253.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
#define PIT_CH0 0x40
#define PIT_CH2 0x42

#define PIT_TICK_RATE 1193182UL

extern spinlock_t i8253_lock;

extern void setup_pit_timer(void);
Expand Down
7 changes: 0 additions & 7 deletions arch/powerpc/include/asm/8253pit.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
#ifndef _ASM_POWERPC_8253PIT_H
#define _ASM_POWERPC_8253PIT_H

/*
* 8253/8254 Programmable Interval Timer
*/

#define PIT_TICK_RATE 1193182UL

#endif /* _ASM_POWERPC_8253PIT_H */
4 changes: 1 addition & 3 deletions arch/x86/include/asm/timex.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
#include <asm/processor.h>
#include <asm/tsc.h>

/* The PIT ticks at this frequency (in HZ): */
#define PIT_TICK_RATE 1193182

/* Assume we use the PIT time source for the clock tick */
#define CLOCK_TICK_RATE PIT_TICK_RATE

#define ARCH_HAS_READ_CURRENT_TIMER
Expand Down
1 change: 1 addition & 0 deletions arch/x86/kernel/i8253.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <linux/spinlock.h>
#include <linux/jiffies.h>
#include <linux/module.h>
#include <linux/timex.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/io.h>
Expand Down
1 change: 1 addition & 0 deletions arch/x86/kernel/tsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <linux/delay.h>
#include <linux/clocksource.h>
#include <linux/percpu.h>
#include <linux/timex.h>

#include <asm/hpet.h>
#include <asm/timer.h>
Expand Down
1 change: 1 addition & 0 deletions drivers/clocksource/acpi_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <linux/acpi_pmtmr.h>
#include <linux/clocksource.h>
#include <linux/timex.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/pci.h>
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/joystick/analog.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <linux/input.h>
#include <linux/gameport.h>
#include <linux/jiffies.h>
#include <asm/timex.h>
#include <linux/timex.h>

#define DRIVER_DESC "Analog joystick and gamepad driver"

Expand Down
1 change: 1 addition & 0 deletions drivers/input/misc/pcspkr.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <linux/init.h>
#include <linux/input.h>
#include <linux/platform_device.h>
#include <linux/timex.h>
#include <asm/io.h>

MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
Expand Down
3 changes: 3 additions & 0 deletions include/linux/timex.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ extern int do_adjtimex(struct timex *);

int read_current_timer(unsigned long *timer_val);

/* The clock frequency of the i8253/i8254 PIT */
#define PIT_TICK_RATE 1193182ul

#endif /* KERNEL */

#endif /* LINUX_TIMEX_H */
1 change: 1 addition & 0 deletions sound/drivers/pcsp/pcsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#define __PCSP_H__

#include <linux/hrtimer.h>
#include <linux/timex.h>
#if defined(CONFIG_MIPS) || defined(CONFIG_X86)
/* Use the global PIT lock ! */
#include <asm/i8253.h>
Expand Down
2 changes: 1 addition & 1 deletion sound/oss/pas2_pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include <linux/init.h>
#include <linux/spinlock.h>
#include <asm/timex.h>
#include <linux/timex.h>
#include "sound_config.h"

#include "pas2.h"
Expand Down

0 comments on commit 08604bd

Please sign in to comment.