forked from luck/tmp_suning_uos_patched
f6a8249f9e
Currently after configuring a GPIO pin as an interrupt related pinmux registers are changed, but there is no protection from calling gpio_direction_*() in a badly written driver, which would cause the same pinmux register to be reconfigured for regular input/output and this disabling interrupt capability of the pin. This patch addresses this issue by moving pinmux reconfiguration to .irq_{request,release}_resources() callback of irq_chip and calling gpio_lock_as_irq() helper to prevent reconfiguration of pin direction. Setting up a GPIO interrupt on Samsung SoCs is a two-step operation - in addition to trigger configuration in a dedicated register, the pinmux must be also reconfigured to GPIO interrupt, which is a different function than normal GPIO input, although I/O-wise they both behave in the same way and gpio_get_value() can be used on a pin configured as IRQ as well. Such design implies subtleties such as gpio_direction_input() not having to fail if a pin is already configured as an interrupt nor change the configuration to normal input. But the FLAG_USED_AS_IRQ set in gpiolib by gpio_lock_as_irq() is only used to check that gpio_direction_output() is not called, it's not used to prevent gpio_direction_input() to be called. So this is not a complete solution for Samsung SoCs but it's definitely a move in the right direction. Signed-off-by: Tomasz Figa <t.figa@samsung.com> [javier: use request resources instead of startup and expand commit message] Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> |
||
---|---|---|
.. | ||
berlin | ||
mvebu | ||
nomadik | ||
qcom | ||
samsung | ||
sh-pfc | ||
sirf | ||
spear | ||
sunxi | ||
vt8500 | ||
core.c | ||
core.h | ||
devicetree.c | ||
devicetree.h | ||
Kconfig | ||
Makefile | ||
pinconf-generic.c | ||
pinconf.c | ||
pinconf.h | ||
pinctrl-adi2-bf54x.c | ||
pinctrl-adi2-bf60x.c | ||
pinctrl-adi2.c | ||
pinctrl-adi2.h | ||
pinctrl-as3722.c | ||
pinctrl-at91.c | ||
pinctrl-baytrail.c | ||
pinctrl-bcm281xx.c | ||
pinctrl-bcm2835.c | ||
pinctrl-coh901.c | ||
pinctrl-coh901.h | ||
pinctrl-falcon.c | ||
pinctrl-imx.c | ||
pinctrl-imx.h | ||
pinctrl-imx1-core.c | ||
pinctrl-imx1.c | ||
pinctrl-imx1.h | ||
pinctrl-imx6dl.c | ||
pinctrl-imx6q.c | ||
pinctrl-imx6sl.c | ||
pinctrl-imx6sx.c | ||
pinctrl-imx23.c | ||
pinctrl-imx25.c | ||
pinctrl-imx27.c | ||
pinctrl-imx28.c | ||
pinctrl-imx35.c | ||
pinctrl-imx50.c | ||
pinctrl-imx51.c | ||
pinctrl-imx53.c | ||
pinctrl-lantiq.c | ||
pinctrl-lantiq.h | ||
pinctrl-mxs.c | ||
pinctrl-mxs.h | ||
pinctrl-palmas.c | ||
pinctrl-rockchip.c | ||
pinctrl-single.c | ||
pinctrl-st.c | ||
pinctrl-tb10x.c | ||
pinctrl-tegra-xusb.c | ||
pinctrl-tegra.c | ||
pinctrl-tegra.h | ||
pinctrl-tegra20.c | ||
pinctrl-tegra30.c | ||
pinctrl-tegra114.c | ||
pinctrl-tegra124.c | ||
pinctrl-tz1090-pdc.c | ||
pinctrl-tz1090.c | ||
pinctrl-u300.c | ||
pinctrl-utils.c | ||
pinctrl-utils.h | ||
pinctrl-vf610.c | ||
pinctrl-xway.c | ||
pinmux.c | ||
pinmux.h |