aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-01-31 15:25:27 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-01-31 15:25:27 -0500
commit9798f5178f5791f964562eccedcf4dabe02fd825 (patch)
treed0d76b4202eaa3d3be3aaa05206e57e02e16ac5b /include/linux
parent50081e437872e68300750068754f21d0faac5d86 (diff)
parentd58f2bf261fdf3a3fc916c9999a686f959dcf6b6 (diff)
Merge tag 'gpio-v4.16-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO updates from Linus Walleij: "The is the bulk of GPIO changes for the v4.16 kernel cycle. It is pretty calm this time around I think. I even got time to get to things like starting to clean up header includes. Core changes: - Disallow open drain and open source flags to be set simultaneously. This doesn't make electrical sense, and would the hardware actually respond to this setting, the result would be short circuit. - ACPI GPIO has a new core infrastructure for handling quirks. The quirks are there to deal with broken ACPI tables centrally instead of pushing the work to individual drivers. In the world of BIOS writers, the ACPI tables are perfect. Until they find a mistake in it. When such a mistake is found, we can patch it with a quirk. It should never happen, the problem is that it happens. So we accomodate for it. - Several documentation updates. - Revert the patch setting up initial direction state from reading the device. This was causing bad things for drivers that can't read status on all its pins. It is only affecting debugfs information quality. - Label descriptors with the device name if no explicit label is passed in. - Pave the ground for transitioning SPI and regulators to use GPIO descriptors by implementing some quirks in the device tree GPIO parsing code. New drivers: - New driver for the Access PCIe IDIO 24 family. Other: - Major refactorings and improvements to the GPIO mockup driver used for test and verification. - Moved the AXP209 driver over to pin control since it gained a pin control back-end. These patches will appear (with the same hashes) in the pin control pull request as well. - Convert the onewire GPIO driver w1-gpio to use descriptors. This is merged here since the W1 maintainers send very few pull requests and he ACKed it. - Start to clean up driver headers using <linux/gpio.h> to just use <linux/gpio/driver.h> as appropriate" * tag 'gpio-v4.16-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (103 commits) gpio: Timestamp events in hardirq handler gpio: Fix kernel stack leak to userspace gpio: Fix a documentation spelling mistake gpio: Documentation update gpiolib: remove redundant initialization of pointer desc gpio: of: Fix NPE from OF flags gpio: stmpe: Delete an unnecessary variable initialisation in stmpe_gpio_probe() gpio: stmpe: Move an assignment in stmpe_gpio_probe() gpio: stmpe: Improve a size determination in stmpe_gpio_probe() gpio: stmpe: Use seq_putc() in stmpe_dbg_show() gpio: No NULL owner gpio: stmpe: i2c transfer are forbiden in atomic context gpio: davinci: Include proper header gpio: da905x: Include proper header gpio: cs5535: Include proper header gpio: crystalcove: Include proper header gpio: bt8xx: Include proper header gpio: bcm-kona: Include proper header gpio: arizona: Include proper header gpio: amd8111: Include proper header ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/acpi.h5
-rw-r--r--include/linux/device.h3
-rw-r--r--include/linux/gpio.h10
-rw-r--r--include/linux/gpio/consumer.h25
-rw-r--r--include/linux/gpio/driver.h3
-rw-r--r--include/linux/gpio/machine.h4
-rw-r--r--include/linux/of_gpio.h2
-rw-r--r--include/linux/pinctrl/pinconf-generic.h2
-rw-r--r--include/linux/w1-gpio.h9
9 files changed, 55 insertions, 8 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index a933f87ef98d..f0ea50ba0550 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -991,6 +991,11 @@ struct acpi_gpio_mapping {
991 const char *name; 991 const char *name;
992 const struct acpi_gpio_params *data; 992 const struct acpi_gpio_params *data;
993 unsigned int size; 993 unsigned int size;
994
995/* Ignore IoRestriction field */
996#define ACPI_GPIO_QUIRK_NO_IO_RESTRICTION BIT(0)
997
998 unsigned int quirks;
994}; 999};
995 1000
996#if defined(CONFIG_ACPI) && defined(CONFIG_GPIOLIB) 1001#if defined(CONFIG_ACPI) && defined(CONFIG_GPIOLIB)
diff --git a/include/linux/device.h b/include/linux/device.h
index 9d32000725da..46ac622e5c6f 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -575,6 +575,9 @@ ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
575 575
576#define DEVICE_ATTR(_name, _mode, _show, _store) \ 576#define DEVICE_ATTR(_name, _mode, _show, _store) \
577 struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) 577 struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
578#define DEVICE_ATTR_PREALLOC(_name, _mode, _show, _store) \
579 struct device_attribute dev_attr_##_name = \
580 __ATTR_PREALLOC(_name, _mode, _show, _store)
578#define DEVICE_ATTR_RW(_name) \ 581#define DEVICE_ATTR_RW(_name) \
579 struct device_attribute dev_attr_##_name = __ATTR_RW(_name) 582 struct device_attribute dev_attr_##_name = __ATTR_RW(_name)
580#define DEVICE_ATTR_RO(_name) \ 583#define DEVICE_ATTR_RO(_name) \
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 8ef7fc0ce0f0..91ed23468530 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -1,4 +1,14 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * <linux/gpio.h>
4 *
5 * This is the LEGACY GPIO bulk include file, including legacy APIs. It is
6 * used for GPIO drivers still referencing the global GPIO numberspace,
7 * and should not be included in new code.
8 *
9 * If you're implementing a GPIO driver, only include <linux/gpio/driver.h>
10 * If you're implementing a GPIO consumer, only include <linux/gpio/consumer.h>
11 */
2#ifndef __LINUX_GPIO_H 12#ifndef __LINUX_GPIO_H
3#define __LINUX_GPIO_H 13#define __LINUX_GPIO_H
4 14
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index 7447d85dbe2f..dbd065963296 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -139,6 +139,7 @@ void gpiod_set_raw_array_value_cansleep(unsigned int array_size,
139 int *value_array); 139 int *value_array);
140 140
141int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce); 141int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce);
142int gpiod_set_transitory(struct gpio_desc *desc, bool transitory);
142 143
143int gpiod_is_active_low(const struct gpio_desc *desc); 144int gpiod_is_active_low(const struct gpio_desc *desc);
144int gpiod_cansleep(const struct gpio_desc *desc); 145int gpiod_cansleep(const struct gpio_desc *desc);
@@ -150,8 +151,14 @@ struct gpio_desc *gpio_to_desc(unsigned gpio);
150int desc_to_gpio(const struct gpio_desc *desc); 151int desc_to_gpio(const struct gpio_desc *desc);
151 152
152/* Child properties interface */ 153/* Child properties interface */
154struct device_node;
153struct fwnode_handle; 155struct fwnode_handle;
154 156
157struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev,
158 struct device_node *node,
159 const char *propname, int index,
160 enum gpiod_flags dflags,
161 const char *label);
155struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, 162struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
156 const char *propname, int index, 163 const char *propname, int index,
157 enum gpiod_flags dflags, 164 enum gpiod_flags dflags,
@@ -431,6 +438,13 @@ static inline int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce)
431 return -ENOSYS; 438 return -ENOSYS;
432} 439}
433 440
441static inline int gpiod_set_transitory(struct gpio_desc *desc, bool transitory)
442{
443 /* GPIO can never have been requested */
444 WARN_ON(1);
445 return -ENOSYS;
446}
447
434static inline int gpiod_is_active_low(const struct gpio_desc *desc) 448static inline int gpiod_is_active_low(const struct gpio_desc *desc)
435{ 449{
436 /* GPIO can never have been requested */ 450 /* GPIO can never have been requested */
@@ -464,9 +478,20 @@ static inline int desc_to_gpio(const struct gpio_desc *desc)
464} 478}
465 479
466/* Child properties interface */ 480/* Child properties interface */
481struct device_node;
467struct fwnode_handle; 482struct fwnode_handle;
468 483
469static inline 484static inline
485struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev,
486 struct device_node *node,
487 const char *propname, int index,
488 enum gpiod_flags dflags,
489 const char *label)
490{
491 return ERR_PTR(-ENOSYS);
492}
493
494static inline
470struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, 495struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
471 const char *propname, int index, 496 const char *propname, int index,
472 enum gpiod_flags dflags, 497 enum gpiod_flags dflags,
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 7258cd676df4..1ba9a331ec51 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -436,6 +436,9 @@ int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip,
436 struct lock_class_key *lock_key, 436 struct lock_class_key *lock_key,
437 struct lock_class_key *request_key); 437 struct lock_class_key *request_key);
438 438
439bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gpiochip,
440 unsigned int offset);
441
439#ifdef CONFIG_LOCKDEP 442#ifdef CONFIG_LOCKDEP
440 443
441/* 444/*
diff --git a/include/linux/gpio/machine.h b/include/linux/gpio/machine.h
index 846be7c69a52..b2f2dc638463 100644
--- a/include/linux/gpio/machine.h
+++ b/include/linux/gpio/machine.h
@@ -10,8 +10,8 @@ enum gpio_lookup_flags {
10 GPIO_ACTIVE_LOW = (1 << 0), 10 GPIO_ACTIVE_LOW = (1 << 0),
11 GPIO_OPEN_DRAIN = (1 << 1), 11 GPIO_OPEN_DRAIN = (1 << 1),
12 GPIO_OPEN_SOURCE = (1 << 2), 12 GPIO_OPEN_SOURCE = (1 << 2),
13 GPIO_SLEEP_MAINTAIN_VALUE = (0 << 3), 13 GPIO_PERSISTENT = (0 << 3),
14 GPIO_SLEEP_MAY_LOSE_VALUE = (1 << 3), 14 GPIO_TRANSITORY = (1 << 3),
15}; 15};
16 16
17/** 17/**
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index 1fe205582111..18a7f03e1182 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -31,7 +31,7 @@ enum of_gpio_flags {
31 OF_GPIO_ACTIVE_LOW = 0x1, 31 OF_GPIO_ACTIVE_LOW = 0x1,
32 OF_GPIO_SINGLE_ENDED = 0x2, 32 OF_GPIO_SINGLE_ENDED = 0x2,
33 OF_GPIO_OPEN_DRAIN = 0x4, 33 OF_GPIO_OPEN_DRAIN = 0x4,
34 OF_GPIO_SLEEP_MAY_LOSE_VALUE = 0x8, 34 OF_GPIO_TRANSITORY = 0x8,
35}; 35};
36 36
37#ifdef CONFIG_OF_GPIO 37#ifdef CONFIG_OF_GPIO
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h
index ec6dadcc1fde..6c0680641108 100644
--- a/include/linux/pinctrl/pinconf-generic.h
+++ b/include/linux/pinctrl/pinconf-generic.h
@@ -94,6 +94,7 @@
94 * or latch delay (on outputs) this parameter (in a custom format) 94 * or latch delay (on outputs) this parameter (in a custom format)
95 * specifies the clock skew or latch delay. It typically controls how 95 * specifies the clock skew or latch delay. It typically controls how
96 * many double inverters are put in front of the line. 96 * many double inverters are put in front of the line.
97 * @PIN_CONFIG_PERSIST_STATE: retain pin state across sleep or controller reset
97 * @PIN_CONFIG_END: this is the last enumerator for pin configurations, if 98 * @PIN_CONFIG_END: this is the last enumerator for pin configurations, if
98 * you need to pass in custom configurations to the pin controller, use 99 * you need to pass in custom configurations to the pin controller, use
99 * PIN_CONFIG_END+1 as the base offset. 100 * PIN_CONFIG_END+1 as the base offset.
@@ -122,6 +123,7 @@ enum pin_config_param {
122 PIN_CONFIG_SLEEP_HARDWARE_STATE, 123 PIN_CONFIG_SLEEP_HARDWARE_STATE,
123 PIN_CONFIG_SLEW_RATE, 124 PIN_CONFIG_SLEW_RATE,
124 PIN_CONFIG_SKEW_DELAY, 125 PIN_CONFIG_SKEW_DELAY,
126 PIN_CONFIG_PERSIST_STATE,
125 PIN_CONFIG_END = 0x7F, 127 PIN_CONFIG_END = 0x7F,
126 PIN_CONFIG_MAX = 0xFF, 128 PIN_CONFIG_MAX = 0xFF,
127}; 129};
diff --git a/include/linux/w1-gpio.h b/include/linux/w1-gpio.h
index d58594a32324..78901ecd2f95 100644
--- a/include/linux/w1-gpio.h
+++ b/include/linux/w1-gpio.h
@@ -10,16 +10,15 @@
10#ifndef _LINUX_W1_GPIO_H 10#ifndef _LINUX_W1_GPIO_H
11#define _LINUX_W1_GPIO_H 11#define _LINUX_W1_GPIO_H
12 12
13struct gpio_desc;
14
13/** 15/**
14 * struct w1_gpio_platform_data - Platform-dependent data for w1-gpio 16 * struct w1_gpio_platform_data - Platform-dependent data for w1-gpio
15 * @pin: GPIO pin to use
16 * @is_open_drain: GPIO pin is configured as open drain
17 */ 17 */
18struct w1_gpio_platform_data { 18struct w1_gpio_platform_data {
19 unsigned int pin; 19 struct gpio_desc *gpiod;
20 unsigned int is_open_drain:1; 20 struct gpio_desc *pullup_gpiod;
21 void (*enable_external_pullup)(int enable); 21 void (*enable_external_pullup)(int enable);
22 unsigned int ext_pullup_enable_pin;
23 unsigned int pullup_duration; 22 unsigned int pullup_duration;
24}; 23};
25 24