]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
gpio: bcm-kona: Make sure GPIO bits are unlocked when requesting IRQ
authorArtur Weber <aweber.kernel@gmail.com>
Thu, 6 Feb 2025 17:46:01 +0000 (18:46 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 11:50:35 +0000 (12:50 +0100)
commitf66a5da15f143c84090d12a1abe194de9de25197
treee67502fa6a30b440606665514c5cc09a24950629
parent54b0de7b6abef5b278ff8f945070e969b1495081
gpio: bcm-kona: Make sure GPIO bits are unlocked when requesting IRQ

[ Upstream commit 57f5db77a915cc29461a679a6bcae7097967be1a ]

The settings for all GPIOs are locked by default in bcm_kona_gpio_reset.
The settings for a GPIO are unlocked when requesting it as a GPIO, but
not when requesting it as an interrupt, causing the IRQ settings to not
get applied.

Fix this by making sure to unlock the right bits when an IRQ is requested.
To avoid a situation where an IRQ being released causes a lock despite
the same GPIO being used by a GPIO request or vice versa, add an unlock
counter and only lock if it reaches 0.

Fixes: 757651e3d60e ("gpio: bcm281xx: Add GPIO driver")
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Markus Mayer <mmayer@broadcom.com>
Signed-off-by: Artur Weber <aweber.kernel@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250206-kona-gpio-fixes-v2-2-409135eab780@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpio/gpio-bcm-kona.c