aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-24 17:01:46 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-24 17:01:46 -0400
commitb1bf7d4d1b3911352cf1ec63c1de06214288ccd0 (patch)
tree0fd27c638977cb5c7e6e3f95085ce842b57a4ae3 /include/linux
parent0708500d49e8439d9fe5529795bdc1485f0f46c3 (diff)
parent3e11f7b840b4671213c66817294ad7dd0b572756 (diff)
Merge tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux-2.6
Pull GPIO driver changes from Grant Likely: "Lots of gpio changes, both to core code and drivers. Changes do touch architecture code to remove the need for separate arm/gpio.h includes in most architectures. Some new drivers are added, and a number of gpio drivers are converted to use irq_domains for gpio inputs used as interrupts. Device tree support has been amended to allow multiple gpio_chips to use the same device tree node. Remaining changes are primarily bug fixes." * tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux-2.6: (33 commits) gpio/generic: initialize basic_mmio_gpio shadow variables properly gpiolib: Remove 'const' from data argument of gpiochip_find() gpio/rc5t583: add gpio driver for RICOH PMIC RC5T583 gpiolib: quiet gpiochip_add boot message noise gpio: mpc8xxx: Prevent NULL pointer deref in demux handler gpio/lpc32xx: Add device tree support gpio: Adjust of_xlate API to support multiple GPIO chips gpiolib: Implement devm_gpio_request_one() gpio-mcp23s08: dbg_show: fix pullup configuration display Add support for TCA6424A gpio/omap: (re)fix wakeups on level-triggered GPIOs gpio/omap: fix broken context restore for non-OFF mode transitions gpio/omap: fix missing check in *_runtime_suspend() gpio/omap: remove cpu_is_omapxxxx() checks from *_runtime_resume() gpio/omap: remove suspend/resume callbacks gpio/omap: remove retrigger variable in gpio_irq_handler gpio/omap: remove saved_wakeup field from struct gpio_bank gpio/omap: remove suspend_wakeup field from struct gpio_bank gpio/omap: remove saved_fallingdetect, saved_risingdetect gpio/omap: remove virtual_irq_start variable ... Conflicts: drivers/gpio/gpio-samsung.c
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/basic_mmio_gpio.h6
-rw-r--r--include/linux/gpio.h59
-rw-r--r--include/linux/mfd/rc5t583.h2
-rw-r--r--include/linux/of_gpio.h1
4 files changed, 66 insertions, 2 deletions
diff --git a/include/linux/basic_mmio_gpio.h b/include/linux/basic_mmio_gpio.h
index feb91219674..1c504ca5bdb 100644
--- a/include/linux/basic_mmio_gpio.h
+++ b/include/linux/basic_mmio_gpio.h
@@ -67,6 +67,10 @@ int bgpio_remove(struct bgpio_chip *bgc);
67int bgpio_init(struct bgpio_chip *bgc, struct device *dev, 67int bgpio_init(struct bgpio_chip *bgc, struct device *dev,
68 unsigned long sz, void __iomem *dat, void __iomem *set, 68 unsigned long sz, void __iomem *dat, void __iomem *set,
69 void __iomem *clr, void __iomem *dirout, void __iomem *dirin, 69 void __iomem *clr, void __iomem *dirout, void __iomem *dirin,
70 bool big_endian); 70 unsigned long flags);
71
72#define BGPIOF_BIG_ENDIAN BIT(0)
73#define BGPIOF_UNREADABLE_REG_SET BIT(1) /* reg_set is unreadable */
74#define BGPIOF_UNREADABLE_REG_DIR BIT(2) /* reg_dir is unreadable */
71 75
72#endif /* __BASIC_MMIO_GPIO_H */ 76#endif /* __BASIC_MMIO_GPIO_H */
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 6155ecf192b..f07fc2d0815 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_GPIO_H 1#ifndef __LINUX_GPIO_H
2#define __LINUX_GPIO_H 2#define __LINUX_GPIO_H
3 3
4#include <linux/errno.h>
5
4/* see Documentation/gpio.txt */ 6/* see Documentation/gpio.txt */
5 7
6/* make these flag values available regardless of GPIO kconfig options */ 8/* make these flag values available regardless of GPIO kconfig options */
@@ -20,6 +22,11 @@
20/* Gpio pin is open source */ 22/* Gpio pin is open source */
21#define GPIOF_OPEN_SOURCE (1 << 3) 23#define GPIOF_OPEN_SOURCE (1 << 3)
22 24
25#define GPIOF_EXPORT (1 << 2)
26#define GPIOF_EXPORT_CHANGEABLE (1 << 3)
27#define GPIOF_EXPORT_DIR_FIXED (GPIOF_EXPORT)
28#define GPIOF_EXPORT_DIR_CHANGEABLE (GPIOF_EXPORT | GPIOF_EXPORT_CHANGEABLE)
29
23/** 30/**
24 * struct gpio - a structure describing a GPIO with configuration 31 * struct gpio - a structure describing a GPIO with configuration
25 * @gpio: the GPIO number 32 * @gpio: the GPIO number
@@ -33,7 +40,39 @@ struct gpio {
33}; 40};
34 41
35#ifdef CONFIG_GENERIC_GPIO 42#ifdef CONFIG_GENERIC_GPIO
43
44#ifdef CONFIG_ARCH_HAVE_CUSTOM_GPIO_H
36#include <asm/gpio.h> 45#include <asm/gpio.h>
46#else
47
48#include <asm-generic/gpio.h>
49
50static inline int gpio_get_value(unsigned int gpio)
51{
52 return __gpio_get_value(gpio);
53}
54
55static inline void gpio_set_value(unsigned int gpio, int value)
56{
57 __gpio_set_value(gpio, value);
58}
59
60static inline int gpio_cansleep(unsigned int gpio)
61{
62 return __gpio_cansleep(gpio);
63}
64
65static inline int gpio_to_irq(unsigned int gpio)
66{
67 return __gpio_to_irq(gpio);
68}
69
70static inline int irq_to_gpio(unsigned int irq)
71{
72 return -EINVAL;
73}
74
75#endif
37 76
38#else 77#else
39 78
@@ -55,12 +94,24 @@ static inline int gpio_request(unsigned gpio, const char *label)
55 return -ENOSYS; 94 return -ENOSYS;
56} 95}
57 96
97static inline int devm_gpio_request(struct device *dev, unsigned gpio,
98 const char *label)
99{
100 return -ENOSYS;
101}
102
58static inline int gpio_request_one(unsigned gpio, 103static inline int gpio_request_one(unsigned gpio,
59 unsigned long flags, const char *label) 104 unsigned long flags, const char *label)
60{ 105{
61 return -ENOSYS; 106 return -ENOSYS;
62} 107}
63 108
109static inline int devm_gpio_request_one(struct device *dev, unsigned gpio,
110 unsigned long flags, const char *label)
111{
112 return -ENOSYS;
113}
114
64static inline int gpio_request_array(const struct gpio *array, size_t num) 115static inline int gpio_request_array(const struct gpio *array, size_t num)
65{ 116{
66 return -ENOSYS; 117 return -ENOSYS;
@@ -74,6 +125,14 @@ static inline void gpio_free(unsigned gpio)
74 WARN_ON(1); 125 WARN_ON(1);
75} 126}
76 127
128static inline void devm_gpio_free(struct device *dev, unsigned gpio)
129{
130 might_sleep();
131
132 /* GPIO can never have been requested */
133 WARN_ON(1);
134}
135
77static inline void gpio_free_array(const struct gpio *array, size_t num) 136static inline void gpio_free_array(const struct gpio *array, size_t num)
78{ 137{
79 might_sleep(); 138 might_sleep();
diff --git a/include/linux/mfd/rc5t583.h b/include/linux/mfd/rc5t583.h
index c42fe92a727..3661c59aa1e 100644
--- a/include/linux/mfd/rc5t583.h
+++ b/include/linux/mfd/rc5t583.h
@@ -292,6 +292,7 @@ struct rc5t583 {
292 * rc5t583_platform_data: Platform data for ricoh rc5t583 pmu. 292 * rc5t583_platform_data: Platform data for ricoh rc5t583 pmu.
293 * The board specific data is provided through this structure. 293 * The board specific data is provided through this structure.
294 * @irq_base: Irq base number on which this device registers their interrupts. 294 * @irq_base: Irq base number on which this device registers their interrupts.
295 * @gpio_base: GPIO base from which gpio of this device will start.
295 * @enable_shutdown: Enable shutdown through the input pin "shutdown". 296 * @enable_shutdown: Enable shutdown through the input pin "shutdown".
296 * @regulator_deepsleep_slot: The slot number on which device goes to sleep 297 * @regulator_deepsleep_slot: The slot number on which device goes to sleep
297 * in device sleep mode. 298 * in device sleep mode.
@@ -303,6 +304,7 @@ struct rc5t583 {
303 304
304struct rc5t583_platform_data { 305struct rc5t583_platform_data {
305 int irq_base; 306 int irq_base;
307 int gpio_base;
306 bool enable_shutdown; 308 bool enable_shutdown;
307 int regulator_deepsleep_slot[RC5T583_REGULATOR_MAX]; 309 int regulator_deepsleep_slot[RC5T583_REGULATOR_MAX];
308 unsigned long regulator_ext_pwr_control[RC5T583_REGULATOR_MAX]; 310 unsigned long regulator_ext_pwr_control[RC5T583_REGULATOR_MAX];
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index 81733d12cbe..c454f579674 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -58,7 +58,6 @@ extern int of_mm_gpiochip_add(struct device_node *np,
58 58
59extern void of_gpiochip_add(struct gpio_chip *gc); 59extern void of_gpiochip_add(struct gpio_chip *gc);
60extern void of_gpiochip_remove(struct gpio_chip *gc); 60extern void of_gpiochip_remove(struct gpio_chip *gc);
61extern struct gpio_chip *of_node_to_gpiochip(struct device_node *np);
62extern int of_gpio_simple_xlate(struct gpio_chip *gc, 61extern int of_gpio_simple_xlate(struct gpio_chip *gc,
63 const struct of_phandle_args *gpiospec, 62 const struct of_phandle_args *gpiospec,
64 u32 *flags); 63 u32 *flags);