]> git.baikalelectronics.ru Git - kernel.git/commit
gpio: stmpe: fix interrupt handling bug
authorLinus Walleij <linus.walleij@linaro.org>
Wed, 23 Nov 2016 22:21:17 +0000 (23:21 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 24 Nov 2016 15:19:01 +0000 (16:19 +0100)
commita53373b3b86718840b16f1ed94d2ab40142080c6
treefc782de26da3c3cd8ef8e0f0e02c83d171325a0b
parent78161a62eb4fa80ae00165b5c4bfa1afe96f79f1
gpio: stmpe: fix interrupt handling bug

commit 01b1a98a6e5e ("gpio: stmpe: Rework registers access")
reworked the STMPE register access so as to use
[STMPE_IDX_*_LSB + i] to access the 8bit register for a
certain bank, assuming the CSB and MSB will follow after
the enumerator. For this to work the index needs to go from
(size-1) to 0 not 0 to (size-1).

However for the GPIO IRQ handler, the status registers we read
register MSB + 3 bytes ahead for the 24 bit GPIOs and index
registers from MSB upwards and run an index i over the
registers UNLESS we are STMPE1600.

This is not working when we get to clearing the interrupt
EDGE status register STMPE_IDX_GPEDR_[LCM]SB: it is indexed
like all other registers [STMPE_IDX_*_LSB + i] but in this
loop we index from 0 to get the right bank index for the
calculations, and we need to just add i to the MSB.

Before this, interrupts on the STMPE2401 were broken, this
patch fixes it so it works again.

Cc: stable@vger.kernel.org
Cc: Patrice Chotard <patrice.chotard@st.com>
Fixes: 01b1a98a6e5e ("gpio: stmpe: Rework registers access")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-stmpe.c