mfd: Initialise WM831x IRQ masks on chip even if interrupts not in use
Mark Brown [Mon, 5 Apr 2010 15:14:17 +0000 (16:14 +0100)]
Ensure that the hardware has interrupts masked if we are not using
the interrupt controller on the WM831x by initialising the masks
before we check for the setup data required for the IRQ line. This
avoids signalling an unused IRQ line and improves the robustness
of checks that the IRQ is in use.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>

drivers/mfd/wm831x-irq.c

index ec10004..7dabe4d 100644 (file)
@@ -490,6 +490,14 @@ int wm831x_irq_init(struct wm831x *wm831x, int irq)
 
        mutex_init(&wm831x->irq_lock);
 
+       /* Mask the individual interrupt sources */
+       for (i = 0; i < ARRAY_SIZE(wm831x->irq_masks_cur); i++) {
+               wm831x->irq_masks_cur[i] = 0xffff;
+               wm831x->irq_masks_cache[i] = 0xffff;
+               wm831x_reg_write(wm831x, WM831X_INTERRUPT_STATUS_1_MASK + i,
+                                0xffff);
+       }
+
        if (!irq) {
                dev_warn(wm831x->dev,
                         "No interrupt specified - functionality limited\n");
@@ -505,14 +513,6 @@ int wm831x_irq_init(struct wm831x *wm831x, int irq)
        wm831x->irq = irq;
        wm831x->irq_base = pdata->irq_base;
 
-       /* Mask the individual interrupt sources */
-       for (i = 0; i < ARRAY_SIZE(wm831x->irq_masks_cur); i++) {
-               wm831x->irq_masks_cur[i] = 0xffff;
-               wm831x->irq_masks_cache[i] = 0xffff;
-               wm831x_reg_write(wm831x, WM831X_INTERRUPT_STATUS_1_MASK + i,
-                                0xffff);
-       }
-
        /* Register them with genirq */
        for (cur_irq = wm831x->irq_base;
             cur_irq < ARRAY_SIZE(wm831x_irqs) + wm831x->irq_base;