1
0
Fork 0
alistair23-linux/drivers/pinctrl
Tomasz Figa f6a8249f9e pinctrl: exynos: Lock GPIOs as interrupts when used as EINTs
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>
2014-08-21 07:24:29 -05:00
..
berlin pinctrl: berlin: fix an error code in berlin_pinctrl_probe() 2014-07-05 01:15:35 +02:00
mvebu pinctrl: mvebu: new driver for Orion platforms 2014-04-24 15:09:35 +02:00
nomadik pinctrl: abx500: remove useless check 2014-08-17 09:15:44 -05:00
qcom pinctrl: msm: drop negativity check on unsigned value 2014-07-23 15:24:40 +02:00
samsung pinctrl: exynos: Lock GPIOs as interrupts when used as EINTs 2014-08-21 07:24:29 -05:00
sh-pfc sh-pfc: r8a7791: fix CAN pin groups 2014-08-17 09:15:43 -05:00
sirf pinctrl: avoid duplicated calling enable_pinmux_setting for a pin 2014-07-11 14:08:26 +02:00
spear pinctrl: remove all usage of gpio_remove ret val in driver/pinctl 2014-07-22 16:34:12 +02:00
sunxi This is the bulk pin control changes for the v3.17 merge 2014-08-07 17:20:53 -07:00
vt8500 pinctrl: remove all usage of gpio_remove ret val in driver/pinctl 2014-07-22 16:34:12 +02:00
Kconfig ARM: SoC device-tree changes for 3.17 2014-08-08 11:16:58 -07:00
Makefile ARM: SoC device-tree changes for 3.17 2014-08-08 11:16:58 -07:00
core.c pinctrl: avoid duplicated calling enable_pinmux_setting for a pin 2014-07-11 14:08:26 +02:00
core.h pinctrl: move subsystem mutex to pinctrl_dev struct 2013-04-26 17:01:35 +02:00
devicetree.c pinctrl: Quiet logging about missing DT nodes when not using DT 2014-02-24 10:44:54 +01:00
devicetree.h pinctrl: core device tree mapping table parsing support 2012-04-18 13:53:10 +02:00
pinconf-generic.c pinctrl: Enable "power-source" to be extracted from DT files 2014-05-28 10:16:35 +02:00
pinconf.c pinctrl: pinconf: remove warning: unused variable 'ops' 2013-12-13 13:55:15 +01:00
pinconf.h pinctrl: add function to parse generic pinconfig properties from a dt node 2013-06-16 11:57:32 +02:00
pinctrl-adi2-bf54x.c pinctrl: pinctrl-adi: combine multiple groups of one function together 2014-02-25 10:49:13 +01:00
pinctrl-adi2-bf60x.c pinctrl: pinctrl-adi: combine multiple groups of one function together 2014-02-25 10:49:13 +01:00
pinctrl-adi2.c pinctrl: remove all usage of gpio_remove ret val in driver/pinctl 2014-07-22 16:34:12 +02:00
pinctrl-adi2.h pinctrl: pinctrl-adi: combine multiple groups of one function together 2014-02-25 10:49:13 +01:00
pinctrl-as3722.c pinctrl: remove all usage of gpio_remove ret val in driver/pinctl 2014-07-22 16:34:12 +02:00
pinctrl-at91.c pinctrl: pinctrl-at91.c: fix decimal printf format specifiers prefixed with 0x 2014-08-17 09:15:44 -05:00
pinctrl-baytrail.c pinctrl: baytrail: Convert to use gpiolib irqchip 2014-07-28 12:21:00 +02:00
pinctrl-bcm281xx.c pinctrl: bcm281xx: Staticize bcm281xx_pinctrl_probe 2014-07-11 14:08:31 +02:00
pinctrl-bcm2835.c pinctrl: avoid duplicated calling enable_pinmux_setting for a pin 2014-07-11 14:08:26 +02:00
pinctrl-coh901.c pinctrl: remove all usage of gpio_remove ret val in driver/pinctl 2014-07-22 16:34:12 +02:00
pinctrl-coh901.h pinctrl: support pinconfig on the U300 2012-03-12 22:49:03 +01:00
pinctrl-falcon.c pinctrl: Pass all configs to driver on pin_config_set() 2013-08-28 13:34:41 +02:00
pinctrl-imx.c pinctrl: pinctrl-imx.c: Cleaning up if unsigned is less than zero 2014-07-11 14:08:32 +02:00
pinctrl-imx.h pinctrl: imx: Use struct type for pins 2013-08-16 14:43:56 +02:00
pinctrl-imx1-core.c pinctrl: pinctrl-imx1-core.c: Cleaning up if unsigned is less than zero 2014-07-11 14:08:33 +02:00
pinctrl-imx1.c pinctrl: Add i.MX1 pincontrol driver 2014-07-11 14:08:25 +02:00
pinctrl-imx1.h pinctrl: imx1 core driver 2013-10-29 06:54:37 -07:00
pinctrl-imx6dl.c pinctrl: remove redundant of_match_ptr 2013-10-08 10:02:25 +02:00
pinctrl-imx6q.c pinctrl: remove redundant of_match_ptr 2013-10-08 10:02:25 +02:00
pinctrl-imx6sl.c pinctrl: remove redundant of_match_ptr 2013-10-08 10:02:25 +02:00
pinctrl-imx6sx.c pinctrl: add pinctrl driver for imx6sx 2014-05-27 11:24:28 +02:00
pinctrl-imx23.c Drivers: pinctrl: remove __dev* attributes. 2013-01-03 15:57:02 -08:00
pinctrl-imx25.c pinctrl: pinctrl-imx: add imx25 pinctrl driver 2013-11-25 09:08:30 +01:00
pinctrl-imx27.c pinctrl: i.MX27: Remove nonexistent pad definitions 2014-07-11 14:08:26 +02:00
pinctrl-imx28.c Drivers: pinctrl: remove __dev* attributes. 2013-01-03 15:57:02 -08:00
pinctrl-imx35.c pinctrl: remove redundant of_match_ptr 2013-10-08 10:02:25 +02:00
pinctrl-imx50.c pinctrl: imx50: add pinctrl support code for the IMX50 SoC 2013-11-06 10:06:59 +01:00
pinctrl-imx51.c pinctrl: remove redundant of_match_ptr 2013-10-08 10:02:25 +02:00
pinctrl-imx53.c pinctrl: remove redundant of_match_ptr 2013-10-08 10:02:25 +02:00
pinctrl-lantiq.c pinctrl/lantiq: Free mapping configs for both pin and groups 2013-05-15 13:28:46 +02:00
pinctrl-lantiq.h pinctrl: lantiq: Fix header file include guard 2014-04-22 08:41:35 +02:00
pinctrl-mxs.c pinctrl: Pass all configs to driver on pin_config_set() 2013-08-28 13:34:41 +02:00
pinctrl-mxs.h pinctrl: add pinctrl-mxs support 2012-05-02 01:18:27 +02:00
pinctrl-palmas.c pinctrl: palmas: remove pin config BIAS_PULL_PIN_DEFAULT support 2013-10-08 13:27:27 +02:00
pinctrl-rockchip.c pinctrl: rockchip: fix rk3288 gpio0 configuration 2014-08-17 09:15:43 -05:00
pinctrl-single.c pinctrl: pinctrl-single.c: Cleaning up wrong format string usage 2014-07-11 14:08:35 +02:00
pinctrl-st.c This is the bulk pin control changes for the v3.17 merge 2014-08-07 17:20:53 -07:00
pinctrl-tb10x.c pinctrl: avoid duplicated calling enable_pinmux_setting for a pin 2014-07-11 14:08:26 +02:00
pinctrl-tegra-xusb.c pinctrl: tegra-xusb: testing wrong variable in probe() 2014-08-17 09:15:44 -05:00
pinctrl-tegra.c pinctrl: avoid duplicated calling enable_pinmux_setting for a pin 2014-07-11 14:08:26 +02:00
pinctrl-tegra.h pinctrl: tegra: add missing kerneldoc 2014-04-22 16:55:41 +02:00
pinctrl-tegra20.c pinctrl: tegra: remove fsafe from data tables 2014-04-22 16:50:24 +02:00
pinctrl-tegra30.c pinctrl: tegra: remove fsafe from data tables 2014-04-22 16:50:24 +02:00
pinctrl-tegra114.c pinctrl: tegra: remove fsafe from data tables 2014-04-22 16:50:24 +02:00
pinctrl-tegra124.c pinctrl: tegra: remove fsafe from data tables 2014-04-22 16:50:24 +02:00
pinctrl-tz1090-pdc.c pinctrl: avoid duplicated calling enable_pinmux_setting for a pin 2014-07-11 14:08:26 +02:00
pinctrl-tz1090.c pinctrl: avoid duplicated calling enable_pinmux_setting for a pin 2014-07-11 14:08:26 +02:00
pinctrl-u300.c pinctrl: avoid duplicated calling enable_pinmux_setting for a pin 2014-07-11 14:08:26 +02:00
pinctrl-utils.c pinctrl: utils: include export.h to avoid warnings 2013-08-28 15:50:33 +02:00
pinctrl-utils.h pinctrl: add utility functions for add map/configs 2013-08-14 21:00:41 +02:00
pinctrl-vf610.c pinctrl: remove redundant of_match_ptr 2013-10-08 10:02:25 +02:00
pinctrl-xway.c pinctrl/lantiq: fix typo 2014-01-08 10:13:38 +01:00
pinmux.c pinctrl: avoid duplicated calling enable_pinmux_setting for a pin 2014-07-11 14:08:26 +02:00
pinmux.h pinctrl: ifdef CONFIG_DEBUG_FS cleanup 2012-04-18 13:53:12 +02:00