[OpenWrt-Devel] [PATCH] Unexport GPIO fix for ramips

Gerhard Bertelsmann info at gerhard-bertelsmann.de
Thu Sep 25 06:09:48 EDT 2014


Hi,

please find attached the patch for the existing patch file:

Add missing code to free GPIO on Ralink SoC

Signed-off-by: schildt at ibr.cs.tu-bs.de
Acked-by: info at gerhard-bertelsmann.de

--- a/target/linux/ramips/patches-3.14/0047-GPIO-MIPS-ralink-add-gpio-driver-for-ralink-SoC.patch
+++ b/target/linux/ramips/patches-3.14/0047-GPIO-MIPS-ralink-add-gpio-driver-for-ralink-SoC.patch
@@ -72,7 +72,7 @@ Cc: linux-gpio at vger.kernel.org
  obj-$(CONFIG_GPIO_RCAR)               += gpio-rcar.o
 --- /dev/null
 +++ b/drivers/gpio/gpio-ralink.c
-@@ -0,0 +1,345 @@
+@@ -0,0 +1,353 @@
 +/*
 + * This program is free software; you can redistribute it and/or modify it
 + * under the terms of the GNU General Public License version 2 as published
@@ -333,6 +333,13 @@ Cc: linux-gpio at vger.kernel.org
 +      return pinctrl_request_gpio(gpio);
 +}
 +
++static void ralink_gpio_free(struct gpio_chip *chip, unsigned offset)
++{
++      int gpio = chip->base + offset;
++
++      pinctrl_free_gpio(gpio);
++}
++
 +static int ralink_gpio_probe(struct platform_device *pdev)
 +{
 +      struct device_node *np = pdev->dev.of_node;
@@ -385,6 +392,7 @@ Cc: linux-gpio at vger.kernel.org
 +      rg->chip.get = ralink_gpio_get;
 +      rg->chip.set = ralink_gpio_set;
 +      rg->chip.request = ralink_gpio_request;
++      rg->chip.free = ralink_gpio_free;
 +      rg->chip.to_irq = ralink_gpio_to_irq;
 +
 +      /* set polarity to low for all lines */


Am Mi, 24.09.2014, 15:20, schrieb Sebastian Schildt:
> Hello there,
>
> not sure how it works with patches in OpenWRT, so I try all channels… I noticed that unexporting
> GPIOs is broken on ramips (gpio-ralink.c). There is a trac issue with some more details, and I
> already added the patch there:
>
> https://dev.openwrt.org/ticket/14309
>
>
> Here it is again for your convenvience:
>
> --- a/drivers/gpio/gpio-ralink.c	2014-09-23 11:06:10.044595879 +0200
> +++ b/drivers/gpio/gpio-ralink.c	2014-09-23 11:11:14.063674520 +0200
> @@ -258,6 +258,14 @@
>  	return pinctrl_request_gpio(gpio);
>  }
>
> +static void ralink_gpio_free(struct gpio_chip *chip, unsigned offset)
> +{
> +        int gpio = chip->base + offset;
> +
> +        pinctrl_free_gpio(gpio);
> +}
> +
> +
>  static int ralink_gpio_probe(struct platform_device *pdev)
>  {
>  	struct device_node *np = pdev->dev.of_node;
> @@ -310,6 +318,7 @@
>  	rg->chip.get = ralink_gpio_get;
>  	rg->chip.set = ralink_gpio_set;
>  	rg->chip.request = ralink_gpio_request;
> +        rg->chip.free = ralink_gpio_free;
>  	rg->chip.to_irq = ralink_gpio_to_irq;
>
>  	/* set polarity to low for all lines */
>
>
>
> Obviously, it needs to be applied after te patch that creates gpio-ralink.c in the first place.
>
>
>
> MfG
>
> Sebastian_______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list