aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic
diff options
context:
space:
mode:
authorjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-11-05 11:41:10 +0000
committerjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-11-05 11:41:10 +0000
commit96a221d754a904d3a1857ad1d8be26b9cf56f1ee (patch)
tree78d31946e53aa4a60427720597f0a840c85e269d /target/linux/generic
parent55798d7d05e14759ce914a1e1b27dec36b57a5e1 (diff)
downloadopenwrt-96a221d754a904d3a1857ad1d8be26b9cf56f1ee.tar.gz
openwrt-96a221d754a904d3a1857ad1d8be26b9cf56f1ee.zip
AA: linux/3.3: backport an upstream GPIO patch
Backport of r34081. The backported patch introduces new flags to automatically export GPIOs when using the convenience unctions gpio_request_one() or gpio_request_array(). This will be used by ar71xx/ramips platforms. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/branches/attitude_adjustment@34084 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/generic')
-rw-r--r--target/linux/generic/patches-3.3/070-gpio-add-flags-to-export-GPIOs-when-requesting.patch68
1 files changed, 68 insertions, 0 deletions
diff --git a/target/linux/generic/patches-3.3/070-gpio-add-flags-to-export-GPIOs-when-requesting.patch b/target/linux/generic/patches-3.3/070-gpio-add-flags-to-export-GPIOs-when-requesting.patch
new file mode 100644
index 000000000..fb4387eb2
--- /dev/null
+++ b/target/linux/generic/patches-3.3/070-gpio-add-flags-to-export-GPIOs-when-requesting.patch
@@ -0,0 +1,68 @@
+From fc3a1f04f5040255cbc086c419e4237f29f89f88 Mon Sep 17 00:00:00 2001
+From: Wolfram Sang <w.sang@pengutronix.de>
+Date: Tue, 13 Dec 2011 18:34:01 +0100
+Subject: [PATCH] gpio: add flags to export GPIOs when requesting
+
+commit fc3a1f04f5040255cbc086c419e4237f29f89f88 upstream.
+
+Introduce new flags to automatically export GPIOs when using the convenience
+functions gpio_request_one() or gpio_request_array(). This eases support for
+custom boards where lots of GPIOs need to be exported for customer
+applications.
+
+Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
+Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
+---
+ Documentation/gpio.txt | 3 +++
+ drivers/gpio/gpiolib.c | 12 +++++++++++-
+ include/linux/gpio.h | 5 +++++
+ 3 files changed, 19 insertions(+), 1 deletion(-)
+
+--- a/Documentation/gpio.txt
++++ b/Documentation/gpio.txt
+@@ -303,6 +303,9 @@ where 'flags' is currently defined to sp
+ * GPIOF_INIT_LOW - as output, set initial level to LOW
+ * GPIOF_INIT_HIGH - as output, set initial level to HIGH
+
++ * GPIOF_EXPORT_DIR_FIXED - export gpio to sysfs, keep direction
++ * GPIOF_EXPORT_DIR_CHANGEABLE - also export, allow changing direction
++
+ since GPIOF_INIT_* are only valid when configured as output, so group valid
+ combinations as:
+
+--- a/drivers/gpio/gpiolib.c
++++ b/drivers/gpio/gpiolib.c
+@@ -1289,8 +1289,18 @@ int gpio_request_one(unsigned gpio, unsi
+ (flags & GPIOF_INIT_HIGH) ? 1 : 0);
+
+ if (err)
+- gpio_free(gpio);
++ goto free_gpio;
+
++ if (flags & GPIOF_EXPORT) {
++ err = gpio_export(gpio, flags & GPIOF_EXPORT_CHANGEABLE);
++ if (err)
++ goto free_gpio;
++ }
++
++ return 0;
++
++ free_gpio:
++ gpio_free(gpio);
+ return err;
+ }
+ EXPORT_SYMBOL_GPL(gpio_request_one);
+--- a/include/linux/gpio.h
++++ b/include/linux/gpio.h
+@@ -14,6 +14,11 @@
+ #define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW)
+ #define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH)
+
++#define GPIOF_EXPORT (1 << 2)
++#define GPIOF_EXPORT_CHANGEABLE (1 << 3)
++#define GPIOF_EXPORT_DIR_FIXED (GPIOF_EXPORT)
++#define GPIOF_EXPORT_DIR_CHANGEABLE (GPIOF_EXPORT | GPIOF_EXPORT_CHANGEABLE)
++
+ /**
+ * struct gpio - a structure describing a GPIO with configuration
+ * @gpio: the GPIO number