Skip to content

Commit 3c10a50

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 08d191b commit 3c10a50

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
@@ -50,6 +50,8 @@
5050
* GPIOs can sometimes cost only an instruction or two per bit.
5151
*/
5252

53+
#define dont_test_bit(b,d) (0)
54+
5355
/* Device and char device-related information */
5456
static DEFINE_IDA(gpio_ida);
5557
static dev_t gpio_devt;
@@ -2880,8 +2882,8 @@ int gpiod_direction_output_nonotify(struct gpio_desc *desc, int value)
28802882
value = !!value;
28812883

28822884
/* GPIOs used for enabled IRQs shall not be set as output */
2883-
if (test_bit(FLAG_USED_AS_IRQ, &flags) &&
2884-
test_bit(FLAG_IRQ_IS_ENABLED, &flags)) {
2885+
if (dont_test_bit(FLAG_USED_AS_IRQ, &flags) &&
2886+
dont_test_bit(FLAG_IRQ_IS_ENABLED, &flags)) {
28852887
gpiod_err(desc,
28862888
"%s: tried to set a GPIO tied to an IRQ as output\n",
28872889
__func__);
@@ -3855,8 +3857,8 @@ int gpiochip_lock_as_irq(struct gpio_chip *gc, unsigned int offset)
38553857
}
38563858

38573859
/* To be valid for IRQ the line needs to be input or open drain */
3858-
if (test_bit(FLAG_IS_OUT, &desc->flags) &&
3859-
!test_bit(FLAG_OPEN_DRAIN, &desc->flags)) {
3860+
if (dont_test_bit(FLAG_IS_OUT, &desc->flags) &&
3861+
!dont_test_bit(FLAG_OPEN_DRAIN, &desc->flags)) {
38603862
chip_err(gc,
38613863
"%s: tried to flag a GPIO set as output for IRQ\n",
38623864
__func__);

0 commit comments

Comments
 (0)