linux/drivers/pinctrl
Nicolas Boichat 9d957a959b pinctrl: mediatek: Update cur_mask in mask/mask ops
During suspend/resume, mtk_eint_mask may be called while
wake_mask is active. For example, this happens if a wake-source
with an active interrupt handler wakes the system:
irq/pm.c:irq_pm_check_wakeup would disable the interrupt, so
that it can be handled later on in the resume flow.

However, this may happen before mtk_eint_do_resume is called:
in this case, wake_mask is loaded, and cur_mask is restored
from an older copy, re-enabling the interrupt, and causing
an interrupt storm (especially for level interrupts).

Step by step, for a line that has both wake and interrupt enabled:
 1. cur_mask[irq] = 1; wake_mask[irq] = 1; EINT_EN[irq] = 1 (interrupt
    enabled at hardware level)
 2. System suspends, resumes due to that line (at this stage EINT_EN
    == wake_mask)
 3. irq_pm_check_wakeup is called, and disables the interrupt =>
    EINT_EN[irq] = 0, but we still have cur_mask[irq] = 1
 4. mtk_eint_do_resume is called, and restores EINT_EN = cur_mask, so
    it reenables EINT_EN[irq] = 1 => interrupt storm as the driver
    is not yet ready to handle the interrupt.

This patch fixes the issue in step 3, by recording all mask/unmask
changes in cur_mask. This also avoids the need to read the current
mask in eint_do_suspend, and we can remove mtk_eint_chip_read_mask
function.

The interrupt will be re-enabled properly later on, sometimes after
mtk_eint_do_resume, when the driver is ready to handle it.

Fixes: 58a5e1b64b ("pinctrl: mediatek: Implement wake handler and suspend resume")
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Acked-by: Sean Wang <sean.wang@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2019-06-27 12:22:11 +01:00
..
actions treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
aspeed treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
bcm treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
berlin treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
cirrus treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
freescale treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
intel pinctrl: intel: Clear interrupt status in mask/unmask callback 2019-05-20 15:04:25 +03:00
mediatek pinctrl: mediatek: Update cur_mask in mask/mask ops 2019-06-27 12:22:11 +01:00
meson treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
mvebu treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
nomadik treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 194 2019-05-30 11:29:22 -07:00
nuvoton treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
pxa treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
qcom treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
samsung pinctrl: samsung: fix leaked of_node references 2019-04-23 10:59:47 +02:00
sh-pfc treewide: fix typos of SPDX-License-Identifier 2019-06-01 18:29:58 +02:00
sirf treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 4 2019-05-21 11:28:40 +02:00
spear treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
sprd treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
stm32 treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
sunxi treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
tegra treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
ti treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
uniphier treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
vt8500 treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
zte treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
core.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 194 2019-05-30 11:29:22 -07:00
core.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 194 2019-05-30 11:29:22 -07:00
devicetree.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
devicetree.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
Kconfig Pin control fixes for v5.2: 2019-05-28 09:35:04 -07:00
Makefile - Core Frameworks 2019-05-14 10:39:08 -07:00
pinconf-generic.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 194 2019-05-30 11:29:22 -07:00
pinconf.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 194 2019-05-30 11:29:22 -07:00
pinconf.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 194 2019-05-30 11:29:22 -07:00
pinctrl-amd.c pinctrl: Added IRQF_SHARED flag for amd-pinctrl driver 2019-04-08 14:45:15 +02:00
pinctrl-amd.h pinctrl/amd: fix gpio irq level in debugfs 2018-07-29 22:20:15 +02:00
pinctrl-artpec6.c pinctrl: artpec6: Drop unused function and rename 2019-04-11 15:41:20 +02:00
pinctrl-as3722.c pinctrl: Include <linux/gpio/driver.h> nothing else 2018-09-14 15:10:57 +02:00
pinctrl-at91-pio4.c pinctrl: pinctrl-at91-pio4: simplify getting .driver_data 2018-11-05 09:33:32 +01:00
pinctrl-at91.c pinctrl: at91: add slewrate support for SAM9X60 2019-02-08 13:07:03 +01:00
pinctrl-at91.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
pinctrl-axp209.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
pinctrl-bm1880.c pinctrl: Add pinctrl support for BM1880 SoC 2019-05-03 07:53:13 +01:00
pinctrl-coh901.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 194 2019-05-30 11:29:22 -07:00
pinctrl-coh901.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pinctrl-da850-pupd.c
pinctrl-digicolor.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
pinctrl-falcon.c pinctrl: Include <linux/gpio/driver.h> nothing else 2018-09-14 15:10:57 +02:00
pinctrl-gemini.c pinctrl: gemini: Fix up TVC clock group 2018-10-10 21:05:35 +02:00
pinctrl-ingenic.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 194 2019-05-30 11:29:22 -07:00
pinctrl-lantiq.c pinctrl: Convert to using %pOFn instead of device_node.name 2018-08-29 14:05:36 +02:00
pinctrl-lantiq.h
pinctrl-lpc18xx.c pinctrl: lpc18xx: Use define directive for PIN_CONFIG_GPIO_PIN_INT 2018-11-09 10:23:58 +01:00
pinctrl-max77620.c pinctrl: max77620: Use define directive for max77620_pinconf_param values 2018-11-09 10:02:22 +01:00
pinctrl-mcp23s08.c pinctrl: mcp23s08: Fix add_data and irqchip_add_nested call order 2019-06-25 14:14:26 +02:00
pinctrl-ocelot.c pinctrl: ocelot: fix pinmuxing for pins after 31 2019-06-25 15:42:31 +02:00
pinctrl-oxnas.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
pinctrl-palmas.c pinctrl: palmas: Delete an error message for a failed memory allocation in palmas_pinctrl_probe() 2018-01-03 08:46:49 +01:00
pinctrl-pic32.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
pinctrl-pic32.h
pinctrl-pistachio.c pinctrl: pistachio: fix leaked of_node references 2019-04-23 12:34:11 +02:00
pinctrl-rk805.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
pinctrl-rockchip.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
pinctrl-rza1.c pinctrl: rza1: Remove unneeded spinlock acquisitions 2019-04-02 09:57:50 +02:00
pinctrl-rza2.c pinctrl: Add RZ/A2 pin and gpio controller 2018-11-23 09:30:27 +01:00
pinctrl-rzn1.c pinctrl: rzn1: Fix of_get_child_count() error check 2018-12-04 10:33:49 +01:00
pinctrl-single.c pinctrl: Convert to using %pOFn instead of device_node.name 2018-08-29 14:05:36 +02:00
pinctrl-st.c pinctrl: st: fix leaked of_node references 2019-04-23 11:01:17 +02:00
pinctrl-stmfx.c pinctrl: stmfx: Fix 'warn: bitwise AND condition is false here' 2019-05-13 08:28:26 +01:00
pinctrl-sx150x.c pinctrl: sx150x: handle failure case of devm_kstrdup 2018-12-07 13:22:47 +01:00
pinctrl-tb10x.c pinctrl: tb10x: constify pinconf_ops, pinctrl_ops, and pinmux_ops structures 2017-08-22 14:41:40 +02:00
pinctrl-u300.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
pinctrl-utils.c pinctrl: utils: Delete an error message for a failed memory allocation in pinctrl_utils_add_map_configs() 2018-01-03 08:46:53 +01:00
pinctrl-utils.h
pinctrl-xway.c pinctrl: xway: fix gpio-hog related boot issues 2018-12-17 23:11:18 +01:00
pinctrl-zynq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 13 2019-05-21 11:28:45 +02:00
pinmux.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 194 2019-05-30 11:29:22 -07:00
pinmux.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 194 2019-05-30 11:29:22 -07:00