]> git.karo-electronics.de Git - linux-beck.git/commitdiff
regmap: irq: initialize all irqs to wake disabled
authorStephen Warren <swarren@nvidia.com>
Wed, 1 Aug 2012 19:57:24 +0000 (13:57 -0600)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Sat, 4 Aug 2012 11:13:54 +0000 (12:13 +0100)
The kerneldoc for irq_set_irq_wake() says:

    Enable/disable power management wakeup mode, which is
    disabled by default.

regmap_irq_set_wake() clears bits to enable wake for an interrupt,
and sets bits to disable wake. Hence, we should set all bits in
wake_buf initially, to mirror the expected disabled state.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/base/regmap/regmap-irq.c

index 9a6649c82daa3359654ad217078e469578d104a8..6f8f0c1e550f241eb6638abe69a738a52c854a4a 100644 (file)
@@ -322,6 +322,22 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
                }
        }
 
+       /* Wake is disabled by default */
+       if (d->wake_buf) {
+               for (i = 0; i < chip->num_regs; i++) {
+                       d->wake_buf[i] = d->mask_buf_def[i];
+                       reg = chip->wake_base +
+                               (i * map->reg_stride * d->irq_reg_stride);
+                       ret = regmap_update_bits(map, reg, d->wake_buf[i],
+                                                d->wake_buf[i]);
+                       if (ret != 0) {
+                               dev_err(map->dev, "Failed to set masks in 0x%x: %d\n",
+                                       reg, ret);
+                               goto err_alloc;
+                       }
+               }
+       }
+
        if (irq_base)
                d->domain = irq_domain_add_legacy(map->dev->of_node,
                                                  chip->num_irqs, irq_base, 0,