]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
pinctrl/amd: fix masking of GPIO interrupts
authorDaniel Drake <drake@endlessm.com>
Wed, 29 Nov 2017 09:23:00 +0000 (10:23 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 14 Mar 2018 10:42:05 +0000 (11:42 +0100)
commit06c34421edfa9bfea9103c53d6edd3db10aa11ac
treee5226a5ace07bba6454e97c642fc80e409d9efac
parent5bc03d37b494ab5c3d940f47b11fdc0f79736319
pinctrl/amd: fix masking of GPIO interrupts

BugLink: https://bugs.launchpad.net/bugs/1732056
On Asus laptop models X505BA, X505BP, X542BA and X542BP, the i2c-hid
touchpad (using a GPIO for interrupts) becomes unresponsive after a
few minutes of usage, or after placing two fingers on the touchpad,
which seems to have the effect of queuing up a large amount of input
data to be transferred.

When the touchpad is in unresponsive state, we observed that the GPIO
level-triggered interrupt is still at it's active level, however the
pinctrl-amd driver is not receiving/dispatching more interrupts at this
point.

After the initial interrupt arrives, amd_gpio_irq_mask() is called
however we then see amd_gpio_irq_handler() being called repeatedly for
the same irq; the interrupt mask is not taking effect because of the
following sequence of events:
 - amd_gpio_irq_handler fires, reads and caches pin reg
 - amd_gpio_irq_handler calls generic_handle_irq()
 - During IRQ handling, amd_gpio_irq_mask() is called and modifies pin reg
 - amd_gpio_irq_handler clears interrupt by writing cached value

The stale cached value written at the final stage undoes the masking.
Fix this by re-reading the register before clearing the interrupt.

I also spotted that the interrupt-clearing code can race against
amd_gpio_irq_mask() / amd_gpio_irq_unmask(), so add locking there.
Presumably this race was leading to the loss of interrupts.

After these changes, the touchpad appears to be working fine.

Signed-off-by: Daniel Drake <drake@endlessm.com>
Acked-by: Shah, Nehal-bakulchandra <Nehal-Bakulchandra.shah@amd.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
(cherry picked from commit 6afb10267c1692ada3a2903e31ea339917ad3ac0)
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Acked-By: AceLan Kao <acelan.kao@canonical.com>
Acked-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/pinctrl/pinctrl-amd.c