Prechádzať zdrojové kódy

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>
Linus Walleij 11 rokov pred
rodič
commit
1fe3bd9e34
1 zmenil súbory, kde vykonal 3 pridanie a 3 odobranie
  1. 3 3
      drivers/gpio/gpio-stmpe.c

+ 3 - 3
drivers/gpio/gpio-stmpe.c

@@ -127,19 +127,19 @@ static int stmpe_gpio_irq_set_type(struct irq_data *d, unsigned int type)
 	int regoffset = offset / 8;
 	int regoffset = offset / 8;
 	int mask = 1 << (offset % 8);
 	int mask = 1 << (offset % 8);
 
 
-	if (type == IRQ_TYPE_LEVEL_LOW || type == IRQ_TYPE_LEVEL_HIGH)
+	if (type & IRQ_TYPE_LEVEL_LOW || type & IRQ_TYPE_LEVEL_HIGH)
 		return -EINVAL;
 		return -EINVAL;
 
 
 	/* STMPE801 doesn't have RE and FE registers */
 	/* STMPE801 doesn't have RE and FE registers */
 	if (stmpe_gpio->stmpe->partnum == STMPE801)
 	if (stmpe_gpio->stmpe->partnum == STMPE801)
 		return 0;
 		return 0;
 
 
-	if (type == IRQ_TYPE_EDGE_RISING)
+	if (type & IRQ_TYPE_EDGE_RISING)
 		stmpe_gpio->regs[REG_RE][regoffset] |= mask;
 		stmpe_gpio->regs[REG_RE][regoffset] |= mask;
 	else
 	else
 		stmpe_gpio->regs[REG_RE][regoffset] &= ~mask;
 		stmpe_gpio->regs[REG_RE][regoffset] &= ~mask;
 
 
-	if (type == IRQ_TYPE_EDGE_FALLING)
+	if (type & IRQ_TYPE_EDGE_FALLING)
 		stmpe_gpio->regs[REG_FE][regoffset] |= mask;
 		stmpe_gpio->regs[REG_FE][regoffset] |= mask;
 	else
 	else
 		stmpe_gpio->regs[REG_FE][regoffset] &= ~mask;
 		stmpe_gpio->regs[REG_FE][regoffset] &= ~mask;