diff options
Diffstat (limited to 'drivers/input/misc')
-rw-r--r-- | drivers/input/misc/m68kspkr.c | 102 | ||||
-rw-r--r-- | drivers/input/misc/pcspkr.c | 86 | ||||
-rw-r--r-- | drivers/input/misc/sparcspkr.c | 162 | ||||
-rw-r--r-- | drivers/input/misc/wistron_btns.c | 133 |
4 files changed, 357 insertions, 126 deletions
diff --git a/drivers/input/misc/m68kspkr.c b/drivers/input/misc/m68kspkr.c index 04489ad7702a..8d6c3837badb 100644 --- a/drivers/input/misc/m68kspkr.c +++ b/drivers/input/misc/m68kspkr.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/input.h> | 19 | #include <linux/input.h> |
20 | #include <linux/platform_device.h> | ||
20 | #include <asm/machdep.h> | 21 | #include <asm/machdep.h> |
21 | #include <asm/io.h> | 22 | #include <asm/io.h> |
22 | 23 | ||
@@ -24,7 +25,7 @@ MODULE_AUTHOR("Richard Zidlicky <rz@linux-m68k.org>"); | |||
24 | MODULE_DESCRIPTION("m68k beeper driver"); | 25 | MODULE_DESCRIPTION("m68k beeper driver"); |
25 | MODULE_LICENSE("GPL"); | 26 | MODULE_LICENSE("GPL"); |
26 | 27 | ||
27 | static struct input_dev *m68kspkr_dev; | 28 | static struct platform_device *m68kspkr_platform_device; |
28 | 29 | ||
29 | static int m68kspkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | 30 | static int m68kspkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) |
30 | { | 31 | { |
@@ -47,36 +48,103 @@ static int m68kspkr_event(struct input_dev *dev, unsigned int type, unsigned int | |||
47 | return 0; | 48 | return 0; |
48 | } | 49 | } |
49 | 50 | ||
51 | static int __devinit m68kspkr_probe(struct platform_device *dev) | ||
52 | { | ||
53 | struct input_dev *input_dev; | ||
54 | int err; | ||
55 | |||
56 | input_dev = input_allocate_device(); | ||
57 | if (!input_dev) | ||
58 | return -ENOMEM; | ||
59 | |||
60 | input_dev->name = "m68k beeper"; | ||
61 | input_dev->phys = "m68k/generic"; | ||
62 | input_dev->id.bustype = BUS_HOST; | ||
63 | input_dev->id.vendor = 0x001f; | ||
64 | input_dev->id.product = 0x0001; | ||
65 | input_dev->id.version = 0x0100; | ||
66 | input_dev->cdev.dev = &dev->dev; | ||
67 | |||
68 | input_dev->evbit[0] = BIT(EV_SND); | ||
69 | input_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); | ||
70 | input_dev->event = m68kspkr_event; | ||
71 | |||
72 | err = input_register_device(input_dev); | ||
73 | if (err) { | ||
74 | input_free_device(input_dev); | ||
75 | return err; | ||
76 | } | ||
77 | |||
78 | platform_set_drvdata(dev, input_dev); | ||
79 | |||
80 | return 0; | ||
81 | } | ||
82 | |||
83 | static int __devexit m68kspkr_remove(struct platform_device *dev) | ||
84 | { | ||
85 | struct input_dev *input_dev = platform_get_drvdata(dev); | ||
86 | |||
87 | input_unregister_device(input_dev); | ||
88 | platform_set_drvdata(dev, NULL); | ||
89 | /* turn off the speaker */ | ||
90 | m68kspkr_event(NULL, EV_SND, SND_BELL, 0); | ||
91 | |||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | static void m68kspkr_shutdown(struct platform_device *dev) | ||
96 | { | ||
97 | /* turn off the speaker */ | ||
98 | m68kspkr_event(NULL, EV_SND, SND_BELL, 0); | ||
99 | } | ||
100 | |||
101 | static struct platform_driver m68kspkr_platform_driver = { | ||
102 | .driver = { | ||
103 | .name = "m68kspkr", | ||
104 | .owner = THIS_MODULE, | ||
105 | }, | ||
106 | .probe = m68kspkr_probe, | ||
107 | .remove = __devexit_p(m68kspkr_remove), | ||
108 | .shutdown = m68kspkr_shutdown, | ||
109 | }; | ||
110 | |||
50 | static int __init m68kspkr_init(void) | 111 | static int __init m68kspkr_init(void) |
51 | { | 112 | { |
52 | if (!mach_beep) { | 113 | int err; |
114 | |||
115 | if (!mach_beep) { | ||
53 | printk(KERN_INFO "m68kspkr: no lowlevel beep support\n"); | 116 | printk(KERN_INFO "m68kspkr: no lowlevel beep support\n"); |
54 | return -ENODEV; | 117 | return -ENODEV; |
55 | } | 118 | } |
56 | 119 | ||
57 | m68kspkr_dev = input_allocate_device(); | 120 | err = platform_driver_register(&m68kspkr_platform_driver); |
58 | if (!m68kspkr_dev) | 121 | if (err) |
59 | return -ENOMEM; | 122 | return err; |
60 | |||
61 | m68kspkr_dev->name = "m68k beeper"; | ||
62 | m68kspkr_dev->phys = "m68k/generic"; | ||
63 | m68kspkr_dev->id.bustype = BUS_HOST; | ||
64 | m68kspkr_dev->id.vendor = 0x001f; | ||
65 | m68kspkr_dev->id.product = 0x0001; | ||
66 | m68kspkr_dev->id.version = 0x0100; | ||
67 | 123 | ||
68 | m68kspkr_dev->evbit[0] = BIT(EV_SND); | 124 | m68kspkr_platform_device = platform_device_alloc("m68kspkr", -1); |
69 | m68kspkr_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); | 125 | if (!m68kspkr_platform_device) { |
70 | m68kspkr_dev->event = m68kspkr_event; | 126 | err = -ENOMEM; |
127 | goto err_unregister_driver; | ||
128 | } | ||
71 | 129 | ||
72 | input_register_device(m68kspkr_dev); | 130 | err = platform_device_add(m68kspkr_platform_device); |
131 | if (err) | ||
132 | goto err_free_device; | ||
73 | 133 | ||
74 | return 0; | 134 | return 0; |
135 | |||
136 | err_free_device: | ||
137 | platform_device_put(m68kspkr_platform_device); | ||
138 | err_unregister_driver: | ||
139 | platform_driver_unregister(&m68kspkr_platform_driver); | ||
140 | |||
141 | return err; | ||
75 | } | 142 | } |
76 | 143 | ||
77 | static void __exit m68kspkr_exit(void) | 144 | static void __exit m68kspkr_exit(void) |
78 | { | 145 | { |
79 | input_unregister_device(m68kspkr_dev); | 146 | platform_device_unregister(m68kspkr_platform_device); |
147 | platform_driver_unregister(&m68kspkr_platform_driver); | ||
80 | } | 148 | } |
81 | 149 | ||
82 | module_init(m68kspkr_init); | 150 | module_init(m68kspkr_init); |
diff --git a/drivers/input/misc/pcspkr.c b/drivers/input/misc/pcspkr.c index 68ac97f101b0..1ef477f4469c 100644 --- a/drivers/input/misc/pcspkr.c +++ b/drivers/input/misc/pcspkr.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/input.h> | 18 | #include <linux/input.h> |
19 | #include <linux/platform_device.h> | ||
19 | #include <asm/8253pit.h> | 20 | #include <asm/8253pit.h> |
20 | #include <asm/io.h> | 21 | #include <asm/io.h> |
21 | 22 | ||
@@ -23,8 +24,7 @@ MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); | |||
23 | MODULE_DESCRIPTION("PC Speaker beeper driver"); | 24 | MODULE_DESCRIPTION("PC Speaker beeper driver"); |
24 | MODULE_LICENSE("GPL"); | 25 | MODULE_LICENSE("GPL"); |
25 | 26 | ||
26 | static struct input_dev *pcspkr_dev; | 27 | static struct platform_device *pcspkr_platform_device; |
27 | |||
28 | static DEFINE_SPINLOCK(i8253_beep_lock); | 28 | static DEFINE_SPINLOCK(i8253_beep_lock); |
29 | 29 | ||
30 | static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | 30 | static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) |
@@ -64,8 +64,11 @@ static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int c | |||
64 | return 0; | 64 | return 0; |
65 | } | 65 | } |
66 | 66 | ||
67 | static int __init pcspkr_init(void) | 67 | static int __devinit pcspkr_probe(struct platform_device *dev) |
68 | { | 68 | { |
69 | struct input_dev *pcspkr_dev; | ||
70 | int err; | ||
71 | |||
69 | pcspkr_dev = input_allocate_device(); | 72 | pcspkr_dev = input_allocate_device(); |
70 | if (!pcspkr_dev) | 73 | if (!pcspkr_dev) |
71 | return -ENOMEM; | 74 | return -ENOMEM; |
@@ -76,22 +79,93 @@ static int __init pcspkr_init(void) | |||
76 | pcspkr_dev->id.vendor = 0x001f; | 79 | pcspkr_dev->id.vendor = 0x001f; |
77 | pcspkr_dev->id.product = 0x0001; | 80 | pcspkr_dev->id.product = 0x0001; |
78 | pcspkr_dev->id.version = 0x0100; | 81 | pcspkr_dev->id.version = 0x0100; |
82 | pcspkr_dev->cdev.dev = &dev->dev; | ||
79 | 83 | ||
80 | pcspkr_dev->evbit[0] = BIT(EV_SND); | 84 | pcspkr_dev->evbit[0] = BIT(EV_SND); |
81 | pcspkr_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); | 85 | pcspkr_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); |
82 | pcspkr_dev->event = pcspkr_event; | 86 | pcspkr_dev->event = pcspkr_event; |
83 | 87 | ||
84 | input_register_device(pcspkr_dev); | 88 | err = input_register_device(pcspkr_dev); |
89 | if (err) { | ||
90 | input_free_device(pcspkr_dev); | ||
91 | return err; | ||
92 | } | ||
93 | |||
94 | platform_set_drvdata(dev, pcspkr_dev); | ||
85 | 95 | ||
86 | return 0; | 96 | return 0; |
87 | } | 97 | } |
88 | 98 | ||
89 | static void __exit pcspkr_exit(void) | 99 | static int __devexit pcspkr_remove(struct platform_device *dev) |
100 | { | ||
101 | struct input_dev *pcspkr_dev = platform_get_drvdata(dev); | ||
102 | |||
103 | input_unregister_device(pcspkr_dev); | ||
104 | platform_set_drvdata(dev, NULL); | ||
105 | /* turn off the speaker */ | ||
106 | pcspkr_event(NULL, EV_SND, SND_BELL, 0); | ||
107 | |||
108 | return 0; | ||
109 | } | ||
110 | |||
111 | static int pcspkr_suspend(struct platform_device *dev, pm_message_t state) | ||
112 | { | ||
113 | pcspkr_event(NULL, EV_SND, SND_BELL, 0); | ||
114 | |||
115 | return 0; | ||
116 | } | ||
117 | |||
118 | static void pcspkr_shutdown(struct platform_device *dev) | ||
90 | { | 119 | { |
91 | input_unregister_device(pcspkr_dev); | ||
92 | /* turn off the speaker */ | 120 | /* turn off the speaker */ |
93 | pcspkr_event(NULL, EV_SND, SND_BELL, 0); | 121 | pcspkr_event(NULL, EV_SND, SND_BELL, 0); |
94 | } | 122 | } |
95 | 123 | ||
124 | static struct platform_driver pcspkr_platform_driver = { | ||
125 | .driver = { | ||
126 | .name = "pcspkr", | ||
127 | .owner = THIS_MODULE, | ||
128 | }, | ||
129 | .probe = pcspkr_probe, | ||
130 | .remove = __devexit_p(pcspkr_remove), | ||
131 | .suspend = pcspkr_suspend, | ||
132 | .shutdown = pcspkr_shutdown, | ||
133 | }; | ||
134 | |||
135 | |||
136 | static int __init pcspkr_init(void) | ||
137 | { | ||
138 | int err; | ||
139 | |||
140 | err = platform_driver_register(&pcspkr_platform_driver); | ||
141 | if (err) | ||
142 | return err; | ||
143 | |||
144 | pcspkr_platform_device = platform_device_alloc("pcspkr", -1); | ||
145 | if (!pcspkr_platform_device) { | ||
146 | err = -ENOMEM; | ||
147 | goto err_unregister_driver; | ||
148 | } | ||
149 | |||
150 | err = platform_device_add(pcspkr_platform_device); | ||
151 | if (err) | ||
152 | goto err_free_device; | ||
153 | |||
154 | return 0; | ||
155 | |||
156 | err_free_device: | ||
157 | platform_device_put(pcspkr_platform_device); | ||
158 | err_unregister_driver: | ||
159 | platform_driver_unregister(&pcspkr_platform_driver); | ||
160 | |||
161 | return err; | ||
162 | } | ||
163 | |||
164 | static void __exit pcspkr_exit(void) | ||
165 | { | ||
166 | platform_device_unregister(pcspkr_platform_device); | ||
167 | platform_driver_unregister(&pcspkr_platform_driver); | ||
168 | } | ||
169 | |||
96 | module_init(pcspkr_init); | 170 | module_init(pcspkr_init); |
97 | module_exit(pcspkr_exit); | 171 | module_exit(pcspkr_exit); |
diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c index 29d97b12be7a..f0fd2c4740f1 100644 --- a/drivers/input/misc/sparcspkr.c +++ b/drivers/input/misc/sparcspkr.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/init.h> | 10 | #include <linux/init.h> |
11 | #include <linux/input.h> | 11 | #include <linux/input.h> |
12 | #include <linux/platform_device.h> | ||
12 | 13 | ||
13 | #include <asm/io.h> | 14 | #include <asm/io.h> |
14 | #include <asm/ebus.h> | 15 | #include <asm/ebus.h> |
@@ -20,22 +21,10 @@ MODULE_AUTHOR("David S. Miller <davem@redhat.com>"); | |||
20 | MODULE_DESCRIPTION("Sparc Speaker beeper driver"); | 21 | MODULE_DESCRIPTION("Sparc Speaker beeper driver"); |
21 | MODULE_LICENSE("GPL"); | 22 | MODULE_LICENSE("GPL"); |
22 | 23 | ||
24 | const char *beep_name; | ||
23 | static unsigned long beep_iobase; | 25 | static unsigned long beep_iobase; |
24 | static struct input_dev *sparcspkr_dev; | 26 | static int (*beep_event)(struct input_dev *dev, unsigned int type, unsigned int code, int value); |
25 | 27 | static DEFINE_SPINLOCK(beep_lock); | |
26 | DEFINE_SPINLOCK(beep_lock); | ||
27 | |||
28 | static void __init init_sparcspkr_struct(void) | ||
29 | { | ||
30 | sparcspkr_dev->evbit[0] = BIT(EV_SND); | ||
31 | sparcspkr_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); | ||
32 | |||
33 | sparcspkr_dev->phys = "sparc/input0"; | ||
34 | sparcspkr_dev->id.bustype = BUS_ISA; | ||
35 | sparcspkr_dev->id.vendor = 0x001f; | ||
36 | sparcspkr_dev->id.product = 0x0001; | ||
37 | sparcspkr_dev->id.version = 0x0100; | ||
38 | } | ||
39 | 28 | ||
40 | static int ebus_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | 29 | static int ebus_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) |
41 | { | 30 | { |
@@ -59,39 +48,16 @@ static int ebus_spkr_event(struct input_dev *dev, unsigned int type, unsigned in | |||
59 | /* EBUS speaker only has on/off state, the frequency does not | 48 | /* EBUS speaker only has on/off state, the frequency does not |
60 | * appear to be programmable. | 49 | * appear to be programmable. |
61 | */ | 50 | */ |
62 | if (count) { | 51 | if (beep_iobase & 0x2UL) |
63 | if (beep_iobase & 0x2UL) | 52 | outb(!!count, beep_iobase); |
64 | outb(1, beep_iobase); | 53 | else |
65 | else | 54 | outl(!!count, beep_iobase); |
66 | outl(1, beep_iobase); | ||
67 | } else { | ||
68 | if (beep_iobase & 0x2UL) | ||
69 | outb(0, beep_iobase); | ||
70 | else | ||
71 | outl(0, beep_iobase); | ||
72 | } | ||
73 | 55 | ||
74 | spin_unlock_irqrestore(&beep_lock, flags); | 56 | spin_unlock_irqrestore(&beep_lock, flags); |
75 | 57 | ||
76 | return 0; | 58 | return 0; |
77 | } | 59 | } |
78 | 60 | ||
79 | static int __init init_ebus_beep(struct linux_ebus_device *edev) | ||
80 | { | ||
81 | beep_iobase = edev->resource[0].start; | ||
82 | |||
83 | sparcspkr_dev = input_allocate_device(); | ||
84 | if (!sparcspkr_dev) | ||
85 | return -ENOMEM; | ||
86 | |||
87 | sparcspkr_dev->name = "Sparc EBUS Speaker"; | ||
88 | sparcspkr_dev->event = ebus_spkr_event; | ||
89 | |||
90 | input_register_device(sparcspkr_dev); | ||
91 | |||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | #ifdef CONFIG_SPARC64 | 61 | #ifdef CONFIG_SPARC64 |
96 | static int isa_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | 62 | static int isa_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) |
97 | { | 63 | { |
@@ -129,30 +95,103 @@ static int isa_spkr_event(struct input_dev *dev, unsigned int type, unsigned int | |||
129 | 95 | ||
130 | return 0; | 96 | return 0; |
131 | } | 97 | } |
98 | #endif | ||
132 | 99 | ||
133 | static int __init init_isa_beep(struct sparc_isa_device *isa_dev) | 100 | static int __devinit sparcspkr_probe(struct platform_device *dev) |
134 | { | 101 | { |
135 | beep_iobase = isa_dev->resource.start; | 102 | struct input_dev *input_dev; |
103 | int error; | ||
136 | 104 | ||
137 | sparcspkr_dev = input_allocate_device(); | 105 | input_dev = input_allocate_device(); |
138 | if (!sparcspkr_dev) | 106 | if (!input_dev) |
139 | return -ENOMEM; | 107 | return -ENOMEM; |
140 | 108 | ||
141 | init_sparcspkr_struct(); | 109 | input_dev->name = beep_name; |
110 | input_dev->phys = "sparc/input0"; | ||
111 | input_dev->id.bustype = BUS_ISA; | ||
112 | input_dev->id.vendor = 0x001f; | ||
113 | input_dev->id.product = 0x0001; | ||
114 | input_dev->id.version = 0x0100; | ||
115 | input_dev->cdev.dev = &dev->dev; | ||
142 | 116 | ||
143 | sparcspkr_dev->name = "Sparc ISA Speaker"; | 117 | input_dev->evbit[0] = BIT(EV_SND); |
144 | sparcspkr_dev->event = isa_spkr_event; | 118 | input_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); |
145 | 119 | ||
146 | input_register_device(sparcspkr_dev); | 120 | input_dev->event = beep_event; |
121 | |||
122 | error = input_register_device(input_dev); | ||
123 | if (error) { | ||
124 | input_free_device(input_dev); | ||
125 | return error; | ||
126 | } | ||
127 | |||
128 | platform_set_drvdata(dev, input_dev); | ||
147 | 129 | ||
148 | return 0; | 130 | return 0; |
149 | } | 131 | } |
150 | #endif | 132 | |
133 | static int __devexit sparcspkr_remove(struct platform_device *dev) | ||
134 | { | ||
135 | struct input_dev *input_dev = platform_get_drvdata(dev); | ||
136 | |||
137 | input_unregister_device(input_dev); | ||
138 | platform_set_drvdata(dev, NULL); | ||
139 | /* turn off the speaker */ | ||
140 | beep_event(NULL, EV_SND, SND_BELL, 0); | ||
141 | |||
142 | return 0; | ||
143 | } | ||
144 | |||
145 | static void sparcspkr_shutdown(struct platform_device *dev) | ||
146 | { | ||
147 | /* turn off the speaker */ | ||
148 | beep_event(NULL, EV_SND, SND_BELL, 0); | ||
149 | } | ||
150 | |||
151 | static struct platform_driver sparcspkr_platform_driver = { | ||
152 | .driver = { | ||
153 | .name = "sparcspkr", | ||
154 | .owner = THIS_MODULE, | ||
155 | }, | ||
156 | .probe = sparcspkr_probe, | ||
157 | .remove = __devexit_p(sparcspkr_remove), | ||
158 | .shutdown = sparcspkr_shutdown, | ||
159 | }; | ||
160 | |||
161 | static struct platform_device *sparcspkr_platform_device; | ||
162 | |||
163 | static int __init sparcspkr_drv_init(void) | ||
164 | { | ||
165 | int error; | ||
166 | |||
167 | error = platform_driver_register(&sparcspkr_platform_driver); | ||
168 | if (error) | ||
169 | return error; | ||
170 | |||
171 | sparcspkr_platform_device = platform_device_alloc("sparcspkr", -1); | ||
172 | if (!sparcspkr_platform_device) { | ||
173 | error = -ENOMEM; | ||
174 | goto err_unregister_driver; | ||
175 | } | ||
176 | |||
177 | error = platform_device_add(sparcspkr_platform_device); | ||
178 | if (error) | ||
179 | goto err_free_device; | ||
180 | |||
181 | return 0; | ||
182 | |||
183 | err_free_device: | ||
184 | platform_device_put(sparcspkr_platform_device); | ||
185 | err_unregister_driver: | ||
186 | platform_driver_unregister(&sparcspkr_platform_driver); | ||
187 | |||
188 | return error; | ||
189 | } | ||
151 | 190 | ||
152 | static int __init sparcspkr_init(void) | 191 | static int __init sparcspkr_init(void) |
153 | { | 192 | { |
154 | struct linux_ebus *ebus; | 193 | struct linux_ebus *ebus; |
155 | struct linux_ebus_device *edev = NULL; | 194 | struct linux_ebus_device *edev; |
156 | #ifdef CONFIG_SPARC64 | 195 | #ifdef CONFIG_SPARC64 |
157 | struct sparc_isa_bridge *isa_br; | 196 | struct sparc_isa_bridge *isa_br; |
158 | struct sparc_isa_device *isa_dev; | 197 | struct sparc_isa_device *isa_dev; |
@@ -160,8 +199,12 @@ static int __init sparcspkr_init(void) | |||
160 | 199 | ||
161 | for_each_ebus(ebus) { | 200 | for_each_ebus(ebus) { |
162 | for_each_ebusdev(edev, ebus) { | 201 | for_each_ebusdev(edev, ebus) { |
163 | if (!strcmp(edev->prom_name, "beep")) | 202 | if (!strcmp(edev->prom_name, "beep")) { |
164 | return init_ebus_beep(edev); | 203 | beep_name = "Sparc EBUS Speaker"; |
204 | beep_event = ebus_spkr_event; | ||
205 | beep_iobase = edev->resource[0].start; | ||
206 | return sparcspkr_drv_init(); | ||
207 | } | ||
165 | } | 208 | } |
166 | } | 209 | } |
167 | #ifdef CONFIG_SPARC64 | 210 | #ifdef CONFIG_SPARC64 |
@@ -170,8 +213,12 @@ static int __init sparcspkr_init(void) | |||
170 | /* A hack, the beep device's base lives in | 213 | /* A hack, the beep device's base lives in |
171 | * the DMA isa node. | 214 | * the DMA isa node. |
172 | */ | 215 | */ |
173 | if (!strcmp(isa_dev->prom_name, "dma")) | 216 | if (!strcmp(isa_dev->prom_name, "dma")) { |
174 | return init_isa_beep(isa_dev); | 217 | beep_name = "Sparc ISA Speaker"; |
218 | beep_event = isa_spkr_event, | ||
219 | beep_iobase = isa_dev->resource.start; | ||
220 | return sparcspkr_drv_init(); | ||
221 | } | ||
175 | } | 222 | } |
176 | } | 223 | } |
177 | #endif | 224 | #endif |
@@ -181,7 +228,8 @@ static int __init sparcspkr_init(void) | |||
181 | 228 | ||
182 | static void __exit sparcspkr_exit(void) | 229 | static void __exit sparcspkr_exit(void) |
183 | { | 230 | { |
184 | input_unregister_device(sparcspkr_dev); | 231 | platform_device_unregister(sparcspkr_platform_device); |
232 | platform_driver_unregister(&sparcspkr_platform_driver); | ||
185 | } | 233 | } |
186 | 234 | ||
187 | module_init(sparcspkr_init); | 235 | module_init(sparcspkr_init); |
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c index bac3085185fe..a05b8557842f 100644 --- a/drivers/input/misc/wistron_btns.c +++ b/drivers/input/misc/wistron_btns.c | |||
@@ -174,7 +174,7 @@ static u16 bios_pop_queue(void) | |||
174 | return regs.eax; | 174 | return regs.eax; |
175 | } | 175 | } |
176 | 176 | ||
177 | static void __init bios_attach(void) | 177 | static void __devinit bios_attach(void) |
178 | { | 178 | { |
179 | struct regs regs; | 179 | struct regs regs; |
180 | 180 | ||
@@ -194,7 +194,7 @@ static void bios_detach(void) | |||
194 | call_bios(®s); | 194 | call_bios(®s); |
195 | } | 195 | } |
196 | 196 | ||
197 | static u8 __init bios_get_cmos_address(void) | 197 | static u8 __devinit bios_get_cmos_address(void) |
198 | { | 198 | { |
199 | struct regs regs; | 199 | struct regs regs; |
200 | 200 | ||
@@ -206,7 +206,7 @@ static u8 __init bios_get_cmos_address(void) | |||
206 | return regs.ecx; | 206 | return regs.ecx; |
207 | } | 207 | } |
208 | 208 | ||
209 | static u16 __init bios_get_default_setting(u8 subsys) | 209 | static u16 __devinit bios_get_default_setting(u8 subsys) |
210 | { | 210 | { |
211 | struct regs regs; | 211 | struct regs regs; |
212 | 212 | ||
@@ -296,6 +296,16 @@ static struct key_entry keymap_acer_aspire_1500[] = { | |||
296 | { KE_END, 0 } | 296 | { KE_END, 0 } |
297 | }; | 297 | }; |
298 | 298 | ||
299 | static struct key_entry keymap_acer_travelmate_240[] = { | ||
300 | { KE_KEY, 0x31, KEY_MAIL }, | ||
301 | { KE_KEY, 0x36, KEY_WWW }, | ||
302 | { KE_KEY, 0x11, KEY_PROG1 }, | ||
303 | { KE_KEY, 0x12, KEY_PROG2 }, | ||
304 | { KE_BLUETOOTH, 0x44, 0 }, | ||
305 | { KE_WIFI, 0x30, 0 }, | ||
306 | { KE_END, 0 } | ||
307 | }; | ||
308 | |||
299 | /* | 309 | /* |
300 | * If your machine is not here (which is currently rather likely), please send | 310 | * If your machine is not here (which is currently rather likely), please send |
301 | * a list of buttons and their key codes (reported when loading this module | 311 | * a list of buttons and their key codes (reported when loading this module |
@@ -320,6 +330,15 @@ static struct dmi_system_id dmi_ids[] = { | |||
320 | }, | 330 | }, |
321 | .driver_data = keymap_acer_aspire_1500 | 331 | .driver_data = keymap_acer_aspire_1500 |
322 | }, | 332 | }, |
333 | { | ||
334 | .callback = dmi_matched, | ||
335 | .ident = "Acer TravelMate 240", | ||
336 | .matches = { | ||
337 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
338 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 240"), | ||
339 | }, | ||
340 | .driver_data = keymap_acer_travelmate_240 | ||
341 | }, | ||
323 | { NULL, } | 342 | { NULL, } |
324 | }; | 343 | }; |
325 | 344 | ||
@@ -348,7 +367,7 @@ static int __init select_keymap(void) | |||
348 | 367 | ||
349 | static struct input_dev *input_dev; | 368 | static struct input_dev *input_dev; |
350 | 369 | ||
351 | static int __init setup_input_dev(void) | 370 | static int __devinit setup_input_dev(void) |
352 | { | 371 | { |
353 | const struct key_entry *key; | 372 | const struct key_entry *key; |
354 | int error; | 373 | int error; |
@@ -447,6 +466,52 @@ static void poll_bios(unsigned long discard) | |||
447 | mod_timer(&poll_timer, jiffies + HZ / POLL_FREQUENCY); | 466 | mod_timer(&poll_timer, jiffies + HZ / POLL_FREQUENCY); |
448 | } | 467 | } |
449 | 468 | ||
469 | static int __devinit wistron_probe(struct platform_device *dev) | ||
470 | { | ||
471 | int err = setup_input_dev(); | ||
472 | if (err) | ||
473 | return err; | ||
474 | |||
475 | bios_attach(); | ||
476 | cmos_address = bios_get_cmos_address(); | ||
477 | |||
478 | if (have_wifi) { | ||
479 | u16 wifi = bios_get_default_setting(WIFI); | ||
480 | if (wifi & 1) | ||
481 | wifi_enabled = (wifi & 2) ? 1 : 0; | ||
482 | else | ||
483 | have_wifi = 0; | ||
484 | |||
485 | if (have_wifi) | ||
486 | bios_set_state(WIFI, wifi_enabled); | ||
487 | } | ||
488 | |||
489 | if (have_bluetooth) { | ||
490 | u16 bt = bios_get_default_setting(BLUETOOTH); | ||
491 | if (bt & 1) | ||
492 | bluetooth_enabled = (bt & 2) ? 1 : 0; | ||
493 | else | ||
494 | have_bluetooth = 0; | ||
495 | |||
496 | if (have_bluetooth) | ||
497 | bios_set_state(BLUETOOTH, bluetooth_enabled); | ||
498 | } | ||
499 | |||
500 | poll_bios(1); /* Flush stale event queue and arm timer */ | ||
501 | |||
502 | return 0; | ||
503 | } | ||
504 | |||
505 | static int __devexit wistron_remove(struct platform_device *dev) | ||
506 | { | ||
507 | del_timer_sync(&poll_timer); | ||
508 | input_unregister_device(input_dev); | ||
509 | bios_detach(); | ||
510 | |||
511 | return 0; | ||
512 | } | ||
513 | |||
514 | #ifdef CONFIG_PM | ||
450 | static int wistron_suspend(struct platform_device *dev, pm_message_t state) | 515 | static int wistron_suspend(struct platform_device *dev, pm_message_t state) |
451 | { | 516 | { |
452 | del_timer_sync(&poll_timer); | 517 | del_timer_sync(&poll_timer); |
@@ -472,13 +537,20 @@ static int wistron_resume(struct platform_device *dev) | |||
472 | 537 | ||
473 | return 0; | 538 | return 0; |
474 | } | 539 | } |
540 | #else | ||
541 | #define wistron_suspend NULL | ||
542 | #define wistron_resume NULL | ||
543 | #endif | ||
475 | 544 | ||
476 | static struct platform_driver wistron_driver = { | 545 | static struct platform_driver wistron_driver = { |
477 | .suspend = wistron_suspend, | ||
478 | .resume = wistron_resume, | ||
479 | .driver = { | 546 | .driver = { |
480 | .name = "wistron-bios", | 547 | .name = "wistron-bios", |
548 | .owner = THIS_MODULE, | ||
481 | }, | 549 | }, |
550 | .probe = wistron_probe, | ||
551 | .remove = __devexit_p(wistron_remove), | ||
552 | .suspend = wistron_suspend, | ||
553 | .resume = wistron_resume, | ||
482 | }; | 554 | }; |
483 | 555 | ||
484 | static int __init wb_module_init(void) | 556 | static int __init wb_module_init(void) |
@@ -493,55 +565,27 @@ static int __init wb_module_init(void) | |||
493 | if (err) | 565 | if (err) |
494 | return err; | 566 | return err; |
495 | 567 | ||
496 | bios_attach(); | ||
497 | cmos_address = bios_get_cmos_address(); | ||
498 | |||
499 | err = platform_driver_register(&wistron_driver); | 568 | err = platform_driver_register(&wistron_driver); |
500 | if (err) | 569 | if (err) |
501 | goto err_detach_bios; | 570 | goto err_unmap_bios; |
502 | 571 | ||
503 | wistron_device = platform_device_register_simple("wistron-bios", -1, NULL, 0); | 572 | wistron_device = platform_device_alloc("wistron-bios", -1); |
504 | if (IS_ERR(wistron_device)) { | 573 | if (!wistron_device) { |
505 | err = PTR_ERR(wistron_device); | 574 | err = -ENOMEM; |
506 | goto err_unregister_driver; | 575 | goto err_unregister_driver; |
507 | } | 576 | } |
508 | 577 | ||
509 | if (have_wifi) { | 578 | err = platform_device_add(wistron_device); |
510 | u16 wifi = bios_get_default_setting(WIFI); | ||
511 | if (wifi & 1) | ||
512 | wifi_enabled = (wifi & 2) ? 1 : 0; | ||
513 | else | ||
514 | have_wifi = 0; | ||
515 | |||
516 | if (have_wifi) | ||
517 | bios_set_state(WIFI, wifi_enabled); | ||
518 | } | ||
519 | |||
520 | if (have_bluetooth) { | ||
521 | u16 bt = bios_get_default_setting(BLUETOOTH); | ||
522 | if (bt & 1) | ||
523 | bluetooth_enabled = (bt & 2) ? 1 : 0; | ||
524 | else | ||
525 | have_bluetooth = 0; | ||
526 | |||
527 | if (have_bluetooth) | ||
528 | bios_set_state(BLUETOOTH, bluetooth_enabled); | ||
529 | } | ||
530 | |||
531 | err = setup_input_dev(); | ||
532 | if (err) | 579 | if (err) |
533 | goto err_unregister_device; | 580 | goto err_free_device; |
534 | |||
535 | poll_bios(1); /* Flush stale event queue and arm timer */ | ||
536 | 581 | ||
537 | return 0; | 582 | return 0; |
538 | 583 | ||
539 | err_unregister_device: | 584 | err_free_device: |
540 | platform_device_unregister(wistron_device); | 585 | platform_device_put(wistron_device); |
541 | err_unregister_driver: | 586 | err_unregister_driver: |
542 | platform_driver_unregister(&wistron_driver); | 587 | platform_driver_unregister(&wistron_driver); |
543 | err_detach_bios: | 588 | err_unmap_bios: |
544 | bios_detach(); | ||
545 | unmap_bios(); | 589 | unmap_bios(); |
546 | 590 | ||
547 | return err; | 591 | return err; |
@@ -549,11 +593,8 @@ static int __init wb_module_init(void) | |||
549 | 593 | ||
550 | static void __exit wb_module_exit(void) | 594 | static void __exit wb_module_exit(void) |
551 | { | 595 | { |
552 | del_timer_sync(&poll_timer); | ||
553 | input_unregister_device(input_dev); | ||
554 | platform_device_unregister(wistron_device); | 596 | platform_device_unregister(wistron_device); |
555 | platform_driver_unregister(&wistron_driver); | 597 | platform_driver_unregister(&wistron_driver); |
556 | bios_detach(); | ||
557 | unmap_bios(); | 598 | unmap_bios(); |
558 | } | 599 | } |
559 | 600 | ||