diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
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 000000000000..64abdd98d482 --- /dev/null +++ b/drivers/input/misc/m68kspkr.c | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * m68k beeper driver for Linux | ||
3 | * | ||
4 | * Copyright (c) 2002 Richard Zidlicky | ||
5 | * Copyright (c) 2002 Vojtech Pavlik | ||
6 | * Copyright (c) 1992 Orest Zborowski | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | /* | ||
11 | * This program is free software; you can redistribute it and/or modify it | ||
12 | * under the terms of the GNU General Public License version 2 as published by | ||
13 | * the Free Software Foundation | ||
14 | */ | ||
15 | |||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/input.h> | ||
20 | #include <asm/machdep.h> | ||
21 | #include <asm/io.h> | ||
22 | |||
23 | MODULE_AUTHOR("Richard Zidlicky <rz@linux-m68k.org>"); | ||
24 | MODULE_DESCRIPTION("m68k beeper driver"); | ||
25 | MODULE_LICENSE("GPL"); | ||
26 | |||
27 | static char m68kspkr_name[] = "m68k beeper"; | ||
28 | static char m68kspkr_phys[] = "m68k/generic"; | ||
29 | static struct input_dev m68kspkr_dev; | ||
30 | |||
31 | static int m68kspkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | ||
32 | { | ||
33 | unsigned int count = 0; | ||
34 | |||
35 | if (type != EV_SND) | ||
36 | return -1; | ||
37 | |||
38 | switch (code) { | ||
39 | case SND_BELL: if (value) value = 1000; | ||
40 | case SND_TONE: break; | ||
41 | default: return -1; | ||
42 | } | ||
43 | |||
44 | if (value > 20 && value < 32767) | ||
45 | count = 1193182 / value; | ||
46 | |||
47 | mach_beep(count, -1); | ||
48 | |||
49 | return 0; | ||
50 | } | ||
51 | |||
52 | static int __init m68kspkr_init(void) | ||
53 | { | ||
54 | if (!mach_beep){ | ||
55 | printk("%s: no lowlevel beep support\n", m68kspkr_name); | ||
56 | return -1; | ||
57 | } | ||
58 | |||
59 | m68kspkr_dev.evbit[0] = BIT(EV_SND); | ||
60 | m68kspkr_dev.sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); | ||
61 | m68kspkr_dev.event = m68kspkr_event; | ||
62 | |||
63 | m68kspkr_dev.name = m68kspkr_name; | ||
64 | m68kspkr_dev.phys = m68kspkr_phys; | ||
65 | m68kspkr_dev.id.bustype = BUS_HOST; | ||
66 | m68kspkr_dev.id.vendor = 0x001f; | ||
67 | m68kspkr_dev.id.product = 0x0001; | ||
68 | m68kspkr_dev.id.version = 0x0100; | ||
69 | |||
70 | input_register_device(&m68kspkr_dev); | ||
71 | |||
72 | printk(KERN_INFO "input: %s\n", m68kspkr_name); | ||
73 | |||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | static void __exit m68kspkr_exit(void) | ||
78 | { | ||
79 | input_unregister_device(&m68kspkr_dev); | ||
80 | } | ||
81 | |||
82 | module_init(m68kspkr_init); | ||
83 | module_exit(m68kspkr_exit); | ||