Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 256719
b: refs/heads/master
c: a6b0919
h: refs/heads/master
i:
  256717: eb26c74
  256715: 213800a
  256711: b502fbc
  256703: 2045640
v: v3
  • Loading branch information
John Bonesio authored and Grant Likely committed Jun 28, 2011
1 parent 597a414 commit 979e91c
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bf859f84a19f8e562af4a990a287b5e3edabc572
refs/heads/master: a6b0919140b49e0871584362ae0cf1d18c476058
11 changes: 6 additions & 5 deletions trunk/drivers/of/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,18 @@
#include <linux/slab.h>

/**
* of_get_gpio_flags - Get a GPIO number and flags to use with GPIO API
* of_get_named_gpio_flags() - Get a GPIO number and flags to use with GPIO API
* @np: device node to get GPIO from
* @propname: property name containing gpio specifier(s)
* @index: index of the GPIO
* @flags: a flags pointer to fill in
*
* Returns GPIO number to use with Linux generic GPIO API, or one of the errno
* value on the error condition. If @flags is not NULL the function also fills
* in flags for the GPIO.
*/
int of_get_gpio_flags(struct device_node *np, int index,
enum of_gpio_flags *flags)
int of_get_named_gpio_flags(struct device_node *np, const char *propname,
int index, enum of_gpio_flags *flags)
{
int ret;
struct device_node *gpio_np;
Expand All @@ -40,7 +41,7 @@ int of_get_gpio_flags(struct device_node *np, int index,
const void *gpio_spec;
const __be32 *gpio_cells;

ret = of_parse_phandles_with_args(np, "gpios", "#gpio-cells", index,
ret = of_parse_phandles_with_args(np, propname, "#gpio-cells", index,
&gpio_np, &gpio_spec);
if (ret) {
pr_debug("%s: can't parse gpios property\n", __func__);
Expand Down Expand Up @@ -79,7 +80,7 @@ int of_get_gpio_flags(struct device_node *np, int index,
pr_debug("%s exited with status %d\n", __func__, ret);
return ret;
}
EXPORT_SYMBOL(of_get_gpio_flags);
EXPORT_SYMBOL(of_get_named_gpio_flags);

/**
* of_gpio_count - Count GPIOs for a device
Expand Down
42 changes: 37 additions & 5 deletions trunk/include/linux/of_gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc)
return container_of(gc, struct of_mm_gpio_chip, gc);
}

extern int of_get_gpio_flags(struct device_node *np, int index,
enum of_gpio_flags *flags);
extern int of_get_named_gpio_flags(struct device_node *np,
const char *list_name, int index, enum of_gpio_flags *flags);

extern unsigned int of_gpio_count(struct device_node *np);

extern int of_mm_gpiochip_add(struct device_node *np,
Expand All @@ -60,8 +61,8 @@ extern struct gpio_chip *of_node_to_gpiochip(struct device_node *np);
#else /* CONFIG_OF_GPIO */

/* Drivers may not strictly depend on the GPIO support, so let them link. */
static inline int of_get_gpio_flags(struct device_node *np, int index,
enum of_gpio_flags *flags)
static inline int of_get_named_gpio_flags(struct device_node *np,
const char *list_name, int index, enum of_gpio_flags *flags)
{
return -ENOSYS;
}
Expand All @@ -77,7 +78,38 @@ static inline void of_gpiochip_remove(struct gpio_chip *gc) { }
#endif /* CONFIG_OF_GPIO */

/**
* of_get_gpio - Get a GPIO number to use with GPIO API
* of_get_gpio_flags() - Get a GPIO number and flags to use with GPIO API
* @np: device node to get GPIO from
* @index: index of the GPIO
* @flags: a flags pointer to fill in
*
* Returns GPIO number to use with Linux generic GPIO API, or one of the errno
* value on the error condition. If @flags is not NULL the function also fills
* in flags for the GPIO.
*/
static inline int of_get_gpio_flags(struct device_node *np, int index,
enum of_gpio_flags *flags)
{
return of_get_named_gpio_flags(np, "gpios", index, flags);
}

/**
* of_get_named_gpio() - Get a GPIO number to use with GPIO API
* @np: device node to get GPIO from
* @propname: Name of property containing gpio specifier(s)
* @index: index of the GPIO
*
* Returns GPIO number to use with Linux generic GPIO API, or one of the errno
* value on the error condition.
*/
static inline int of_get_named_gpio(struct device_node *np,
const char *propname, int index)
{
return of_get_named_gpio_flags(np, propname, index, NULL);
}

/**
* of_get_gpio() - Get a GPIO number to use with GPIO API
* @np: device node to get GPIO from
* @index: index of the GPIO
*
Expand Down

0 comments on commit 979e91c

Please sign in to comment.