~ubuntu-branches/debian/experimental/linux-tools/experimental

« back to all changes in this revision

Viewing changes to include/linux/of_gpio.h

  • Committer: Package Import Robot
  • Author(s): Ben Hutchings
  • Date: 2014-02-02 16:57:49 UTC
  • mfrom: (1.1.10) (0.1.21 sid)
  • Revision ID: package-import@ubuntu.com-20140202165749-tw94o9t1t0a8txk6
Tags: 3.13-1~exp2
Merge changes from sid up to 3.12.6-3

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include <linux/errno.h>
20
20
#include <linux/gpio.h>
21
21
#include <linux/of.h>
 
22
#include <linux/gpio/consumer.h>
22
23
 
23
24
struct device_node;
24
25
 
47
48
        return container_of(gc, struct of_mm_gpio_chip, gc);
48
49
}
49
50
 
50
 
extern int of_get_named_gpio_flags(struct device_node *np,
 
51
extern struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np,
51
52
                const char *list_name, int index, enum of_gpio_flags *flags);
52
53
 
53
54
extern int of_mm_gpiochip_add(struct device_node *np,
62
63
#else /* CONFIG_OF_GPIO */
63
64
 
64
65
/* Drivers may not strictly depend on the GPIO support, so let them link. */
65
 
static inline int of_get_named_gpio_flags(struct device_node *np,
 
66
static inline struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np,
66
67
                const char *list_name, int index, enum of_gpio_flags *flags)
67
68
{
68
 
        return -ENOSYS;
 
69
        return ERR_PTR(-ENOSYS);
69
70
}
70
71
 
71
72
static inline int of_gpio_simple_xlate(struct gpio_chip *gc,
80
81
 
81
82
#endif /* CONFIG_OF_GPIO */
82
83
 
 
84
static inline int of_get_named_gpio_flags(struct device_node *np,
 
85
                const char *list_name, int index, enum of_gpio_flags *flags)
 
86
{
 
87
        struct gpio_desc *desc;
 
88
        desc = of_get_named_gpiod_flags(np, list_name, index, flags);
 
89
 
 
90
        if (IS_ERR(desc))
 
91
                return PTR_ERR(desc);
 
92
        else
 
93
                return desc_to_gpio(desc);
 
94
}
 
95
 
83
96
/**
84
97
 * of_gpio_named_count() - Count GPIOs for a device
85
98
 * @np:         device node to count GPIOs for
117
130
}
118
131
 
119
132
/**
120
 
 * of_get_gpio_flags() - Get a GPIO number and flags to use with GPIO API
 
133
 * of_get_gpiod_flags() - Get a GPIO descriptor and flags to use with GPIO API
121
134
 * @np:         device node to get GPIO from
122
135
 * @index:      index of the GPIO
123
136
 * @flags:      a flags pointer to fill in
124
137
 *
125
 
 * Returns GPIO number to use with Linux generic GPIO API, or one of the errno
 
138
 * Returns GPIO descriptor to use with Linux generic GPIO API, or a errno
126
139
 * value on the error condition. If @flags is not NULL the function also fills
127
140
 * in flags for the GPIO.
128
141
 */
 
142
static inline struct gpio_desc *of_get_gpiod_flags(struct device_node *np,
 
143
                                        int index, enum of_gpio_flags *flags)
 
144
{
 
145
        return of_get_named_gpiod_flags(np, "gpios", index, flags);
 
146
}
 
147
 
129
148
static inline int of_get_gpio_flags(struct device_node *np, int index,
130
149
                      enum of_gpio_flags *flags)
131
150
{