Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: dwapb: Use generic request, free and set_config

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 <emil.renner.berthing@canonical.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

authored by

Emil Renner Berthing and committed by
Bartosz Golaszewski
f34fd6ee 513246a3

+9 -4
+9 -4
drivers/gpio/gpio-dwapb.c
··· 416 416 { 417 417 u32 debounce; 418 418 419 - if (pinconf_to_config_param(config) != PIN_CONFIG_INPUT_DEBOUNCE) 420 - return -ENOTSUPP; 419 + if (pinconf_to_config_param(config) == PIN_CONFIG_INPUT_DEBOUNCE) { 420 + debounce = pinconf_to_config_argument(config); 421 + return dwapb_gpio_set_debounce(gc, offset, debounce); 422 + } 421 423 422 - debounce = pinconf_to_config_argument(config); 423 - return dwapb_gpio_set_debounce(gc, offset, debounce); 424 + return gpiochip_generic_config(gc, offset, config); 424 425 } 425 426 426 427 static int dwapb_convert_irqs(struct dwapb_gpio_port_irqchip *pirq, ··· 531 530 port->gc.fwnode = pp->fwnode; 532 531 port->gc.ngpio = pp->ngpio; 533 532 port->gc.base = pp->gpio_base; 533 + port->gc.request = gpiochip_generic_request; 534 + port->gc.free = gpiochip_generic_free; 534 535 535 536 /* Only port A support debounce */ 536 537 if (pp->idx == 0) 537 538 port->gc.set_config = dwapb_gpio_set_config; 539 + else 540 + port->gc.set_config = gpiochip_generic_config; 538 541 539 542 /* Only port A can provide interrupts in all configurations of the IP */ 540 543 if (pp->idx == 0)