]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
mfd: arizona: Check if AOD interrupts are pending before dispatching
authorRichard Fitzgerald <rf@opensource.wolfsonmicro.com>
Wed, 15 Jun 2016 09:28:44 +0000 (10:28 +0100)
committerLee Jones <lee.jones@linaro.org>
Wed, 29 Jun 2016 09:14:40 +0000 (10:14 +0100)
Previously the arizona_irq_thread implementation would call
handle_nested_irqs() to handle AOD interrupts without checking if any
were actually pending. The kernel will see these as spurious IRQs and
will eventually disable the IRQ.

This patch ensures we only launch the nested handler if there are AOD
interrupts pending in the codec.

Signed-off-by: Simon Trimmer <simont@opensource.wolfsonmicro.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/arizona-irq.c

index edeb4951366a0d1db3bf3a14c49c03a50d469ed1..5e18d3c77582b02050da45db97ee87fc1777bab9 100644 (file)
@@ -109,8 +109,20 @@ static irqreturn_t arizona_irq_thread(int irq, void *data)
        do {
                poll = false;
 
-               if (arizona->aod_irq_chip)
-                       handle_nested_irq(irq_find_mapping(arizona->virq, 0));
+               if (arizona->aod_irq_chip) {
+                       /*
+                        * Check the AOD status register to determine whether
+                        * the nested IRQ handler should be called.
+                        */
+                       ret = regmap_read(arizona->regmap,
+                                         ARIZONA_AOD_IRQ1, &val);
+                       if (ret)
+                               dev_warn(arizona->dev,
+                                       "Failed to read AOD IRQ1 %d\n", ret);
+                       else if (val)
+                               handle_nested_irq(
+                                       irq_find_mapping(arizona->virq, 0));
+               }
 
                /*
                 * Check if one of the main interrupts is asserted and only