gpio: stmpe: Write int status register only when needed
authorPatrice Chotard <patrice.chotard@st.com>
Wed, 10 Aug 2016 07:39:09 +0000 (09:39 +0200)
committerLee Jones <lee.jones@linaro.org>
Wed, 10 Aug 2016 08:23:49 +0000 (09:23 +0100)
On STMPE801/1801 datasheets, it's mentionned writing
in interrupt status register has no effect, bits are
cleared when reading.

Signed-off-by: Amelie DELAUNAY <amelie.delaunay@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/gpio/gpio-stmpe.c

index fdac5d9e5b8de88fed5f3d7d57a22fef24f78bfa..5806af549ddfaa86071aaa1a2ef8a2b7e6d4a630 100644 (file)
@@ -371,12 +371,16 @@ static irqreturn_t stmpe_gpio_irq(int irq, void *dev)
                        stat &= ~(1 << bit);
                }
 
-               stmpe_reg_write(stmpe, statmsbreg + i, status[i]);
-
-               /* Edge detect register is not present on 801 and 1801 */
-               if (stmpe->partnum != STMPE801 || stmpe->partnum != STMPE1801)
+               /*
+                * interrupt status register write has no effect on
+                * 801 and 1801, bits are cleared when read.
+                * Edge detect register is not present on 801 and 1801
+                */
+               if (stmpe->partnum != STMPE801 || stmpe->partnum != STMPE1801) {
+                       stmpe_reg_write(stmpe, statmsbreg + i, status[i]);
                        stmpe_reg_write(stmpe, stmpe->regs[STMPE_IDX_GPEDR_MSB]
                                        + i, status[i]);
+               }
        }
 
        return IRQ_HANDLED;