]> Git Repo - linux.git/commitdiff
gpio: dwapb: Use generic request, free and set_config
authorEmil Renner Berthing <[email protected]>
Fri, 29 Dec 2023 13:07:51 +0000 (14:07 +0100)
committerBartosz Golaszewski <[email protected]>
Tue, 2 Jan 2024 13:16:17 +0000 (14:16 +0100)
This way GPIO will be denied on pins already claimed by other devices
and basic pin configuration (pull-up, pull-down etc.) can be done
through the userspace GPIO API.

Signed-off-by: Emil Renner Berthing <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Acked-by: Serge Semin <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
drivers/gpio/gpio-dwapb.c

index 8c59332429c260cf01bc578dd14361db7804a678..798235791f701f5c40650de1dd9fa765c9296fc0 100644 (file)
@@ -416,11 +416,12 @@ static int dwapb_gpio_set_config(struct gpio_chip *gc, unsigned offset,
 {
        u32 debounce;
 
-       if (pinconf_to_config_param(config) != PIN_CONFIG_INPUT_DEBOUNCE)
-               return -ENOTSUPP;
+       if (pinconf_to_config_param(config) == PIN_CONFIG_INPUT_DEBOUNCE) {
+               debounce = pinconf_to_config_argument(config);
+               return dwapb_gpio_set_debounce(gc, offset, debounce);
+       }
 
-       debounce = pinconf_to_config_argument(config);
-       return dwapb_gpio_set_debounce(gc, offset, debounce);
+       return gpiochip_generic_config(gc, offset, config);
 }
 
 static int dwapb_convert_irqs(struct dwapb_gpio_port_irqchip *pirq,
@@ -530,10 +531,14 @@ static int dwapb_gpio_add_port(struct dwapb_gpio *gpio,
        port->gc.fwnode = pp->fwnode;
        port->gc.ngpio = pp->ngpio;
        port->gc.base = pp->gpio_base;
+       port->gc.request = gpiochip_generic_request;
+       port->gc.free = gpiochip_generic_free;
 
        /* Only port A support debounce */
        if (pp->idx == 0)
                port->gc.set_config = dwapb_gpio_set_config;
+       else
+               port->gc.set_config = gpiochip_generic_config;
 
        /* Only port A can provide interrupts in all configurations of the IP */
        if (pp->idx == 0)
This page took 0.057105 seconds and 4 git commands to generate.