aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/of_gpio.h
diff options
context:
space:
mode:
authorJohn Bonesio <bones@secretlab.ca>2011-06-27 19:49:57 -0400
committerGrant Likely <grant.likely@secretlab.ca>2011-06-28 17:39:50 -0400
commita6b0919140b49e0871584362ae0cf1d18c476058 (patch)
tree9e9052104053a155ab8ca69ccadd581e9f8eede6 /include/linux/of_gpio.h
parentbf859f84a19f8e562af4a990a287b5e3edabc572 (diff)
of/gpio: Add new method for getting gpios under different property names
This patch adds a new routine, of_get_named_gpio_flags(), which takes the property name as a parameter rather than assuming "gpios". of_get_gpio_flags() is modified to call of_get_named_gpio_flags() with "gpios" as the property parameter. Signed-off-by: John Bonesio <bones@secretlab.ca> [grant.likely: Tidied up whitespace and tweaked kerneldoc comments.] Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'include/linux/of_gpio.h')
-rw-r--r--include/linux/of_gpio.h42
1 files changed, 37 insertions, 5 deletions
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index 6598c04dab01..aec8025c786a 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -46,8 +46,9 @@ static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc)
46 return container_of(gc, struct of_mm_gpio_chip, gc); 46 return container_of(gc, struct of_mm_gpio_chip, gc);
47} 47}
48 48
49extern int of_get_gpio_flags(struct device_node *np, int index, 49extern int of_get_named_gpio_flags(struct device_node *np,
50 enum of_gpio_flags *flags); 50 const char *list_name, int index, enum of_gpio_flags *flags);
51
51extern unsigned int of_gpio_count(struct device_node *np); 52extern unsigned int of_gpio_count(struct device_node *np);
52 53
53extern int of_mm_gpiochip_add(struct device_node *np, 54extern int of_mm_gpiochip_add(struct device_node *np,
@@ -60,8 +61,8 @@ extern struct gpio_chip *of_node_to_gpiochip(struct device_node *np);
60#else /* CONFIG_OF_GPIO */ 61#else /* CONFIG_OF_GPIO */
61 62
62/* Drivers may not strictly depend on the GPIO support, so let them link. */ 63/* Drivers may not strictly depend on the GPIO support, so let them link. */
63static inline int of_get_gpio_flags(struct device_node *np, int index, 64static inline int of_get_named_gpio_flags(struct device_node *np,
64 enum of_gpio_flags *flags) 65 const char *list_name, int index, enum of_gpio_flags *flags)
65{ 66{
66 return -ENOSYS; 67 return -ENOSYS;
67} 68}
@@ -77,7 +78,38 @@ static inline void of_gpiochip_remove(struct gpio_chip *gc) { }
77#endif /* CONFIG_OF_GPIO */ 78#endif /* CONFIG_OF_GPIO */
78 79
79/** 80/**
80 * of_get_gpio - Get a GPIO number to use with GPIO API 81 * of_get_gpio_flags() - Get a GPIO number and flags to use with GPIO API
82 * @np: device node to get GPIO from
83 * @index: index of the GPIO
84 * @flags: a flags pointer to fill in
85 *
86 * Returns GPIO number to use with Linux generic GPIO API, or one of the errno
87 * value on the error condition. If @flags is not NULL the function also fills
88 * in flags for the GPIO.
89 */
90static inline int of_get_gpio_flags(struct device_node *np, int index,
91 enum of_gpio_flags *flags)
92{
93 return of_get_named_gpio_flags(np, "gpios", index, flags);
94}
95
96/**
97 * of_get_named_gpio() - Get a GPIO number to use with GPIO API
98 * @np: device node to get GPIO from
99 * @propname: Name of property containing gpio specifier(s)
100 * @index: index of the GPIO
101 *
102 * Returns GPIO number to use with Linux generic GPIO API, or one of the errno
103 * value on the error condition.
104 */
105static inline int of_get_named_gpio(struct device_node *np,
106 const char *propname, int index)
107{
108 return of_get_named_gpio_flags(np, propname, index, NULL);
109}
110
111/**
112 * of_get_gpio() - Get a GPIO number to use with GPIO API
81 * @np: device node to get GPIO from 113 * @np: device node to get GPIO from
82 * @index: index of the GPIO 114 * @index: index of the GPIO
83 * 115 *