Skip to content

Commit 5da5dd8

Browse files
Phil Elwellpopcornmix
Phil Elwell
authored andcommitted
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 3bc04f6 commit 5da5dd8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/gpio/gpiolib.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
* GPIOs can sometimes cost only an instruction or two per bit.
5252
*/
5353

54+
#define dont_test_bit(b,d) (0)
55+
5456
/* Device and char device-related information */
5557
static DEFINE_IDA(gpio_ida);
5658
static dev_t gpio_devt;
@@ -2986,8 +2988,8 @@ int gpiod_direction_output_nonotify(struct gpio_desc *desc, int value)
29862988
value = !!value;
29872989

29882990
/* GPIOs used for enabled IRQs shall not be set as output */
2989-
if (test_bit(FLAG_USED_AS_IRQ, &flags) &&
2990-
test_bit(FLAG_IRQ_IS_ENABLED, &flags)) {
2991+
if (dont_test_bit(FLAG_USED_AS_IRQ, &flags) &&
2992+
dont_test_bit(FLAG_IRQ_IS_ENABLED, &flags)) {
29912993
gpiod_err(desc,
29922994
"%s: tried to set a GPIO tied to an IRQ as output\n",
29932995
__func__);
@@ -4018,8 +4020,8 @@ int gpiochip_lock_as_irq(struct gpio_chip *gc, unsigned int offset)
40184020
}
40194021

40204022
/* To be valid for IRQ the line needs to be input or open drain */
4021-
if (test_bit(FLAG_IS_OUT, &desc->flags) &&
4022-
!test_bit(FLAG_OPEN_DRAIN, &desc->flags)) {
4023+
if (dont_test_bit(FLAG_IS_OUT, &desc->flags) &&
4024+
!dont_test_bit(FLAG_OPEN_DRAIN, &desc->flags)) {
40234025
chip_err(gc,
40244026
"%s: tried to flag a GPIO set as output for IRQ\n",
40254027
__func__);

0 commit comments

Comments
 (0)