aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/wm8350-irq.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-06-02 14:18:54 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2011-07-31 17:28:20 -0400
commitd1738aef387ab9591a6d13b00945e248b942c53f (patch)
tree3841b65f9c2808874f7954ce1e2c4035904bc4fd /drivers/mfd/wm8350-irq.c
parente69b6de181167a132eee7c38c7e4b47dea3d8e49 (diff)
mfd: Allocate wm835x irq descs dynamically
This allows boards to leave the irq_base field unitialized and prevents them having to reserve irqs in the platform. pdata can be optional for irq support now. Without pdata the driver allocates some free irq range. With pdata and irq_base > 0 the driver allocates exactly the specified irq. Without pdata the irq defaults to IRQF_TRIGGER_LOW. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/wm8350-irq.c')
-rw-r--r--drivers/mfd/wm8350-irq.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/mfd/wm8350-irq.c b/drivers/mfd/wm8350-irq.c
index ed4b22a167b3..8a1fafd0bf7d 100644
--- a/drivers/mfd/wm8350-irq.c
+++ b/drivers/mfd/wm8350-irq.c
@@ -473,17 +473,13 @@ int wm8350_irq_init(struct wm8350 *wm8350, int irq,
473{ 473{
474 int ret, cur_irq, i; 474 int ret, cur_irq, i;
475 int flags = IRQF_ONESHOT; 475 int flags = IRQF_ONESHOT;
476 int irq_base = -1;
476 477
477 if (!irq) { 478 if (!irq) {
478 dev_warn(wm8350->dev, "No interrupt support, no core IRQ\n"); 479 dev_warn(wm8350->dev, "No interrupt support, no core IRQ\n");
479 return 0; 480 return 0;
480 } 481 }
481 482
482 if (!pdata || !pdata->irq_base) {
483 dev_warn(wm8350->dev, "No interrupt support, no IRQ base\n");
484 return 0;
485 }
486
487 /* Mask top level interrupts */ 483 /* Mask top level interrupts */
488 wm8350_reg_write(wm8350, WM8350_SYSTEM_INTERRUPTS_MASK, 0xFFFF); 484 wm8350_reg_write(wm8350, WM8350_SYSTEM_INTERRUPTS_MASK, 0xFFFF);
489 485
@@ -502,7 +498,17 @@ int wm8350_irq_init(struct wm8350 *wm8350, int irq,
502 wm8350->chip_irq = irq; 498 wm8350->chip_irq = irq;
503 wm8350->irq_base = pdata->irq_base; 499 wm8350->irq_base = pdata->irq_base;
504 500
505 if (pdata->irq_high) { 501 if (pdata && pdata->irq_base > 0)
502 irq_base = pdata->irq_base;
503
504 wm8350->irq_base = irq_alloc_descs(irq_base, 0, ARRAY_SIZE(wm8350_irqs), 0);
505 if (wm8350->irq_base < 0) {
506 dev_warn(wm8350->dev, "Allocating irqs failed with %d\n",
507 wm8350->irq_base);
508 return 0;
509 }
510
511 if (pdata && pdata->irq_high) {
506 flags |= IRQF_TRIGGER_HIGH; 512 flags |= IRQF_TRIGGER_HIGH;
507 513
508 wm8350_set_bits(wm8350, WM8350_SYSTEM_CONTROL_1, 514 wm8350_set_bits(wm8350, WM8350_SYSTEM_CONTROL_1,