Skip to content

Commit 779fdbf

Browse files
author
Phil Elwell
committed
gpiolib: Don't prevent IRQ usage of output GPIOs
Upstream Linux deems using output GPIOs to generate IRQs as a bogus use case, even though the BCM2835 GPIO controller is capable of doing so. A number of users would like to make use of this facility, so disable the checks. See: #2527 Signed-off-by: Phil Elwell <[email protected]>
1 parent a6afff6 commit 779fdbf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/gpio/gpiolib.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
#define extra_checks 0
5454
#endif
5555

56+
#define dont_test_bit(b,d) (0)
57+
5658
/* Device and char device-related information */
5759
static DEFINE_IDA(gpio_ida);
5860
static dev_t gpio_devt;
@@ -2478,7 +2480,7 @@ int gpiod_direction_output(struct gpio_desc *desc, int value)
24782480
value = !!value;
24792481

24802482
/* GPIOs used for IRQs shall not be set as output */
2481-
if (test_bit(FLAG_USED_AS_IRQ, &desc->flags)) {
2483+
if (dont_test_bit(FLAG_USED_AS_IRQ, &desc->flags)) {
24822484
gpiod_err(desc,
24832485
"%s: tried to set a GPIO tied to an IRQ as output\n",
24842486
__func__);
@@ -3109,7 +3111,7 @@ int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset)
31093111
set_bit(FLAG_IS_OUT, &desc->flags);
31103112
}
31113113

3112-
if (test_bit(FLAG_IS_OUT, &desc->flags)) {
3114+
if (dont_test_bit(FLAG_IS_OUT, &desc->flags)) {
31133115
chip_err(chip,
31143116
"%s: tried to flag a GPIO set as output for IRQ\n",
31153117
__func__);

0 commit comments

Comments
 (0)