linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] of/gpio: export of_simple_xlate function
@ 2008-03-26 20:24 Anton Vorontsov
  0 siblings, 0 replies; only message in thread
From: Anton Vorontsov @ 2008-03-26 20:24 UTC (permalink / raw)
  To: linuxppc-dev

So we'll able to use it for the non-memory mapped drivers (like
I2C GPIO expanders).

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---

Depends on the previous OF GPIO work.

 drivers/of/gpio.c       |    6 +++---
 include/linux/of_gpio.h |   13 +++++++++++++
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/of/gpio.c b/drivers/of/gpio.c
index a6775ff..03e2fed 100644
--- a/drivers/of/gpio.c
+++ b/drivers/of/gpio.c
@@ -106,9 +106,8 @@ err0:
 }
 EXPORT_SYMBOL(of_get_gpio);
 
-static int of_gpio_simple_xlate(struct of_gpio_chip *of_gc,
-				struct device_node *np,
-				const void *gpio_spec)
+int of_gpio_simple_xlate(struct of_gpio_chip *of_gc, struct device_node *np,
+			 const void *gpio_spec)
 {
 	const u32 *gpio = gpio_spec;
 
@@ -117,6 +116,7 @@ static int of_gpio_simple_xlate(struct of_gpio_chip *of_gc,
 
 	return *gpio;
 }
+EXPORT_SYMBOL(of_gpio_simple_xlate);
 
 int of_mm_gpiochip_add(struct device_node *np,
 		       struct of_mm_gpio_chip *mm_gc)
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index ca313f0..75c209c 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -83,6 +83,19 @@ extern int of_get_gpio(struct device_node *np, int index);
 extern int of_mm_gpiochip_add(struct device_node *np,
 			      struct of_mm_gpio_chip *mm_gc);
 
+/**
+ * of_gpio_simple_xlate - translate gpio_spec to the GPIO number
+ * @of_gc:	pointer to the of_gpio_chip structure
+ * @np:		device node of the GPIO chip
+ * @gpio_spec:	gpio specifier as found in the device tree
+ *
+ * This is simple translation function, suitable for the most 1:1 mapped
+ * gpio chips. This function performs only one sanity check: whether gpio
+ * is less than ngpios (that is specified in the gpio_chip).
+ */
+extern int of_gpio_simple_xlate(struct of_gpio_chip *of_gc,
+				struct device_node *np,
+				const void *gpio_spec);
 #else
 
 /* Drivers may not strictly depend on the GPIO support, so let them link. */
-- 
1.5.2.2

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-03-26 20:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-26 20:24 [PATCH 1/5] of/gpio: export of_simple_xlate function Anton Vorontsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).