diff options
Diffstat (limited to 'drivers/input/keyboard/amikbd.c')
-rw-r--r-- | drivers/input/keyboard/amikbd.c | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/drivers/input/keyboard/amikbd.c b/drivers/input/keyboard/amikbd.c index 4e8e8ea214ab..4c8fb1f8631f 100644 --- a/drivers/input/keyboard/amikbd.c +++ b/drivers/input/keyboard/amikbd.c | |||
@@ -155,10 +155,7 @@ static const char *amikbd_messages[8] = { | |||
155 | [7] = KERN_WARNING "amikbd: keyboard interrupt\n" | 155 | [7] = KERN_WARNING "amikbd: keyboard interrupt\n" |
156 | }; | 156 | }; |
157 | 157 | ||
158 | static struct input_dev amikbd_dev; | 158 | static struct input_dev *amikbd_dev; |
159 | |||
160 | static char *amikbd_name = "Amiga keyboard"; | ||
161 | static char *amikbd_phys = "amikbd/input0"; | ||
162 | 159 | ||
163 | static irqreturn_t amikbd_interrupt(int irq, void *dummy, struct pt_regs *fp) | 160 | static irqreturn_t amikbd_interrupt(int irq, void *dummy, struct pt_regs *fp) |
164 | { | 161 | { |
@@ -176,16 +173,16 @@ static irqreturn_t amikbd_interrupt(int irq, void *dummy, struct pt_regs *fp) | |||
176 | 173 | ||
177 | scancode = amikbd_keycode[scancode]; | 174 | scancode = amikbd_keycode[scancode]; |
178 | 175 | ||
179 | input_regs(&amikbd_dev, fp); | 176 | input_regs(amikbd_dev, fp); |
180 | 177 | ||
181 | if (scancode == KEY_CAPSLOCK) { /* CapsLock is a toggle switch key on Amiga */ | 178 | if (scancode == KEY_CAPSLOCK) { /* CapsLock is a toggle switch key on Amiga */ |
182 | input_report_key(&amikbd_dev, scancode, 1); | 179 | input_report_key(amikbd_dev, scancode, 1); |
183 | input_report_key(&amikbd_dev, scancode, 0); | 180 | input_report_key(amikbd_dev, scancode, 0); |
184 | input_sync(&amikbd_dev); | ||
185 | } else { | 181 | } else { |
186 | input_report_key(&amikbd_dev, scancode, down); | 182 | input_report_key(amikbd_dev, scancode, down); |
187 | input_sync(&amikbd_dev); | ||
188 | } | 183 | } |
184 | |||
185 | input_sync(amikbd_dev); | ||
189 | } else /* scancodes >= 0x78 are error codes */ | 186 | } else /* scancodes >= 0x78 are error codes */ |
190 | printk(amikbd_messages[scancode - 0x78]); | 187 | printk(amikbd_messages[scancode - 0x78]); |
191 | 188 | ||
@@ -202,39 +199,41 @@ static int __init amikbd_init(void) | |||
202 | if (!request_mem_region(CIAA_PHYSADDR-1+0xb00, 0x100, "amikeyb")) | 199 | if (!request_mem_region(CIAA_PHYSADDR-1+0xb00, 0x100, "amikeyb")) |
203 | return -EBUSY; | 200 | return -EBUSY; |
204 | 201 | ||
205 | init_input_dev(&amikbd_dev); | 202 | amikbd_dev = input_allocate_device(); |
206 | 203 | if (!amikbd_dev) { | |
207 | amikbd_dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP); | 204 | printk(KERN_ERR "amikbd: not enough memory for input device\n"); |
208 | amikbd_dev.keycode = amikbd_keycode; | 205 | release_mem_region(CIAA_PHYSADDR - 1 + 0xb00, 0x100); |
209 | amikbd_dev.keycodesize = sizeof(unsigned char); | 206 | return -ENOMEM; |
210 | amikbd_dev.keycodemax = ARRAY_SIZE(amikbd_keycode); | 207 | } |
208 | |||
209 | amikbd_dev->name = "Amiga Keyboard"; | ||
210 | amikbd_dev->phys = "amikbd/input0"; | ||
211 | amikbd_dev->id.bustype = BUS_AMIGA; | ||
212 | amikbd_dev->id.vendor = 0x0001; | ||
213 | amikbd_dev->id.product = 0x0001; | ||
214 | amikbd_dev->id.version = 0x0100; | ||
215 | |||
216 | amikbd_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); | ||
217 | amikbd_dev->keycode = amikbd_keycode; | ||
218 | amikbd_dev->keycodesize = sizeof(unsigned char); | ||
219 | amikbd_dev->keycodemax = ARRAY_SIZE(amikbd_keycode); | ||
211 | 220 | ||
212 | for (i = 0; i < 0x78; i++) | 221 | for (i = 0; i < 0x78; i++) |
213 | if (amikbd_keycode[i]) | 222 | if (amikbd_keycode[i]) |
214 | set_bit(amikbd_keycode[i], amikbd_dev.keybit); | 223 | set_bit(amikbd_keycode[i], amikbd_dev->keybit); |
215 | 224 | ||
216 | ciaa.cra &= ~0x41; /* serial data in, turn off TA */ | 225 | ciaa.cra &= ~0x41; /* serial data in, turn off TA */ |
217 | request_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt, 0, "amikbd", amikbd_interrupt); | 226 | request_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt, 0, "amikbd", amikbd_interrupt); |
218 | 227 | ||
219 | amikbd_dev.name = amikbd_name; | 228 | input_register_device(amikbd_dev); |
220 | amikbd_dev.phys = amikbd_phys; | ||
221 | amikbd_dev.id.bustype = BUS_AMIGA; | ||
222 | amikbd_dev.id.vendor = 0x0001; | ||
223 | amikbd_dev.id.product = 0x0001; | ||
224 | amikbd_dev.id.version = 0x0100; | ||
225 | |||
226 | input_register_device(&amikbd_dev); | ||
227 | |||
228 | printk(KERN_INFO "input: %s\n", amikbd_name); | ||
229 | |||
230 | return 0; | 229 | return 0; |
231 | } | 230 | } |
232 | 231 | ||
233 | static void __exit amikbd_exit(void) | 232 | static void __exit amikbd_exit(void) |
234 | { | 233 | { |
235 | input_unregister_device(&amikbd_dev); | ||
236 | free_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt); | 234 | free_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt); |
237 | release_mem_region(CIAA_PHYSADDR-1+0xb00, 0x100); | 235 | input_unregister_device(amikbd_dev); |
236 | release_mem_region(CIAA_PHYSADDR - 1 + 0xb00, 0x100); | ||
238 | } | 237 | } |
239 | 238 | ||
240 | module_init(amikbd_init); | 239 | module_init(amikbd_init); |