diff options
author | Russell King <rmk+lkml@arm.linux.org.uk> | 2006-01-08 04:02:07 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-08 23:13:46 -0500 |
commit | 9ded96f24c3a5fcbef954e88c443385a1af37eb9 (patch) | |
tree | 49f43337e2b8d63a5a28402a15d99fe27d8d2a1c /drivers/input/keyboard | |
parent | 705b6c7b34f2621f95f606d0e683daa10cdb8eb9 (diff) |
[PATCH] IRQ type flags
Some ARM platforms have the ability to program the interrupt controller to
detect various interrupt edges and/or levels. For some platforms, this is
critical to setup correctly, particularly those which the setting is dependent
on the device.
Currently, ARM drivers do (eg) the following:
err = request_irq(irq, ...);
set_irq_type(irq, IRQT_RISING);
However, if the interrupt has previously been programmed to be level sensitive
(for whatever reason) then this will cause an interrupt storm.
Hence, if we combine set_irq_type() with request_irq(), we can then safely set
the type prior to unmasking the interrupt. The unfortunate problem is that in
order to support this, these flags need to be visible outside of the ARM
architecture - drivers such as smc91x need these flags and they're
cross-architecture.
Finally, the SA_TRIGGER_* flag passed to request_irq() should reflect the
property that the device would like. The IRQ controller code should do its
best to select the most appropriate supported mode.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/input/keyboard')
-rw-r--r-- | drivers/input/keyboard/corgikbd.c | 6 | ||||
-rw-r--r-- | drivers/input/keyboard/spitzkbd.c | 27 |
2 files changed, 16 insertions, 17 deletions
diff --git a/drivers/input/keyboard/corgikbd.c b/drivers/input/keyboard/corgikbd.c index 64672d491222..e301ee4ca264 100644 --- a/drivers/input/keyboard/corgikbd.c +++ b/drivers/input/keyboard/corgikbd.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/jiffies.h> | 19 | #include <linux/jiffies.h> |
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
22 | #include <asm/irq.h> | ||
23 | 22 | ||
24 | #include <asm/arch/corgi.h> | 23 | #include <asm/arch/corgi.h> |
25 | #include <asm/arch/hardware.h> | 24 | #include <asm/arch/hardware.h> |
@@ -343,10 +342,9 @@ static int __init corgikbd_probe(struct platform_device *pdev) | |||
343 | for (i = 0; i < CORGI_KEY_SENSE_NUM; i++) { | 342 | for (i = 0; i < CORGI_KEY_SENSE_NUM; i++) { |
344 | pxa_gpio_mode(CORGI_GPIO_KEY_SENSE(i) | GPIO_IN); | 343 | pxa_gpio_mode(CORGI_GPIO_KEY_SENSE(i) | GPIO_IN); |
345 | if (request_irq(CORGI_IRQ_GPIO_KEY_SENSE(i), corgikbd_interrupt, | 344 | if (request_irq(CORGI_IRQ_GPIO_KEY_SENSE(i), corgikbd_interrupt, |
346 | SA_INTERRUPT, "corgikbd", corgikbd)) | 345 | SA_INTERRUPT | SA_TRIGGER_RISING, |
346 | "corgikbd", corgikbd)) | ||
347 | printk(KERN_WARNING "corgikbd: Can't get IRQ: %d!\n", i); | 347 | printk(KERN_WARNING "corgikbd: Can't get IRQ: %d!\n", i); |
348 | else | ||
349 | set_irq_type(CORGI_IRQ_GPIO_KEY_SENSE(i),IRQT_RISING); | ||
350 | } | 348 | } |
351 | 349 | ||
352 | /* Set Strobe lines as outputs - set high */ | 350 | /* Set Strobe lines as outputs - set high */ |
diff --git a/drivers/input/keyboard/spitzkbd.c b/drivers/input/keyboard/spitzkbd.c index 6a15fe3bc527..83999d583122 100644 --- a/drivers/input/keyboard/spitzkbd.c +++ b/drivers/input/keyboard/spitzkbd.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/jiffies.h> | 19 | #include <linux/jiffies.h> |
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
22 | #include <asm/irq.h> | ||
23 | 22 | ||
24 | #include <asm/arch/spitz.h> | 23 | #include <asm/arch/spitz.h> |
25 | #include <asm/arch/hardware.h> | 24 | #include <asm/arch/hardware.h> |
@@ -407,10 +406,9 @@ static int __init spitzkbd_probe(struct platform_device *dev) | |||
407 | for (i = 0; i < SPITZ_KEY_SENSE_NUM; i++) { | 406 | for (i = 0; i < SPITZ_KEY_SENSE_NUM; i++) { |
408 | pxa_gpio_mode(spitz_senses[i] | GPIO_IN); | 407 | pxa_gpio_mode(spitz_senses[i] | GPIO_IN); |
409 | if (request_irq(IRQ_GPIO(spitz_senses[i]), spitzkbd_interrupt, | 408 | if (request_irq(IRQ_GPIO(spitz_senses[i]), spitzkbd_interrupt, |
410 | SA_INTERRUPT, "Spitzkbd Sense", spitzkbd)) | 409 | SA_INTERRUPT|SA_TRIGGER_RISING, |
410 | "Spitzkbd Sense", spitzkbd)) | ||
411 | printk(KERN_WARNING "spitzkbd: Can't get Sense IRQ: %d!\n", i); | 411 | printk(KERN_WARNING "spitzkbd: Can't get Sense IRQ: %d!\n", i); |
412 | else | ||
413 | set_irq_type(IRQ_GPIO(spitz_senses[i]),IRQT_RISING); | ||
414 | } | 412 | } |
415 | 413 | ||
416 | /* Set Strobe lines as outputs - set high */ | 414 | /* Set Strobe lines as outputs - set high */ |
@@ -422,15 +420,18 @@ static int __init spitzkbd_probe(struct platform_device *dev) | |||
422 | pxa_gpio_mode(SPITZ_GPIO_SWA | GPIO_IN); | 420 | pxa_gpio_mode(SPITZ_GPIO_SWA | GPIO_IN); |
423 | pxa_gpio_mode(SPITZ_GPIO_SWB | GPIO_IN); | 421 | pxa_gpio_mode(SPITZ_GPIO_SWB | GPIO_IN); |
424 | 422 | ||
425 | request_irq(SPITZ_IRQ_GPIO_SYNC, spitzkbd_interrupt, SA_INTERRUPT, "Spitzkbd Sync", spitzkbd); | 423 | request_irq(SPITZ_IRQ_GPIO_SYNC, spitzkbd_interrupt, |
426 | request_irq(SPITZ_IRQ_GPIO_ON_KEY, spitzkbd_interrupt, SA_INTERRUPT, "Spitzkbd PwrOn", spitzkbd); | 424 | SA_INTERRUPT | SA_TRIGGER_RISING | SA_TRIGGER_FALLING, |
427 | request_irq(SPITZ_IRQ_GPIO_SWA, spitzkbd_hinge_isr, SA_INTERRUPT, "Spitzkbd SWA", spitzkbd); | 425 | "Spitzkbd Sync", spitzkbd); |
428 | request_irq(SPITZ_IRQ_GPIO_SWB, spitzkbd_hinge_isr, SA_INTERRUPT, "Spitzkbd SWB", spitzkbd); | 426 | request_irq(SPITZ_IRQ_GPIO_ON_KEY, spitzkbd_interrupt, |
429 | 427 | SA_INTERRUPT | SA_TRIGGER_RISING | SA_TRIGGER_FALLING, | |
430 | set_irq_type(SPITZ_IRQ_GPIO_SYNC, IRQT_BOTHEDGE); | 428 | "Spitzkbd PwrOn", spitzkbd); |
431 | set_irq_type(SPITZ_IRQ_GPIO_ON_KEY, IRQT_BOTHEDGE); | 429 | request_irq(SPITZ_IRQ_GPIO_SWA, spitzkbd_hinge_isr, |
432 | set_irq_type(SPITZ_IRQ_GPIO_SWA, IRQT_BOTHEDGE); | 430 | SA_INTERRUPT | SA_TRIGGER_RISING | SA_TRIGGER_FALLING, |
433 | set_irq_type(SPITZ_IRQ_GPIO_SWB, IRQT_BOTHEDGE); | 431 | "Spitzkbd SWA", spitzkbd); |
432 | request_irq(SPITZ_IRQ_GPIO_SWB, spitzkbd_hinge_isr, | ||
433 | SA_INTERRUPT | SA_TRIGGER_RISING | SA_TRIGGER_FALLING, | ||
434 | "Spitzkbd SWB", spitzkbd); | ||
434 | 435 | ||
435 | printk(KERN_INFO "input: Spitz Keyboard Registered\n"); | 436 | printk(KERN_INFO "input: Spitz Keyboard Registered\n"); |
436 | 437 | ||