firmware-utils: bump to git HEAD
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-0128-gpiolib-Don-t-prevent-IRQ-usage-of-output-GPIOs.patch
1 From 122b21149cada59805040895f3d679ceb0e00063 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Tue, 24 Apr 2018 14:42:27 +0100
4 Subject: [PATCH] gpiolib: Don't prevent IRQ usage of output GPIOs
5
6 Upstream Linux deems using output GPIOs to generate IRQs as a bogus
7 use case, even though the BCM2835 GPIO controller is capable of doing
8 so. A number of users would like to make use of this facility, so
9 disable the checks.
10
11 See: https://github.com/raspberrypi/linux/issues/2527
12
13 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
14 ---
15 drivers/gpio/gpiolib.c | 8 +++++---
16 1 file changed, 5 insertions(+), 3 deletions(-)
17
18 --- a/drivers/gpio/gpiolib.c
19 +++ b/drivers/gpio/gpiolib.c
20 @@ -55,6 +55,8 @@
21 #define extra_checks 0
22 #endif
23
24 +#define dont_test_bit(b,d) (0)
25 +
26 /* Device and char device-related information */
27 static DEFINE_IDA(gpio_ida);
28 static dev_t gpio_devt;
29 @@ -3091,8 +3093,8 @@ int gpiod_direction_output(struct gpio_d
30 value = !!value;
31
32 /* GPIOs used for enabled IRQs shall not be set as output */
33 - if (test_bit(FLAG_USED_AS_IRQ, &desc->flags) &&
34 - test_bit(FLAG_IRQ_IS_ENABLED, &desc->flags)) {
35 + if (dont_test_bit(FLAG_USED_AS_IRQ, &desc->flags) &&
36 + dont_test_bit(FLAG_IRQ_IS_ENABLED, &desc->flags)) {
37 gpiod_err(desc,
38 "%s: tried to set a GPIO tied to an IRQ as output\n",
39 __func__);
40 @@ -3895,8 +3897,8 @@ int gpiochip_lock_as_irq(struct gpio_chi
41 }
42
43 /* To be valid for IRQ the line needs to be input or open drain */
44 - if (test_bit(FLAG_IS_OUT, &desc->flags) &&
45 - !test_bit(FLAG_OPEN_DRAIN, &desc->flags)) {
46 + if (dont_test_bit(FLAG_IS_OUT, &desc->flags) &&
47 + !dont_test_bit(FLAG_OPEN_DRAIN, &desc->flags)) {
48 chip_err(chip,
49 "%s: tried to flag a GPIO set as output for IRQ\n",
50 __func__);