The PL061 can handle level IRQs and edge IRQs, however it is
just utilizing handle_simple_irq() for all IRQs. Inspired by
Stefan Agners patch to vf610, this assigns the right handler
depending on what type is set up, after this handle_simple_irq()
is only used as default and if the type is not specified.

Cc: Jonas Gorski <[email protected]>
Cc: Stefan Agner <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
---
 drivers/gpio/gpio-pl061.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c
index 5b1461f6aeed..7dba5545b084 100644
--- a/drivers/gpio/gpio-pl061.c
+++ b/drivers/gpio/gpio-pl061.c
@@ -180,7 +180,7 @@ static int pl061_irq_type(struct irq_data *d, unsigned 
trigger)
                        gpioiev |= bit;
                else
                        gpioiev &= ~bit;
-
+               irq_set_handler_locked(d, handle_level_irq);
                dev_dbg(gc->dev, "line %d: IRQ on %s level\n",
                        offset,
                        polarity ? "HIGH" : "LOW");
@@ -189,7 +189,7 @@ static int pl061_irq_type(struct irq_data *d, unsigned 
trigger)
                gpiois &= ~bit;
                /* Select both edges, setting this makes GPIOEV be ignored */
                gpioibe |= bit;
-
+               irq_set_handler_locked(d, handle_edge_irq);
                dev_dbg(gc->dev, "line %d: IRQ on both edges\n", offset);
        } else if ((trigger & IRQ_TYPE_EDGE_RISING) ||
                   (trigger & IRQ_TYPE_EDGE_FALLING)) {
@@ -204,7 +204,7 @@ static int pl061_irq_type(struct irq_data *d, unsigned 
trigger)
                        gpioiev |= bit;
                else
                        gpioiev &= ~bit;
-
+               irq_set_handler_locked(d, handle_edge_irq);
                dev_dbg(gc->dev, "line %d: IRQ on %s edge\n",
                        offset,
                        rising ? "RISING" : "FALLING");
@@ -213,6 +213,7 @@ static int pl061_irq_type(struct irq_data *d, unsigned 
trigger)
                gpiois &= ~bit;
                gpioibe &= ~bit;
                gpioiev &= ~bit;
+               irq_set_handler_locked(d, handle_simple_irq);
                dev_warn(gc->dev, "no trigger selected for line %d\n",
                         offset);
        }
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to