]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gpiolib: add support for pull up/down to lineevent_create
authorKent Gibson <warthog618@gmail.com>
Tue, 5 Nov 2019 02:04:24 +0000 (10:04 +0800)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Tue, 12 Nov 2019 15:30:30 +0000 (16:30 +0100)
Add support for pull up/down to lineevent_create.
Use cases include receiving asynchronous presses from a
push button without an external pull up/down.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
drivers/gpio/gpiolib.c

index 53086724c0512bc7fcfc9b56d0dc549619ca416a..b7d7bb8bd20dd5f8b44d00f96ededb07aa54d9b0 100644 (file)
@@ -951,6 +951,10 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
 
        if (lflags & GPIOHANDLE_REQUEST_ACTIVE_LOW)
                set_bit(FLAG_ACTIVE_LOW, &desc->flags);
+       if (lflags & GPIOHANDLE_REQUEST_BIAS_PULL_DOWN)
+               set_bit(FLAG_PULL_DOWN, &desc->flags);
+       if (lflags & GPIOHANDLE_REQUEST_BIAS_PULL_UP)
+               set_bit(FLAG_PULL_UP, &desc->flags);
 
        ret = gpiod_direction_input(desc);
        if (ret)