summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorOsamu Tomita <tomita@cinet.co.jp>2003-02-12 12:49:26 +0100
committerVojtech Pavlik <vojtech@suse.cz>2003-02-12 12:49:26 +0100
commit7bf1da72c5082ccc76c58a7451ee844bf3d0a506 (patch)
tree443922fc901d1a4d86007c27ac7c58f8307b467c /drivers
parent7a4d842a773aced09bab3067bdde833fce49bd8a (diff)
input: Support for NEC PC-9800 beeper and support for Kana Lock LED.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/keyboard.c12
-rw-r--r--drivers/input/misc/98spkr.c95
-rw-r--r--drivers/input/misc/Kconfig4
-rw-r--r--drivers/input/misc/Makefile1
4 files changed, 106 insertions, 6 deletions
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index e388f305f524..ed453a23e4de 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -48,21 +48,21 @@ extern void ctrl_alt_del(void);
* Exported functions/variables
*/
-#ifndef KBD_DEFMODE
#define KBD_DEFMODE ((1 << VC_REPEAT) | (1 << VC_META))
-#endif
-#ifndef KBD_DEFLEDS
/*
* Some laptops take the 789uiojklm,. keys as number pad when NumLock is on.
- * This seems a good reason to start with NumLock off.
+ * This seems a good reason to start with NumLock off. On PC9800 however there
+ * is no NumLock key and everyone expects the keypad to be used for numbers.
*/
+
+#ifdef CONFIG_X86_PC9800
+#define KBD_DEFLEDS (1 << VC_NUMLOCK)
+#else
#define KBD_DEFLEDS 0
#endif
-#ifndef KBD_DEFLOCK
#define KBD_DEFLOCK 0
-#endif
void compute_shiftstate(void);
diff --git a/drivers/input/misc/98spkr.c b/drivers/input/misc/98spkr.c
new file mode 100644
index 000000000000..d50ac2a8a167
--- /dev/null
+++ b/drivers/input/misc/98spkr.c
@@ -0,0 +1,95 @@
+/*
+ * PC-9800 Speaker beeper driver for Linux
+ *
+ * Copyright (c) 2002 Osamu Tomita
+ * Copyright (c) 2002 Vojtech Pavlik
+ * Copyright (c) 1992 Orest Zborowski
+ *
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/input.h>
+#include <asm/io.h>
+
+MODULE_AUTHOR("Osamu Tomita <tomita@cinet.co.jp>");
+MODULE_DESCRIPTION("PC-9800 Speaker beeper driver");
+MODULE_LICENSE("GPL");
+
+static char spkr98_name[] = "PC-9801 Speaker";
+static char spkr98_phys[] = "isa3fdb/input0";
+static struct input_dev spkr98_dev;
+
+spinlock_t i8253_beep_lock = SPIN_LOCK_UNLOCKED;
+
+static int spkr98_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
+{
+ unsigned int count = 0;
+ unsigned long flags;
+
+ if (type != EV_SND)
+ return -1;
+
+ switch (code) {
+ case SND_BELL: if (value) value = 1000;
+ case SND_TONE: break;
+ default: return -1;
+ }
+
+ if (value > 20 && value < 32767)
+ count = CLOCK_TICK_RATE / value;
+
+ spin_lock_irqsave(&i8253_beep_lock, flags);
+
+ if (count) {
+ outb(0x76, 0x3fdf);
+ outb(0, 0x5f);
+ outb(count & 0xff, 0x3fdb);
+ outb(0, 0x5f);
+ outb((count >> 8) & 0xff, 0x3fdb);
+ /* beep on */
+ outb(6, 0x37);
+ } else {
+ /* beep off */
+ outb(7, 0x37);
+ }
+
+ spin_unlock_irqrestore(&i8253_beep_lock, flags);
+
+ return 0;
+}
+
+static int __init spkr98_init(void)
+{
+ spkr98_dev.evbit[0] = BIT(EV_SND);
+ spkr98_dev.sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE);
+ spkr98_dev.event = spkr98_event;
+
+ spkr98_dev.name = spkr98_name;
+ spkr98_dev.phys = spkr98_phys;
+ spkr98_dev.id.bustype = BUS_ISA;
+ spkr98_dev.id.vendor = 0x001f;
+ spkr98_dev.id.product = 0x0001;
+ spkr98_dev.id.version = 0x0100;
+
+ input_register_device(&spkr98_dev);
+
+ printk(KERN_INFO "input: %s\n", spkr98_name);
+
+ return 0;
+}
+
+static void __exit spkr98_exit(void)
+{
+ input_unregister_device(&spkr98_dev);
+}
+
+module_init(spkr98_init);
+module_exit(spkr98_exit);
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 9f2772a32d69..6fb4451fec73 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -44,6 +44,10 @@ config INPUT_M68K_BEEP
tristate "M68k Beeper support"
depends on M68K && INPUT && INPUT_MISC
+config INPUT_98SPKR
+ tristate "PC-9800 Speaker support"
+ depends on X86_PC9800 && INPUT && INPUT_MISC
+
config INPUT_UINPUT
tristate "User level driver support"
depends on INPUT && INPUT_MISC
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 908b5bb0f897..3dd91a1f968b 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -7,5 +7,6 @@
obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o
obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o
obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o
+obj-$(CONFIG_INPUT_98SPKR) += 98spkr.o
obj-$(CONFIG_INPUT_UINPUT) += uinput.o
obj-$(CONFIG_INPUT_GSC) += gsc_ps2.o