diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 15:20:36 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 15:20:36 -0700 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/input/misc/m68kspkr.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'drivers/input/misc/m68kspkr.c')
-rw-r--r-- | drivers/input/misc/m68kspkr.c | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/drivers/input/misc/m68kspkr.c b/drivers/input/misc/m68kspkr.c new file mode 100644 index 00000000000..64abdd98d48 --- /dev/null +++ b/drivers/input/misc/m68kspkr.c @@ -0,0 +1,83 @@ +/* + * m68k beeper driver for Linux + * + * Copyright (c) 2002 Richard Zidlicky + * 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/machdep.h> +#include <asm/io.h> + +MODULE_AUTHOR("Richard Zidlicky <rz@linux-m68k.org>"); +MODULE_DESCRIPTION("m68k beeper driver"); +MODULE_LICENSE("GPL"); + +static char m68kspkr_name[] = "m68k beeper"; +static char m68kspkr_phys[] = "m68k/generic"; +static struct input_dev m68kspkr_dev; + +static int m68kspkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) +{ + unsigned int count = 0; + + 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 = 1193182 / value; + + mach_beep(count, -1); + + return 0; +} + +static int __init m68kspkr_init(void) +{ + if (!mach_beep){ + printk("%s: no lowlevel beep support\n", m68kspkr_name); + return -1; + } + + m68kspkr_dev.evbit[0] = BIT(EV_SND); + m68kspkr_dev.sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); + m68kspkr_dev.event = m68kspkr_event; + + m68kspkr_dev.name = m68kspkr_name; + m68kspkr_dev.phys = m68kspkr_phys; + m68kspkr_dev.id.bustype = BUS_HOST; + m68kspkr_dev.id.vendor = 0x001f; + m68kspkr_dev.id.product = 0x0001; + m68kspkr_dev.id.version = 0x0100; + + input_register_device(&m68kspkr_dev); + + printk(KERN_INFO "input: %s\n", m68kspkr_name); + + return 0; +} + +static void __exit m68kspkr_exit(void) +{ + input_unregister_device(&m68kspkr_dev); +} + +module_init(m68kspkr_init); +module_exit(m68kspkr_exit); |