Commit fb3e5c4e authored by Vojtech Pavlik's avatar Vojtech Pavlik

input: Change input/misc/pcspkr.c to use CLOCK_TICK_RATE instead of

a fixed value of 1193182. And change CLOCK_TICK_RATE and several
usages of a fixed value 1193180 to a slightly more correct value
of 1193182. (True freq is 1.193181818181...).
parent 1bb39187
...@@ -395,7 +395,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, ...@@ -395,7 +395,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
if (!perm) if (!perm)
return -EPERM; return -EPERM;
if (arg) if (arg)
arg = 1193180 / arg; arg = 1193182 / arg;
kd_mksound(arg, 0); kd_mksound(arg, 0);
return 0; return 0;
...@@ -412,7 +412,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, ...@@ -412,7 +412,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
ticks = HZ * ((arg >> 16) & 0xffff) / 1000; ticks = HZ * ((arg >> 16) & 0xffff) / 1000;
count = ticks ? (arg & 0xffff) : 0; count = ticks ? (arg & 0xffff) : 0;
if (count) if (count)
count = 1193180 / count; count = 1193182 / count;
kd_mksound(count, ticks); kd_mksound(count, ticks);
return 0; return 0;
} }
......
...@@ -37,7 +37,7 @@ static LIST_HEAD(gameport_dev_list); ...@@ -37,7 +37,7 @@ static LIST_HEAD(gameport_dev_list);
#ifdef __i386__ #ifdef __i386__
#define DELTA(x,y) ((y)-(x)+((y)<(x)?1193180/HZ:0)) #define DELTA(x,y) ((y)-(x)+((y)<(x)?1193182/HZ:0))
#define GET_TIME(x) do { x = get_time_pit(); } while (0) #define GET_TIME(x) do { x = get_time_pit(); } while (0)
static unsigned int get_time_pit(void) static unsigned int get_time_pit(void)
......
...@@ -138,7 +138,7 @@ struct analog_port { ...@@ -138,7 +138,7 @@ struct analog_port {
#ifdef __i386__ #ifdef __i386__
#define GET_TIME(x) do { if (cpu_has_tsc) rdtscl(x); else x = get_time_pit(); } while (0) #define GET_TIME(x) do { if (cpu_has_tsc) rdtscl(x); else x = get_time_pit(); } while (0)
#define DELTA(x,y) (cpu_has_tsc?((y)-(x)):((x)-(y)+((x)<(y)?1193180L/HZ:0))) #define DELTA(x,y) (cpu_has_tsc?((y)-(x)):((x)-(y)+((x)<(y)?1193182L/HZ:0)))
#define TIME_NAME (cpu_has_tsc?"TSC":"PIT") #define TIME_NAME (cpu_has_tsc?"TSC":"PIT")
static unsigned int get_time_pit(void) static unsigned int get_time_pit(void)
{ {
......
...@@ -43,7 +43,7 @@ static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int c ...@@ -43,7 +43,7 @@ static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int c
} }
if (value > 20 && value < 32767) if (value > 20 && value < 32767)
count = 1193182 / value; count = CLOCK_TICK_RATE / value;
spin_lock_irqsave(&i8253_beep_lock, flags); spin_lock_irqsave(&i8253_beep_lock, flags);
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#ifdef CONFIG_MELAN #ifdef CONFIG_MELAN
# define CLOCK_TICK_RATE 1189200 /* AMD Elan has different frequency! */ # define CLOCK_TICK_RATE 1189200 /* AMD Elan has different frequency! */
#else #else
# define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ # define CLOCK_TICK_RATE 1193182 /* Underlying HZ */
#endif #endif
#endif #endif
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include <asm/msr.h> #include <asm/msr.h>
#include <asm/vsyscall.h> #include <asm/vsyscall.h>
#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ #define CLOCK_TICK_RATE 1193182 /* Underlying HZ */
#define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */ #define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */
#define FINETUNE ((((((int)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \ #define FINETUNE ((((((int)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \
(1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \ (1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment