aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-08-16 00:35:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-08-16 00:35:38 -0400
commit6de4c691eab8f421e34c5250f63bf3f477d30eec (patch)
treedd3deaa163bb478b13778a712afdfccc8cf43f20 /include/linux
parentc1c2ad82c772966d3cdb9a4852329fa2cf71853a (diff)
parenta5ec96ddfd55c501d451cb310566a1170c267ecb (diff)
Merge tag 'gpio-v4.19-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.19 kernel cycle. I don't know if anything in particular stands out. Maybe the Aspeed coprocessor thing from Benji: Aspeed is doing baseboard management chips (BMC's) for servers etc. These Aspeed's are ARM processors that exist inside (I guess) Intel servers, and they are moving forward to using mainline Linux in those. This is one of the pieces of the puzzle to achive that. They are doing OpenBMC, it's pretty cool: https://lwn.net/Articles/683320/ Summary: Core changes: - Add a new API for explicitly naming GPIO consumers, when needed. - Don't let userspace set values on input lines. While we do not think anyone would do this crazy thing we better plug the hole before someone uses it and think it's a nifty feature. - Avoid calling chip->request() for unused GPIOs. New drivers/subdrivers: - The Mediatek MT7621 is supported which is a big win for OpenWRT and similar router distributions using this chip, as it seems every major router manufacturer on the planet has made products using this chip: https://wikidevi.com/wiki/MediaTek_MT7621 - The Tegra 194 is now supported. - The IT87 driver now supports IT8786E and IT8718F super-IO chips. - Add support for Rockchip RK3328 in the syscon GPIO driver. Driver changes: - Handle the get/set_multiple() properly on MMIO chips with inverted direction registers. We didn't have this problem until a new chip appear that has get/set registers AND inverted direction bits, OK now we handle it. - A patch series making more error codes percolate upward properly for different errors on gpiochip_lock_as_irq(). - Get/set multiple for the OMAP driver, accelerating these multiple line operations if possible. - A coprocessor interface for the Aspeed driver. Sometimes a few GPIO lines need to be grabbed by a co-processor for doing automated tasks, sometimes they are available as GPIO lines. By adding an explicit API in this driver we make it possible for the two line consumers to coexist. (This work was made available on the ib-aspeed branch, which may be appearing in other pull requests.) - Implemented .get_direction() and open drain in the SCH311x driver. - Continuing cleanup of included headers in GPIO drivers" * tag 'gpio-v4.19-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (80 commits) gpio: it87: Add support for IT8613 gpio: it87: add support for IT8718F Super I/O. gpiolib: Avoid calling chip->request() for unused gpios gpio: tegra: Include the right header gpio: mmio: Fix up inverted direction registers gpio: xilinx: Use the right include gpio: timberdale: Include the right header gpio: tb10x: Use the right include gpiolib: Fix of_node inconsistency gpio: vr41xx: Bail out on gpiochip_lock_as_irq() error gpio: uniphier: Bail out on gpiochip_lock_as_irq() error gpio: xgene-sb: Don't shadow error code of gpiochip_lock_as_irq() gpio: em: Don't shadow error code of gpiochip_lock_as_irq() gpio: dwapb: Don't shadow error code of gpiochip_lock_as_irq() gpio: bcm-kona: Don't shadow error code of gpiochip_lock_as_irq() gpiolib: Don't shadow error code of gpiochip_lock_as_irq() gpio: syscon: rockchip: add GRF GPIO support for rk3328 gpio: omap: Add get/set_multiple() callbacks gpio: pxa: remove set but not used variable 'gpio_offset' gpio-it87: add support for IT8786E Super I/O ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/gpio/aspeed.h15
-rw-r--r--include/linux/gpio/consumer.h14
-rw-r--r--include/linux/gpio/driver.h3
-rw-r--r--include/linux/platform_data/gpio-davinci.h3
4 files changed, 29 insertions, 6 deletions
diff --git a/include/linux/gpio/aspeed.h b/include/linux/gpio/aspeed.h
new file mode 100644
index 000000000000..1bfb3cdc86d0
--- /dev/null
+++ b/include/linux/gpio/aspeed.h
@@ -0,0 +1,15 @@
1#ifndef __GPIO_ASPEED_H
2#define __GPIO_ASPEED_H
3
4struct aspeed_gpio_copro_ops {
5 int (*request_access)(void *data);
6 int (*release_access)(void *data);
7};
8
9int aspeed_gpio_copro_grab_gpio(struct gpio_desc *desc,
10 u16 *vreg_offset, u16 *dreg_offset, u8 *bit);
11int aspeed_gpio_copro_release_gpio(struct gpio_desc *desc);
12int aspeed_gpio_copro_set_ops(const struct aspeed_gpio_copro_ops *ops, void *data);
13
14
15#endif /* __GPIO_ASPEED_H */
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index 243112c7fa7d..21ddbe440030 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -41,11 +41,8 @@ enum gpiod_flags {
41 GPIOD_OUT_LOW = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT, 41 GPIOD_OUT_LOW = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT,
42 GPIOD_OUT_HIGH = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT | 42 GPIOD_OUT_HIGH = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT |
43 GPIOD_FLAGS_BIT_DIR_VAL, 43 GPIOD_FLAGS_BIT_DIR_VAL,
44 GPIOD_OUT_LOW_OPEN_DRAIN = GPIOD_FLAGS_BIT_DIR_SET | 44 GPIOD_OUT_LOW_OPEN_DRAIN = GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_OPEN_DRAIN,
45 GPIOD_FLAGS_BIT_DIR_OUT | GPIOD_FLAGS_BIT_OPEN_DRAIN, 45 GPIOD_OUT_HIGH_OPEN_DRAIN = GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_OPEN_DRAIN,
46 GPIOD_OUT_HIGH_OPEN_DRAIN = GPIOD_FLAGS_BIT_DIR_SET |
47 GPIOD_FLAGS_BIT_DIR_OUT | GPIOD_FLAGS_BIT_DIR_VAL |
48 GPIOD_FLAGS_BIT_OPEN_DRAIN,
49}; 46};
50 47
51#ifdef CONFIG_GPIOLIB 48#ifdef CONFIG_GPIOLIB
@@ -145,6 +142,7 @@ int gpiod_is_active_low(const struct gpio_desc *desc);
145int gpiod_cansleep(const struct gpio_desc *desc); 142int gpiod_cansleep(const struct gpio_desc *desc);
146 143
147int gpiod_to_irq(const struct gpio_desc *desc); 144int gpiod_to_irq(const struct gpio_desc *desc);
145void gpiod_set_consumer_name(struct gpio_desc *desc, const char *name);
148 146
149/* Convert between the old gpio_ and new gpiod_ interfaces */ 147/* Convert between the old gpio_ and new gpiod_ interfaces */
150struct gpio_desc *gpio_to_desc(unsigned gpio); 148struct gpio_desc *gpio_to_desc(unsigned gpio);
@@ -467,6 +465,12 @@ static inline int gpiod_to_irq(const struct gpio_desc *desc)
467 return -EINVAL; 465 return -EINVAL;
468} 466}
469 467
468static inline void gpiod_set_consumer_name(struct gpio_desc *desc, const char *name)
469{
470 /* GPIO can never have been requested */
471 WARN_ON(1);
472}
473
470static inline struct gpio_desc *gpio_to_desc(unsigned gpio) 474static inline struct gpio_desc *gpio_to_desc(unsigned gpio)
471{ 475{
472 return ERR_PTR(-EINVAL); 476 return ERR_PTR(-EINVAL);
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 5382b5183b7e..0ea328e71ec9 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -201,6 +201,8 @@ static inline struct gpio_irq_chip *to_gpio_irq_chip(struct irq_chip *chip)
201 * @reg_set: output set register (out=high) for generic GPIO 201 * @reg_set: output set register (out=high) for generic GPIO
202 * @reg_clr: output clear register (out=low) for generic GPIO 202 * @reg_clr: output clear register (out=low) for generic GPIO
203 * @reg_dir: direction setting register for generic GPIO 203 * @reg_dir: direction setting register for generic GPIO
204 * @bgpio_dir_inverted: indicates that the direction register is inverted
205 * (gpiolib private state variable)
204 * @bgpio_bits: number of register bits used for a generic GPIO i.e. 206 * @bgpio_bits: number of register bits used for a generic GPIO i.e.
205 * <register width> * 8 207 * <register width> * 8
206 * @bgpio_lock: used to lock chip->bgpio_data. Also, this is needed to keep 208 * @bgpio_lock: used to lock chip->bgpio_data. Also, this is needed to keep
@@ -267,6 +269,7 @@ struct gpio_chip {
267 void __iomem *reg_set; 269 void __iomem *reg_set;
268 void __iomem *reg_clr; 270 void __iomem *reg_clr;
269 void __iomem *reg_dir; 271 void __iomem *reg_dir;
272 bool bgpio_dir_inverted;
270 int bgpio_bits; 273 int bgpio_bits;
271 spinlock_t bgpio_lock; 274 spinlock_t bgpio_lock;
272 unsigned long bgpio_data; 275 unsigned long bgpio_data;
diff --git a/include/linux/platform_data/gpio-davinci.h b/include/linux/platform_data/gpio-davinci.h
index 90ae19ca828f..57a5a35e0073 100644
--- a/include/linux/platform_data/gpio-davinci.h
+++ b/include/linux/platform_data/gpio-davinci.h
@@ -22,6 +22,7 @@
22#include <asm-generic/gpio.h> 22#include <asm-generic/gpio.h>
23 23
24#define MAX_REGS_BANKS 5 24#define MAX_REGS_BANKS 5
25#define MAX_INT_PER_BANK 32
25 26
26struct davinci_gpio_platform_data { 27struct davinci_gpio_platform_data {
27 u32 ngpio; 28 u32 ngpio;
@@ -41,7 +42,7 @@ struct davinci_gpio_controller {
41 spinlock_t lock; 42 spinlock_t lock;
42 void __iomem *regs[MAX_REGS_BANKS]; 43 void __iomem *regs[MAX_REGS_BANKS];
43 int gpio_unbanked; 44 int gpio_unbanked;
44 unsigned int base_irq; 45 int irqs[MAX_INT_PER_BANK];
45 unsigned int base; 46 unsigned int base;
46}; 47};
47 48