aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-09-04 13:07:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-04 13:07:45 -0400
commit8d2faea672606827c2018143ec7d88c760f2d6de (patch)
treeca92a524910afbd68b87a800fba64ad93abf5d67 /include/linux
parent02cf1da2548d318ad4db9eb4cf8656e24b11aefc (diff)
parent01e2dae991771adb1257eb5cd3cecfda1aa09ba9 (diff)
Merge tag 'gpio-v4.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO updates from Linus Walleij: "This is the bulk of GPIO changes for the v4.3 kernel cycle. There is quite a lot going on in the GPIO subsystem this merge window, so the main matter is decribed below. The hits in other subsystems when making the GPIO flags optional are all ACKed by their respective subsystem maintainers. Core changes: - Root out the wrapper devm_gpiod_get() and gpiod_get() etc versions of the descriptor calls that did not use the flags argument on the end. This was around for too long and eventually Uwe Kleine-König took the time to clean it out and the last users are removed along with the macros in this tag. In several cases the use of flags simplifies the code. For this reason we have (ACKed) patches hitting in DRM, IIO, media, NFC, USB+PHY up until we hammer in the nail with removing the macros. - Add a fat document describing how much ready-made GPIO stuff we have i the kernel to discourage people from reinventing a square wheel in userspace, as so often happens. - Create a separate lockdep class for each instance of a GPIO IRQ chip instead of using one class for all chips, as the current code will not work with systems with several GPIO chips doing lockdep debugging. - Protect against driver unloading also when a GPIO line is only used as IRQ for the GPIOLIB_IRQCHIP helpers. - If the GPIO chip has no designated owner, assign the parent device driver owner as owner. - Consolidation of chained IRQ handler install/remove replacing all call sites where irq_set_handler_data() and irq_set_chained_handler() were done in succession with a combined call to irq_set_chained_handler_and_data(). This series was created by Thomas Gleixner after the problem was observed by Russell King. - Tglx also made another series of patches switching __irq_set_handler_locked() for irq_set_handler_locked() which is way cleaner. - Tglx and Jiang Liu wrote a good bunch of patches to make use of irq_desc_get_xxx() accessors and avoid looking up irq_descs from IRQ numbers. The goal is to get rid of the irq number from the handlers in the IRQ flow which is nice. - Rob Herring killed off the set_irq_flags() for all GPIO drivers. This was an ARM specific function that is replaced with the generic irq_modify_status() where special flags are actually needed. - When an OF node has a pin range for its GPIOs, return -EPROBE_DEFER if the pin controller isn't available. Pretty logical, yet needed to be fixed. - If a driver using GPIOLIB_IRQCHIP has its own irq_*_resources call back, then call these instead of the defaults provided by the GPIOLIB. - Fix an undocumented ABI hole: named GPIOs were not properly documented. Driver improvements: - Add get_direction() support to the generic GPIO driver, it's strange that we didn't have that before. - Make it possible to have input-only GPIO chips using the generic GPIO driver. - Clean out platform data support from the Emma Mobile (EM) driver - Finegrained runtime PM support for the RCAR driver. - Support r8a7795 (R-car H3) in the RCAR driver. - Support interrupts on GPIOs 16 thru 31 in the DaVinci driver. - Some consolidation and new support in the MPC8xxx driver, we now support MPC5125. - Preempt-RT-friendly patches: the OMAP, MPC8xxx, drivers uses raw spinlocks making it work better with the realime patches. - Interrupt support for the EXTRAXFS GPIO driver. - Make the ETRAXFS GPIO driver support also ARTPEC-3. - Interrupt and wakeup support for the BRCMSTB driver, also for wakeup from S5 cold boot. - Mask MXC IRQs during suspend. - Improve OMAP2 GPIO set_debounce() to work according to spec. - The VF610 driver handles IRQs properly. New drivers: - ZTE ZX GPIO driver" * tag 'gpio-v4.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (87 commits) Revert "gpio: extraxfs: fix returnvar.cocci warnings" gpio: tc3589x: use static container helper gpio: xlp: fix error return code gpio: vf610: handle level IRQ's properly gpio: max732x: Fix error handling in probe() gpio: omap: fix clk_prepare/unprepare usage gpio: omap: protect regs access in omap_gpio_irq_handler gpio: omap: fix omap2_set_gpio_debounce gpio: omap: switch to use platform_get_irq gpio: omap: remove wrong irq_domain_remove usage in probe gpiolib: add description for gpio irqchip fields in struct gpio_chip gpio: extraxfs: fix returnvar.cocci warnings gpiolib: irqchip: use different lockdep class for each gpio irqchip gpio/grgpio: fix deadlock in grgpio_irq_unmap() Documentation: gpio: consumer: describe active low property gpio: mxc: fix section mismatch warning gpio/mxc: mask gpio interrupts in suspend gpio: omap: Fix missing raw locks conversion gpio: brcmstb: support wakeup from S5 cold boot gpio: brcmstb: Add interrupt and wakeup source support ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/basic_mmio_gpio.h1
-rw-r--r--include/linux/gpio/consumer.h82
-rw-r--r--include/linux/gpio/driver.h37
-rw-r--r--include/linux/of_gpio.h4
-rw-r--r--include/linux/platform_data/gpio-em.h11
5 files changed, 58 insertions, 77 deletions
diff --git a/include/linux/basic_mmio_gpio.h b/include/linux/basic_mmio_gpio.h
index 14eea946e640..ed3768f4ecc7 100644
--- a/include/linux/basic_mmio_gpio.h
+++ b/include/linux/basic_mmio_gpio.h
@@ -75,5 +75,6 @@ int bgpio_init(struct bgpio_chip *bgc, struct device *dev,
75#define BGPIOF_UNREADABLE_REG_DIR BIT(2) /* reg_dir is unreadable */ 75#define BGPIOF_UNREADABLE_REG_DIR BIT(2) /* reg_dir is unreadable */
76#define BGPIOF_BIG_ENDIAN_BYTE_ORDER BIT(3) 76#define BGPIOF_BIG_ENDIAN_BYTE_ORDER BIT(3)
77#define BGPIOF_READ_OUTPUT_REG_SET BIT(4) /* reg_set stores output value */ 77#define BGPIOF_READ_OUTPUT_REG_SET BIT(4) /* reg_set stores output value */
78#define BGPIOF_NO_OUTPUT BIT(5) /* only input */
78 79
79#endif /* __BASIC_MMIO_GPIO_H */ 80#endif /* __BASIC_MMIO_GPIO_H */
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index adac255aee86..14cac67c2012 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -47,17 +47,17 @@ enum gpiod_flags {
47int gpiod_count(struct device *dev, const char *con_id); 47int gpiod_count(struct device *dev, const char *con_id);
48 48
49/* Acquire and dispose GPIOs */ 49/* Acquire and dispose GPIOs */
50struct gpio_desc *__must_check __gpiod_get(struct device *dev, 50struct gpio_desc *__must_check gpiod_get(struct device *dev,
51 const char *con_id, 51 const char *con_id,
52 enum gpiod_flags flags); 52 enum gpiod_flags flags);
53struct gpio_desc *__must_check __gpiod_get_index(struct device *dev, 53struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
54 const char *con_id, 54 const char *con_id,
55 unsigned int idx, 55 unsigned int idx,
56 enum gpiod_flags flags); 56 enum gpiod_flags flags);
57struct gpio_desc *__must_check __gpiod_get_optional(struct device *dev, 57struct gpio_desc *__must_check gpiod_get_optional(struct device *dev,
58 const char *con_id, 58 const char *con_id,
59 enum gpiod_flags flags); 59 enum gpiod_flags flags);
60struct gpio_desc *__must_check __gpiod_get_index_optional(struct device *dev, 60struct gpio_desc *__must_check gpiod_get_index_optional(struct device *dev,
61 const char *con_id, 61 const char *con_id,
62 unsigned int index, 62 unsigned int index,
63 enum gpiod_flags flags); 63 enum gpiod_flags flags);
@@ -70,18 +70,18 @@ struct gpio_descs *__must_check gpiod_get_array_optional(struct device *dev,
70void gpiod_put(struct gpio_desc *desc); 70void gpiod_put(struct gpio_desc *desc);
71void gpiod_put_array(struct gpio_descs *descs); 71void gpiod_put_array(struct gpio_descs *descs);
72 72
73struct gpio_desc *__must_check __devm_gpiod_get(struct device *dev, 73struct gpio_desc *__must_check devm_gpiod_get(struct device *dev,
74 const char *con_id, 74 const char *con_id,
75 enum gpiod_flags flags); 75 enum gpiod_flags flags);
76struct gpio_desc *__must_check __devm_gpiod_get_index(struct device *dev, 76struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev,
77 const char *con_id, 77 const char *con_id,
78 unsigned int idx, 78 unsigned int idx,
79 enum gpiod_flags flags); 79 enum gpiod_flags flags);
80struct gpio_desc *__must_check __devm_gpiod_get_optional(struct device *dev, 80struct gpio_desc *__must_check devm_gpiod_get_optional(struct device *dev,
81 const char *con_id, 81 const char *con_id,
82 enum gpiod_flags flags); 82 enum gpiod_flags flags);
83struct gpio_desc *__must_check 83struct gpio_desc *__must_check
84__devm_gpiod_get_index_optional(struct device *dev, const char *con_id, 84devm_gpiod_get_index_optional(struct device *dev, const char *con_id,
85 unsigned int index, enum gpiod_flags flags); 85 unsigned int index, enum gpiod_flags flags);
86struct gpio_descs *__must_check devm_gpiod_get_array(struct device *dev, 86struct gpio_descs *__must_check devm_gpiod_get_array(struct device *dev,
87 const char *con_id, 87 const char *con_id,
@@ -146,31 +146,31 @@ static inline int gpiod_count(struct device *dev, const char *con_id)
146 return 0; 146 return 0;
147} 147}
148 148
149static inline struct gpio_desc *__must_check __gpiod_get(struct device *dev, 149static inline struct gpio_desc *__must_check gpiod_get(struct device *dev,
150 const char *con_id, 150 const char *con_id,
151 enum gpiod_flags flags) 151 enum gpiod_flags flags)
152{ 152{
153 return ERR_PTR(-ENOSYS); 153 return ERR_PTR(-ENOSYS);
154} 154}
155static inline struct gpio_desc *__must_check 155static inline struct gpio_desc *__must_check
156__gpiod_get_index(struct device *dev, 156gpiod_get_index(struct device *dev,
157 const char *con_id, 157 const char *con_id,
158 unsigned int idx, 158 unsigned int idx,
159 enum gpiod_flags flags) 159 enum gpiod_flags flags)
160{ 160{
161 return ERR_PTR(-ENOSYS); 161 return ERR_PTR(-ENOSYS);
162} 162}
163 163
164static inline struct gpio_desc *__must_check 164static inline struct gpio_desc *__must_check
165__gpiod_get_optional(struct device *dev, const char *con_id, 165gpiod_get_optional(struct device *dev, const char *con_id,
166 enum gpiod_flags flags) 166 enum gpiod_flags flags)
167{ 167{
168 return ERR_PTR(-ENOSYS); 168 return ERR_PTR(-ENOSYS);
169} 169}
170 170
171static inline struct gpio_desc *__must_check 171static inline struct gpio_desc *__must_check
172__gpiod_get_index_optional(struct device *dev, const char *con_id, 172gpiod_get_index_optional(struct device *dev, const char *con_id,
173 unsigned int index, enum gpiod_flags flags) 173 unsigned int index, enum gpiod_flags flags)
174{ 174{
175 return ERR_PTR(-ENOSYS); 175 return ERR_PTR(-ENOSYS);
176} 176}
@@ -206,7 +206,7 @@ static inline void gpiod_put_array(struct gpio_descs *descs)
206} 206}
207 207
208static inline struct gpio_desc *__must_check 208static inline struct gpio_desc *__must_check
209__devm_gpiod_get(struct device *dev, 209devm_gpiod_get(struct device *dev,
210 const char *con_id, 210 const char *con_id,
211 enum gpiod_flags flags) 211 enum gpiod_flags flags)
212{ 212{
@@ -214,7 +214,7 @@ __devm_gpiod_get(struct device *dev,
214} 214}
215static inline 215static inline
216struct gpio_desc *__must_check 216struct gpio_desc *__must_check
217__devm_gpiod_get_index(struct device *dev, 217devm_gpiod_get_index(struct device *dev,
218 const char *con_id, 218 const char *con_id,
219 unsigned int idx, 219 unsigned int idx,
220 enum gpiod_flags flags) 220 enum gpiod_flags flags)
@@ -223,14 +223,14 @@ __devm_gpiod_get_index(struct device *dev,
223} 223}
224 224
225static inline struct gpio_desc *__must_check 225static inline struct gpio_desc *__must_check
226__devm_gpiod_get_optional(struct device *dev, const char *con_id, 226devm_gpiod_get_optional(struct device *dev, const char *con_id,
227 enum gpiod_flags flags) 227 enum gpiod_flags flags)
228{ 228{
229 return ERR_PTR(-ENOSYS); 229 return ERR_PTR(-ENOSYS);
230} 230}
231 231
232static inline struct gpio_desc *__must_check 232static inline struct gpio_desc *__must_check
233__devm_gpiod_get_index_optional(struct device *dev, const char *con_id, 233devm_gpiod_get_index_optional(struct device *dev, const char *con_id,
234 unsigned int index, enum gpiod_flags flags) 234 unsigned int index, enum gpiod_flags flags)
235{ 235{
236 return ERR_PTR(-ENOSYS); 236 return ERR_PTR(-ENOSYS);
@@ -424,42 +424,6 @@ static inline struct gpio_desc *devm_get_gpiod_from_child(
424 424
425#endif /* CONFIG_GPIOLIB */ 425#endif /* CONFIG_GPIOLIB */
426 426
427/*
428 * Vararg-hacks! This is done to transition the kernel to always pass
429 * the options flags argument to the below functions. During a transition
430 * phase these vararg macros make both old-and-newstyle code compile,
431 * but when all calls to the elder API are removed, these should go away
432 * and the __gpiod_get() etc functions above be renamed just gpiod_get()
433 * etc.
434 */
435#define __gpiod_get(dev, con_id, flags, ...) __gpiod_get(dev, con_id, flags)
436#define gpiod_get(varargs...) __gpiod_get(varargs, GPIOD_ASIS)
437#define __gpiod_get_index(dev, con_id, index, flags, ...) \
438 __gpiod_get_index(dev, con_id, index, flags)
439#define gpiod_get_index(varargs...) __gpiod_get_index(varargs, GPIOD_ASIS)
440#define __gpiod_get_optional(dev, con_id, flags, ...) \
441 __gpiod_get_optional(dev, con_id, flags)
442#define gpiod_get_optional(varargs...) __gpiod_get_optional(varargs, GPIOD_ASIS)
443#define __gpiod_get_index_optional(dev, con_id, index, flags, ...) \
444 __gpiod_get_index_optional(dev, con_id, index, flags)
445#define gpiod_get_index_optional(varargs...) \
446 __gpiod_get_index_optional(varargs, GPIOD_ASIS)
447#define __devm_gpiod_get(dev, con_id, flags, ...) \
448 __devm_gpiod_get(dev, con_id, flags)
449#define devm_gpiod_get(varargs...) __devm_gpiod_get(varargs, GPIOD_ASIS)
450#define __devm_gpiod_get_index(dev, con_id, index, flags, ...) \
451 __devm_gpiod_get_index(dev, con_id, index, flags)
452#define devm_gpiod_get_index(varargs...) \
453 __devm_gpiod_get_index(varargs, GPIOD_ASIS)
454#define __devm_gpiod_get_optional(dev, con_id, flags, ...) \
455 __devm_gpiod_get_optional(dev, con_id, flags)
456#define devm_gpiod_get_optional(varargs...) \
457 __devm_gpiod_get_optional(varargs, GPIOD_ASIS)
458#define __devm_gpiod_get_index_optional(dev, con_id, index, flags, ...) \
459 __devm_gpiod_get_index_optional(dev, con_id, index, flags)
460#define devm_gpiod_get_index_optional(varargs...) \
461 __devm_gpiod_get_index_optional(varargs, GPIOD_ASIS)
462
463#if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS) 427#if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS)
464 428
465int gpiod_export(struct gpio_desc *desc, bool direction_may_change); 429int gpiod_export(struct gpio_desc *desc, bool direction_may_change);
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index c8393cd4d44f..1aed31c5ffba 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -6,6 +6,7 @@
6#include <linux/irq.h> 6#include <linux/irq.h>
7#include <linux/irqchip/chained_irq.h> 7#include <linux/irqchip/chained_irq.h>
8#include <linux/irqdomain.h> 8#include <linux/irqdomain.h>
9#include <linux/lockdep.h>
9#include <linux/pinctrl/pinctrl.h> 10#include <linux/pinctrl/pinctrl.h>
10 11
11struct device; 12struct device;
@@ -64,6 +65,17 @@ struct seq_file;
64 * registers. 65 * registers.
65 * @irq_not_threaded: flag must be set if @can_sleep is set but the 66 * @irq_not_threaded: flag must be set if @can_sleep is set but the
66 * IRQs don't need to be threaded 67 * IRQs don't need to be threaded
68 * @irqchip: GPIO IRQ chip impl, provided by GPIO driver
69 * @irqdomain: Interrupt translation domain; responsible for mapping
70 * between GPIO hwirq number and linux irq number
71 * @irq_base: first linux IRQ number assigned to GPIO IRQ chip (deprecated)
72 * @irq_handler: the irq handler to use (often a predefined irq core function)
73 * for GPIO IRQs, provided by GPIO driver
74 * @irq_default_type: default IRQ triggering type applied during GPIO driver
75 * initialization, provided by GPIO driver
76 * @irq_parent: GPIO IRQ chip parent/bank linux irq number,
77 * provided by GPIO driver
78 * @lock_key: per GPIO IRQ chip lockdep class
67 * 79 *
68 * A gpio_chip can help platforms abstract various sources of GPIOs so 80 * A gpio_chip can help platforms abstract various sources of GPIOs so
69 * they can all be accessed through a common programing interface. 81 * they can all be accessed through a common programing interface.
@@ -126,6 +138,7 @@ struct gpio_chip {
126 irq_flow_handler_t irq_handler; 138 irq_flow_handler_t irq_handler;
127 unsigned int irq_default_type; 139 unsigned int irq_default_type;
128 int irq_parent; 140 int irq_parent;
141 struct lock_class_key *lock_key;
129#endif 142#endif
130 143
131#if defined(CONFIG_OF_GPIO) 144#if defined(CONFIG_OF_GPIO)
@@ -171,11 +184,25 @@ void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip,
171 int parent_irq, 184 int parent_irq,
172 irq_flow_handler_t parent_handler); 185 irq_flow_handler_t parent_handler);
173 186
174int gpiochip_irqchip_add(struct gpio_chip *gpiochip, 187int _gpiochip_irqchip_add(struct gpio_chip *gpiochip,
175 struct irq_chip *irqchip, 188 struct irq_chip *irqchip,
176 unsigned int first_irq, 189 unsigned int first_irq,
177 irq_flow_handler_t handler, 190 irq_flow_handler_t handler,
178 unsigned int type); 191 unsigned int type,
192 struct lock_class_key *lock_key);
193
194#ifdef CONFIG_LOCKDEP
195#define gpiochip_irqchip_add(...) \
196( \
197 ({ \
198 static struct lock_class_key _key; \
199 _gpiochip_irqchip_add(__VA_ARGS__, &_key); \
200 }) \
201)
202#else
203#define gpiochip_irqchip_add(...) \
204 _gpiochip_irqchip_add(__VA_ARGS__, NULL)
205#endif
179 206
180#endif /* CONFIG_GPIOLIB_IRQCHIP */ 207#endif /* CONFIG_GPIOLIB_IRQCHIP */
181 208
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index 69dbe312b11b..f3191828f037 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -54,7 +54,7 @@ extern int of_mm_gpiochip_add(struct device_node *np,
54 struct of_mm_gpio_chip *mm_gc); 54 struct of_mm_gpio_chip *mm_gc);
55extern void of_mm_gpiochip_remove(struct of_mm_gpio_chip *mm_gc); 55extern void of_mm_gpiochip_remove(struct of_mm_gpio_chip *mm_gc);
56 56
57extern void of_gpiochip_add(struct gpio_chip *gc); 57extern int of_gpiochip_add(struct gpio_chip *gc);
58extern void of_gpiochip_remove(struct gpio_chip *gc); 58extern void of_gpiochip_remove(struct gpio_chip *gc);
59extern int of_gpio_simple_xlate(struct gpio_chip *gc, 59extern int of_gpio_simple_xlate(struct gpio_chip *gc,
60 const struct of_phandle_args *gpiospec, 60 const struct of_phandle_args *gpiospec,
@@ -76,7 +76,7 @@ static inline int of_gpio_simple_xlate(struct gpio_chip *gc,
76 return -ENOSYS; 76 return -ENOSYS;
77} 77}
78 78
79static inline void of_gpiochip_add(struct gpio_chip *gc) { } 79static inline int of_gpiochip_add(struct gpio_chip *gc) { return 0; }
80static inline void of_gpiochip_remove(struct gpio_chip *gc) { } 80static inline void of_gpiochip_remove(struct gpio_chip *gc) { }
81 81
82#endif /* CONFIG_OF_GPIO */ 82#endif /* CONFIG_OF_GPIO */
diff --git a/include/linux/platform_data/gpio-em.h b/include/linux/platform_data/gpio-em.h
deleted file mode 100644
index 7c5a519d2dcd..000000000000
--- a/include/linux/platform_data/gpio-em.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef __GPIO_EM_H__
2#define __GPIO_EM_H__
3
4struct gpio_em_config {
5 unsigned int gpio_base;
6 unsigned int irq_base;
7 unsigned int number_of_pins;
8 const char *pctl_name;
9};
10
11#endif /* __GPIO_EM_H__ */