aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2014-10-02 01:55:27 -0400
committerLinus Walleij <linus.walleij@linaro.org>2014-10-02 03:19:22 -0400
commit1fe3bd9e347bcea63fa8be212001372720968765 (patch)
treef028fb2da2e31b2caf39417a9fc2b2f23612b5f0
parentafdadc06df68861ee7b9ed1699a44516532f545e (diff)
gpio: stmpe: fix up interrupt enable logic
The STMPE driver assumes that the passed in IRQ type is for rising or falling IRQs, not both, even though the hardware actually supports this perfectly well. Likewise the check for level IRQs is done against just high or low level types, not for the case where it is combined with other IRQs. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/gpio/gpio-stmpe.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c
index b0b342787c37..866baa879473 100644
--- a/drivers/gpio/gpio-stmpe.c
+++ b/drivers/gpio/gpio-stmpe.c
@@ -127,19 +127,19 @@ static int stmpe_gpio_irq_set_type(struct irq_data *d, unsigned int type)
127 int regoffset = offset / 8; 127 int regoffset = offset / 8;
128 int mask = 1 << (offset % 8); 128 int mask = 1 << (offset % 8);
129 129
130 if (type == IRQ_TYPE_LEVEL_LOW || type == IRQ_TYPE_LEVEL_HIGH) 130 if (type & IRQ_TYPE_LEVEL_LOW || type & IRQ_TYPE_LEVEL_HIGH)
131 return -EINVAL; 131 return -EINVAL;
132 132
133 /* STMPE801 doesn't have RE and FE registers */ 133 /* STMPE801 doesn't have RE and FE registers */
134 if (stmpe_gpio->stmpe->partnum == STMPE801) 134 if (stmpe_gpio->stmpe->partnum == STMPE801)
135 return 0; 135 return 0;
136 136
137 if (type == IRQ_TYPE_EDGE_RISING) 137 if (type & IRQ_TYPE_EDGE_RISING)
138 stmpe_gpio->regs[REG_RE][regoffset] |= mask; 138 stmpe_gpio->regs[REG_RE][regoffset] |= mask;
139 else 139 else
140 stmpe_gpio->regs[REG_RE][regoffset] &= ~mask; 140 stmpe_gpio->regs[REG_RE][regoffset] &= ~mask;
141 141
142 if (type == IRQ_TYPE_EDGE_FALLING) 142 if (type & IRQ_TYPE_EDGE_FALLING)
143 stmpe_gpio->regs[REG_FE][regoffset] |= mask; 143 stmpe_gpio->regs[REG_FE][regoffset] |= mask;
144 else 144 else
145 stmpe_gpio->regs[REG_FE][regoffset] &= ~mask; 145 stmpe_gpio->regs[REG_FE][regoffset] &= ~mask;