diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-27 13:19:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-27 13:19:19 -0400 |
commit | a9a0aff5b56d4c40288c000ff09c3f238b6b6fec (patch) | |
tree | 496cce8240689a61b4c76a4318ac53487287c74b /drivers/input | |
parent | ade61088bc77dd209f8edadbe544f1e5dad6c287 (diff) | |
parent | 0779c862e43e052c58a350a8bd2bf97e6908de04 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k: (24 commits)
m68k: amiga - RTC platform device conversion
m68k: amiga - Parallel port platform device conversion
m68k: amiga - Serial port platform device conversion
m68k: amiga - Mouse platform device conversion
m68k: amiga - Keyboard platform device conversion
m68k: amiga - Amiga Gayle IDE platform device conversion
m68k: amiga - A4000T SCSI platform device conversion
m68k/scsi: a3000 - Do not use legacy Scsi_Host.base
m68k: amiga - A3000 SCSI platform device conversion
m68k/scsi: gvp11 - Do not use legacy Scsi_Host.base
m68k: amiga - GVP Series II SCSI zorro_driver conversion
m68k/scsi: a2091 - Do not use legacy Scsi_Host.base
m68k: amiga - A2091/A590 SCSI zorro_driver conversion
m68k/scsi: mvme147 - Kill obsolete HOSTS_C logic
m68k/scsi: a3000 - Kill a3000_scsiregs typedef
m68k/scsi: gvp11 - Kill gvp11_scsiregs typedef
m68k/scsi: a2091 - Kill a2091_scsiregs typedef
m68k/scsi: gvp11 - Extract check_wd33c93()
m68k/scsi: a3000 - Kill static global a3000_host
m68k/scsi: mvme147 - Kill static global mvme147_host
...
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/keyboard/amikbd.c | 97 | ||||
-rw-r--r-- | drivers/input/mouse/amimouse.c | 98 |
2 files changed, 121 insertions, 74 deletions
diff --git a/drivers/input/keyboard/amikbd.c b/drivers/input/keyboard/amikbd.c index 35149ec455a9..79172af164f2 100644 --- a/drivers/input/keyboard/amikbd.c +++ b/drivers/input/keyboard/amikbd.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
36 | #include <linux/interrupt.h> | 36 | #include <linux/interrupt.h> |
37 | #include <linux/keyboard.h> | 37 | #include <linux/keyboard.h> |
38 | #include <linux/platform_device.h> | ||
38 | 39 | ||
39 | #include <asm/amigaints.h> | 40 | #include <asm/amigaints.h> |
40 | #include <asm/amigahw.h> | 41 | #include <asm/amigahw.h> |
@@ -154,10 +155,9 @@ static const char *amikbd_messages[8] = { | |||
154 | [7] = KERN_WARNING "amikbd: keyboard interrupt\n" | 155 | [7] = KERN_WARNING "amikbd: keyboard interrupt\n" |
155 | }; | 156 | }; |
156 | 157 | ||
157 | static struct input_dev *amikbd_dev; | 158 | static irqreturn_t amikbd_interrupt(int irq, void *data) |
158 | |||
159 | static irqreturn_t amikbd_interrupt(int irq, void *dummy) | ||
160 | { | 159 | { |
160 | struct input_dev *dev = data; | ||
161 | unsigned char scancode, down; | 161 | unsigned char scancode, down; |
162 | 162 | ||
163 | scancode = ~ciaa.sdr; /* get and invert scancode (keyboard is active low) */ | 163 | scancode = ~ciaa.sdr; /* get and invert scancode (keyboard is active low) */ |
@@ -170,47 +170,42 @@ static irqreturn_t amikbd_interrupt(int irq, void *dummy) | |||
170 | 170 | ||
171 | if (scancode < 0x78) { /* scancodes < 0x78 are keys */ | 171 | if (scancode < 0x78) { /* scancodes < 0x78 are keys */ |
172 | if (scancode == 98) { /* CapsLock is a toggle switch key on Amiga */ | 172 | if (scancode == 98) { /* CapsLock is a toggle switch key on Amiga */ |
173 | input_report_key(amikbd_dev, scancode, 1); | 173 | input_report_key(dev, scancode, 1); |
174 | input_report_key(amikbd_dev, scancode, 0); | 174 | input_report_key(dev, scancode, 0); |
175 | } else { | 175 | } else { |
176 | input_report_key(amikbd_dev, scancode, down); | 176 | input_report_key(dev, scancode, down); |
177 | } | 177 | } |
178 | 178 | ||
179 | input_sync(amikbd_dev); | 179 | input_sync(dev); |
180 | } else /* scancodes >= 0x78 are error codes */ | 180 | } else /* scancodes >= 0x78 are error codes */ |
181 | printk(amikbd_messages[scancode - 0x78]); | 181 | printk(amikbd_messages[scancode - 0x78]); |
182 | 182 | ||
183 | return IRQ_HANDLED; | 183 | return IRQ_HANDLED; |
184 | } | 184 | } |
185 | 185 | ||
186 | static int __init amikbd_init(void) | 186 | static int __init amikbd_probe(struct platform_device *pdev) |
187 | { | 187 | { |
188 | struct input_dev *dev; | ||
188 | int i, j, err; | 189 | int i, j, err; |
189 | 190 | ||
190 | if (!AMIGAHW_PRESENT(AMI_KEYBOARD)) | 191 | dev = input_allocate_device(); |
191 | return -ENODEV; | 192 | if (!dev) { |
192 | 193 | dev_err(&pdev->dev, "Not enough memory for input device\n"); | |
193 | if (!request_mem_region(CIAA_PHYSADDR-1+0xb00, 0x100, "amikeyb")) | 194 | return -ENOMEM; |
194 | return -EBUSY; | ||
195 | |||
196 | amikbd_dev = input_allocate_device(); | ||
197 | if (!amikbd_dev) { | ||
198 | printk(KERN_ERR "amikbd: not enough memory for input device\n"); | ||
199 | err = -ENOMEM; | ||
200 | goto fail1; | ||
201 | } | 195 | } |
202 | 196 | ||
203 | amikbd_dev->name = "Amiga Keyboard"; | 197 | dev->name = pdev->name; |
204 | amikbd_dev->phys = "amikbd/input0"; | 198 | dev->phys = "amikbd/input0"; |
205 | amikbd_dev->id.bustype = BUS_AMIGA; | 199 | dev->id.bustype = BUS_AMIGA; |
206 | amikbd_dev->id.vendor = 0x0001; | 200 | dev->id.vendor = 0x0001; |
207 | amikbd_dev->id.product = 0x0001; | 201 | dev->id.product = 0x0001; |
208 | amikbd_dev->id.version = 0x0100; | 202 | dev->id.version = 0x0100; |
203 | dev->dev.parent = &pdev->dev; | ||
209 | 204 | ||
210 | amikbd_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); | 205 | dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); |
211 | 206 | ||
212 | for (i = 0; i < 0x78; i++) | 207 | for (i = 0; i < 0x78; i++) |
213 | set_bit(i, amikbd_dev->keybit); | 208 | set_bit(i, dev->keybit); |
214 | 209 | ||
215 | for (i = 0; i < MAX_NR_KEYMAPS; i++) { | 210 | for (i = 0; i < MAX_NR_KEYMAPS; i++) { |
216 | static u_short temp_map[NR_KEYS] __initdata; | 211 | static u_short temp_map[NR_KEYS] __initdata; |
@@ -229,30 +224,54 @@ static int __init amikbd_init(void) | |||
229 | memcpy(key_maps[i], temp_map, sizeof(temp_map)); | 224 | memcpy(key_maps[i], temp_map, sizeof(temp_map)); |
230 | } | 225 | } |
231 | ciaa.cra &= ~0x41; /* serial data in, turn off TA */ | 226 | ciaa.cra &= ~0x41; /* serial data in, turn off TA */ |
232 | if (request_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt, 0, "amikbd", | 227 | err = request_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt, 0, "amikbd", |
233 | amikbd_interrupt)) { | 228 | dev); |
234 | err = -EBUSY; | 229 | if (err) |
235 | goto fail2; | 230 | goto fail2; |
236 | } | ||
237 | 231 | ||
238 | err = input_register_device(amikbd_dev); | 232 | err = input_register_device(dev); |
239 | if (err) | 233 | if (err) |
240 | goto fail3; | 234 | goto fail3; |
241 | 235 | ||
236 | platform_set_drvdata(pdev, dev); | ||
237 | |||
242 | return 0; | 238 | return 0; |
243 | 239 | ||
244 | fail3: free_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt); | 240 | fail3: free_irq(IRQ_AMIGA_CIAA_SP, dev); |
245 | fail2: input_free_device(amikbd_dev); | 241 | fail2: input_free_device(dev); |
246 | fail1: release_mem_region(CIAA_PHYSADDR - 1 + 0xb00, 0x100); | ||
247 | return err; | 242 | return err; |
248 | } | 243 | } |
249 | 244 | ||
250 | static void __exit amikbd_exit(void) | 245 | static int __exit amikbd_remove(struct platform_device *pdev) |
246 | { | ||
247 | struct input_dev *dev = platform_get_drvdata(pdev); | ||
248 | |||
249 | platform_set_drvdata(pdev, NULL); | ||
250 | free_irq(IRQ_AMIGA_CIAA_SP, dev); | ||
251 | input_unregister_device(dev); | ||
252 | return 0; | ||
253 | } | ||
254 | |||
255 | static struct platform_driver amikbd_driver = { | ||
256 | .remove = __exit_p(amikbd_remove), | ||
257 | .driver = { | ||
258 | .name = "amiga-keyboard", | ||
259 | .owner = THIS_MODULE, | ||
260 | }, | ||
261 | }; | ||
262 | |||
263 | static int __init amikbd_init(void) | ||
251 | { | 264 | { |
252 | free_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt); | 265 | return platform_driver_probe(&amikbd_driver, amikbd_probe); |
253 | input_unregister_device(amikbd_dev); | ||
254 | release_mem_region(CIAA_PHYSADDR - 1 + 0xb00, 0x100); | ||
255 | } | 266 | } |
256 | 267 | ||
257 | module_init(amikbd_init); | 268 | module_init(amikbd_init); |
269 | |||
270 | static void __exit amikbd_exit(void) | ||
271 | { | ||
272 | platform_driver_unregister(&amikbd_driver); | ||
273 | } | ||
274 | |||
258 | module_exit(amikbd_exit); | 275 | module_exit(amikbd_exit); |
276 | |||
277 | MODULE_ALIAS("platform:amiga-keyboard"); | ||
diff --git a/drivers/input/mouse/amimouse.c b/drivers/input/mouse/amimouse.c index a185ac78a42c..ff5f61a0fd3a 100644 --- a/drivers/input/mouse/amimouse.c +++ b/drivers/input/mouse/amimouse.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/input.h> | 22 | #include <linux/input.h> |
23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
24 | #include <linux/platform_device.h> | ||
24 | 25 | ||
25 | #include <asm/irq.h> | 26 | #include <asm/irq.h> |
26 | #include <asm/setup.h> | 27 | #include <asm/setup.h> |
@@ -34,10 +35,10 @@ MODULE_DESCRIPTION("Amiga mouse driver"); | |||
34 | MODULE_LICENSE("GPL"); | 35 | MODULE_LICENSE("GPL"); |
35 | 36 | ||
36 | static int amimouse_lastx, amimouse_lasty; | 37 | static int amimouse_lastx, amimouse_lasty; |
37 | static struct input_dev *amimouse_dev; | ||
38 | 38 | ||
39 | static irqreturn_t amimouse_interrupt(int irq, void *dummy) | 39 | static irqreturn_t amimouse_interrupt(int irq, void *data) |
40 | { | 40 | { |
41 | struct input_dev *dev = data; | ||
41 | unsigned short joy0dat, potgor; | 42 | unsigned short joy0dat, potgor; |
42 | int nx, ny, dx, dy; | 43 | int nx, ny, dx, dy; |
43 | 44 | ||
@@ -59,14 +60,14 @@ static irqreturn_t amimouse_interrupt(int irq, void *dummy) | |||
59 | 60 | ||
60 | potgor = amiga_custom.potgor; | 61 | potgor = amiga_custom.potgor; |
61 | 62 | ||
62 | input_report_rel(amimouse_dev, REL_X, dx); | 63 | input_report_rel(dev, REL_X, dx); |
63 | input_report_rel(amimouse_dev, REL_Y, dy); | 64 | input_report_rel(dev, REL_Y, dy); |
64 | 65 | ||
65 | input_report_key(amimouse_dev, BTN_LEFT, ciaa.pra & 0x40); | 66 | input_report_key(dev, BTN_LEFT, ciaa.pra & 0x40); |
66 | input_report_key(amimouse_dev, BTN_MIDDLE, potgor & 0x0100); | 67 | input_report_key(dev, BTN_MIDDLE, potgor & 0x0100); |
67 | input_report_key(amimouse_dev, BTN_RIGHT, potgor & 0x0400); | 68 | input_report_key(dev, BTN_RIGHT, potgor & 0x0400); |
68 | 69 | ||
69 | input_sync(amimouse_dev); | 70 | input_sync(dev); |
70 | 71 | ||
71 | return IRQ_HANDLED; | 72 | return IRQ_HANDLED; |
72 | } | 73 | } |
@@ -74,63 +75,90 @@ static irqreturn_t amimouse_interrupt(int irq, void *dummy) | |||
74 | static int amimouse_open(struct input_dev *dev) | 75 | static int amimouse_open(struct input_dev *dev) |
75 | { | 76 | { |
76 | unsigned short joy0dat; | 77 | unsigned short joy0dat; |
78 | int error; | ||
77 | 79 | ||
78 | joy0dat = amiga_custom.joy0dat; | 80 | joy0dat = amiga_custom.joy0dat; |
79 | 81 | ||
80 | amimouse_lastx = joy0dat & 0xff; | 82 | amimouse_lastx = joy0dat & 0xff; |
81 | amimouse_lasty = joy0dat >> 8; | 83 | amimouse_lasty = joy0dat >> 8; |
82 | 84 | ||
83 | if (request_irq(IRQ_AMIGA_VERTB, amimouse_interrupt, 0, "amimouse", amimouse_interrupt)) { | 85 | error = request_irq(IRQ_AMIGA_VERTB, amimouse_interrupt, 0, "amimouse", |
84 | printk(KERN_ERR "amimouse.c: Can't allocate irq %d\n", IRQ_AMIGA_VERTB); | 86 | dev); |
85 | return -EBUSY; | 87 | if (error) |
86 | } | 88 | dev_err(&dev->dev, "Can't allocate irq %d\n", IRQ_AMIGA_VERTB); |
87 | 89 | ||
88 | return 0; | 90 | return error; |
89 | } | 91 | } |
90 | 92 | ||
91 | static void amimouse_close(struct input_dev *dev) | 93 | static void amimouse_close(struct input_dev *dev) |
92 | { | 94 | { |
93 | free_irq(IRQ_AMIGA_VERTB, amimouse_interrupt); | 95 | free_irq(IRQ_AMIGA_VERTB, dev); |
94 | } | 96 | } |
95 | 97 | ||
96 | static int __init amimouse_init(void) | 98 | static int __init amimouse_probe(struct platform_device *pdev) |
97 | { | 99 | { |
98 | int err; | 100 | int err; |
101 | struct input_dev *dev; | ||
99 | 102 | ||
100 | if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_MOUSE)) | 103 | dev = input_allocate_device(); |
101 | return -ENODEV; | 104 | if (!dev) |
102 | |||
103 | amimouse_dev = input_allocate_device(); | ||
104 | if (!amimouse_dev) | ||
105 | return -ENOMEM; | 105 | return -ENOMEM; |
106 | 106 | ||
107 | amimouse_dev->name = "Amiga mouse"; | 107 | dev->name = pdev->name; |
108 | amimouse_dev->phys = "amimouse/input0"; | 108 | dev->phys = "amimouse/input0"; |
109 | amimouse_dev->id.bustype = BUS_AMIGA; | 109 | dev->id.bustype = BUS_AMIGA; |
110 | amimouse_dev->id.vendor = 0x0001; | 110 | dev->id.vendor = 0x0001; |
111 | amimouse_dev->id.product = 0x0002; | 111 | dev->id.product = 0x0002; |
112 | amimouse_dev->id.version = 0x0100; | 112 | dev->id.version = 0x0100; |
113 | 113 | ||
114 | amimouse_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); | 114 | dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); |
115 | amimouse_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); | 115 | dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); |
116 | amimouse_dev->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) | | 116 | dev->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) | |
117 | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); | 117 | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); |
118 | amimouse_dev->open = amimouse_open; | 118 | dev->open = amimouse_open; |
119 | amimouse_dev->close = amimouse_close; | 119 | dev->close = amimouse_close; |
120 | dev->dev.parent = &pdev->dev; | ||
120 | 121 | ||
121 | err = input_register_device(amimouse_dev); | 122 | err = input_register_device(dev); |
122 | if (err) { | 123 | if (err) { |
123 | input_free_device(amimouse_dev); | 124 | input_free_device(dev); |
124 | return err; | 125 | return err; |
125 | } | 126 | } |
126 | 127 | ||
128 | platform_set_drvdata(pdev, dev); | ||
129 | |||
127 | return 0; | 130 | return 0; |
128 | } | 131 | } |
129 | 132 | ||
130 | static void __exit amimouse_exit(void) | 133 | static int __exit amimouse_remove(struct platform_device *pdev) |
131 | { | 134 | { |
132 | input_unregister_device(amimouse_dev); | 135 | struct input_dev *dev = platform_get_drvdata(pdev); |
136 | |||
137 | platform_set_drvdata(pdev, NULL); | ||
138 | input_unregister_device(dev); | ||
139 | return 0; | ||
140 | } | ||
141 | |||
142 | static struct platform_driver amimouse_driver = { | ||
143 | .remove = __exit_p(amimouse_remove), | ||
144 | .driver = { | ||
145 | .name = "amiga-mouse", | ||
146 | .owner = THIS_MODULE, | ||
147 | }, | ||
148 | }; | ||
149 | |||
150 | static int __init amimouse_init(void) | ||
151 | { | ||
152 | return platform_driver_probe(&amimouse_driver, amimouse_probe); | ||
133 | } | 153 | } |
134 | 154 | ||
135 | module_init(amimouse_init); | 155 | module_init(amimouse_init); |
156 | |||
157 | static void __exit amimouse_exit(void) | ||
158 | { | ||
159 | platform_driver_unregister(&amimouse_driver); | ||
160 | } | ||
161 | |||
136 | module_exit(amimouse_exit); | 162 | module_exit(amimouse_exit); |
163 | |||
164 | MODULE_ALIAS("platform:amiga-mouse"); | ||