Skip to content

Commit 10b4b09

Browse files
committed
Merge tag 'gpio-v4.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull gpio updates from Linus Walleij: "This is the big bulk of GPIO changes queued for the v4.2 kernel series: - a big set of cleanups to the aged sysfs interface from Johan Hovold. To get these in, v4.1-rc3 was merged into the tree as the first patch in that series had to go into stable. This makes the locking much more fine-grained (get rid of the "big GPIO lock(s)" and store states in the GPIO descriptors. - rename gpiod_[g|s]et_array() to gpiod_[g|s]et_array_value() to avoid confusions. - New drivers for: * NXP LPC18xx (currently LPC1850) * NetLogic XLP * Broadcom STB SoC's * Axis ETRAXFS * Zynq Ultrascale+ (subdriver) - ACPI: * make it possible to retrieve GpioInt resources from a GPIO device using acpi_dev_gpio_irq_get() * merge some dependent I2C changes exploiting this. * support the ARM X-Gene GPIO standby driver. - make it possible for the generic GPIO driver to read back the value set registers to reflect current status. - loads of OMAP IRQ handling fixes. - incremental improvements to Kona, max732x, OMAP, MXC, RCAR, PCA953x, STP-XWAY, PCF857x, Crystalcove, TB10x. - janitorial (constification, checkpatch cleanups)" * tag 'gpio-v4.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (71 commits) gpio: Fix checkpatch.pl issues gpio: pcf857x: handle only enabled irqs gpio / ACPI: Return -EPROBE_DEFER if the gpiochip was not found GPIO / ACPI: export acpi_gpiochip_request(free)_interrupts for module use gpio: improve error reporting on own descriptors gpio: promote own request failure to pr_err() gpio: Added support to Zynq Ultrascale+ MPSoC gpio: add ETRAXFS GPIO driver fix documentation after renaming gpiod_set_array to gpiod_set_array_value gpio: Add GPIO support for Broadcom STB SoCs gpio: xgene: add ACPI support for APM X-Gene GPIO standby driver gpio: tb10x: Drop unneeded free_irq() call gpio: crystalcove: set IRQCHIP_SKIP_SET_WAKE for the irqchip gpio: stp-xway: Use the of_property_read_u32 helper gpio: pcf857x: Check for irq_set_irq_wake() failures gpio-stp-xway: Fix enabling the highest bit of the PHY LEDs gpio: Prevent an integer overflow in the pca953x driver gpio: omap: rework omap_gpio_irq_startup to handle current pin state properly gpio: omap: rework omap_gpio_request to touch only gpio specific registers gpio: omap: rework omap_x_irq_shutdown to touch only irqs specific registers ...
2 parents c70c5fb + 38e003f commit 10b4b09

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+2047
-645
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
Broadcom STB "UPG GIO" GPIO controller
2+
3+
The controller's registers are organized as sets of eight 32-bit
4+
registers with each set controlling a bank of up to 32 pins. A single
5+
interrupt is shared for all of the banks handled by the controller.
6+
7+
Required properties:
8+
9+
- compatible:
10+
Must be "brcm,brcmstb-gpio"
11+
12+
- reg:
13+
Define the base and range of the I/O address space containing
14+
the brcmstb GPIO controller registers
15+
16+
- #gpio-cells:
17+
Should be <2>. The first cell is the pin number (within the controller's
18+
pin space), and the second is used for the following:
19+
bit[0]: polarity (0 for active-high, 1 for active-low)
20+
21+
- gpio-controller:
22+
Specifies that the node is a GPIO controller.
23+
24+
- brcm,gpio-bank-widths:
25+
Number of GPIO lines for each bank. Number of elements must
26+
correspond to number of banks suggested by the 'reg' property.
27+
28+
Optional properties:
29+
30+
- interrupts:
31+
The interrupt shared by all GPIO lines for this controller.
32+
33+
- interrupt-parent:
34+
phandle of the parent interrupt controller
35+
36+
- #interrupt-cells:
37+
Should be <2>. The first cell is the GPIO number, the second should specify
38+
flags. The following subset of flags is supported:
39+
- bits[3:0] trigger type and level flags
40+
1 = low-to-high edge triggered
41+
2 = high-to-low edge triggered
42+
4 = active high level-sensitive
43+
8 = active low level-sensitive
44+
Valid combinations are 1, 2, 3, 4, 8.
45+
See also Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
46+
47+
- interrupt-controller:
48+
Marks the device node as an interrupt controller
49+
50+
- interrupt-names:
51+
The name of the IRQ resource used by this controller
52+
53+
Example:
54+
upg_gio: gpio@f040a700 {
55+
#gpio-cells = <0x2>;
56+
#interrupt-cells = <0x2>;
57+
compatible = "brcm,bcm7445-gpio", "brcm,brcmstb-gpio";
58+
gpio-controller;
59+
interrupt-controller;
60+
reg = <0xf040a700 0x80>;
61+
interrupt-parent = <0xf>;
62+
interrupts = <0x6>;
63+
interrupt-names = "upg_gio";
64+
brcm,gpio-bank-widths = <0x20 0x20 0x20 0x18>;
65+
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Axis ETRAX FS General I/O controller bindings
2+
3+
Required properties:
4+
5+
- compatible:
6+
- "axis,etraxfs-gio"
7+
- reg: Physical base address and length of the controller's registers.
8+
- #gpio-cells: Should be 3
9+
- The first cell is the gpio offset number.
10+
- The second cell is reserved and is currently unused.
11+
- The third cell is the port number (hex).
12+
- gpio-controller: Marks the device node as a GPIO controller.
13+
14+
Example:
15+
16+
gio: gpio@b001a000 {
17+
compatible = "axis,etraxfs-gio";
18+
reg = <0xb001a000 0x1000>;
19+
gpio-controller;
20+
#gpio-cells = <3>;
21+
};
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Netlogic XLP Family GPIO
2+
========================
3+
4+
This GPIO driver is used for following Netlogic XLP SoCs:
5+
XLP832, XLP316, XLP208, XLP980, XLP532
6+
7+
Required properties:
8+
-------------------
9+
10+
- compatible: Should be one of the following:
11+
- "netlogic,xlp832-gpio": For Netlogic XLP832
12+
- "netlogic,xlp316-gpio": For Netlogic XLP316
13+
- "netlogic,xlp208-gpio": For Netlogic XLP208
14+
- "netlogic,xlp980-gpio": For Netlogic XLP980
15+
- "netlogic,xlp532-gpio": For Netlogic XLP532
16+
- reg: Physical base address and length of the controller's registers.
17+
- #gpio-cells: Should be two. The first cell is the pin number and the second
18+
cell is used to specify optional parameters (currently unused).
19+
- gpio-controller: Marks the device node as a GPIO controller.
20+
- nr-gpios: Number of GPIO pins supported by the controller.
21+
- interrupt-cells: Should be two. The first cell is the GPIO Number. The
22+
second cell is used to specify flags. The following subset of flags is
23+
supported:
24+
- trigger type:
25+
1 = low to high edge triggered.
26+
2 = high to low edge triggered.
27+
4 = active high level-sensitive.
28+
8 = active low level-sensitive.
29+
- interrupts: Interrupt number for this device.
30+
- interrupt-parent: phandle of the parent interrupt controller.
31+
- interrupt-controller: Identifies the node as an interrupt controller.
32+
33+
Example:
34+
35+
gpio: xlp_gpio@34000 {
36+
compatible = "netlogic,xlp316-gpio";
37+
reg = <0 0x34100 0x1000
38+
0 0x35100 0x1000>;
39+
#gpio-cells = <2>;
40+
gpio-controller;
41+
nr-gpios = <57>;
42+
43+
#interrupt-cells = <2>;
44+
interrupt-parent = <&pic>;
45+
interrupts = <39>;
46+
interrupt-controller;
47+
};

Documentation/devicetree/bindings/gpio/gpio-zynq.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Required properties:
66
- First cell is the GPIO line number
77
- Second cell is used to specify optional
88
parameters (unused)
9-
- compatible : Should be "xlnx,zynq-gpio-1.0"
9+
- compatible : Should be "xlnx,zynq-gpio-1.0" or "xlnx,zynqmp-gpio-1.0"
1010
- clocks : Clock specifier (see clock bindings for details)
1111
- gpio-controller : Marks the device node as a GPIO controller.
1212
- interrupts : Interrupt specifier (see interrupt bindings for
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
NXP LPC18xx/43xx GPIO controller Device Tree Bindings
2+
-----------------------------------------------------
3+
4+
Required properties:
5+
- compatible : Should be "nxp,lpc1850-gpio"
6+
- reg : Address and length of the register set for the device
7+
- clocks : Clock specifier (see clock bindings for details)
8+
- gpio-controller : Marks the device node as a GPIO controller.
9+
- #gpio-cells : Should be two
10+
- First cell is the GPIO line number
11+
- Second cell is used to specify polarity
12+
13+
Optional properties:
14+
- gpio-ranges : Mapping between GPIO and pinctrl
15+
16+
Example:
17+
#define LPC_GPIO(port, pin) (port * 32 + pin)
18+
#define LPC_PIN(port, pin) (0x##port * 32 + pin)
19+
20+
gpio: gpio@400f4000 {
21+
compatible = "nxp,lpc1850-gpio";
22+
reg = <0x400f4000 0x4000>;
23+
clocks = <&ccu1 CLK_CPU_GPIO>;
24+
gpio-controller;
25+
#gpio-cells = <2>;
26+
gpio-ranges = <&pinctrl LPC_GPIO(0,0) LPC_PIN(0,0) 2>,
27+
...
28+
<&pinctrl LPC_GPIO(7,19) LPC_PIN(f,5) 7>;
29+
};
30+
31+
gpio_joystick {
32+
compatible = "gpio-keys-polled";
33+
...
34+
35+
button@0 {
36+
...
37+
gpios = <&gpio LPC_GPIO(4,8) GPIO_ACTIVE_LOW>;
38+
};
39+
};

Documentation/gpio/consumer.txt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -241,18 +241,18 @@ Set multiple GPIO outputs with a single function call
241241
-----------------------------------------------------
242242
The following functions set the output values of an array of GPIOs:
243243

244-
void gpiod_set_array(unsigned int array_size,
245-
struct gpio_desc **desc_array,
246-
int *value_array)
247-
void gpiod_set_raw_array(unsigned int array_size,
248-
struct gpio_desc **desc_array,
249-
int *value_array)
250-
void gpiod_set_array_cansleep(unsigned int array_size,
251-
struct gpio_desc **desc_array,
252-
int *value_array)
253-
void gpiod_set_raw_array_cansleep(unsigned int array_size,
254-
struct gpio_desc **desc_array,
255-
int *value_array)
244+
void gpiod_set_array_value(unsigned int array_size,
245+
struct gpio_desc **desc_array,
246+
int *value_array)
247+
void gpiod_set_raw_array_value(unsigned int array_size,
248+
struct gpio_desc **desc_array,
249+
int *value_array)
250+
void gpiod_set_array_value_cansleep(unsigned int array_size,
251+
struct gpio_desc **desc_array,
252+
int *value_array)
253+
void gpiod_set_raw_array_value_cansleep(unsigned int array_size,
254+
struct gpio_desc **desc_array,
255+
int *value_array)
256256

257257
The array can be an arbitrary set of GPIOs. The functions will try to set
258258
GPIOs belonging to the same bank or chip simultaneously if supported by the
@@ -271,8 +271,8 @@ matches the desired group of GPIOs, those GPIOs can be set by simply using
271271
the struct gpio_descs returned by gpiod_get_array():
272272

273273
struct gpio_descs *my_gpio_descs = gpiod_get_array(...);
274-
gpiod_set_array(my_gpio_descs->ndescs, my_gpio_descs->desc,
275-
my_gpio_values);
274+
gpiod_set_array_value(my_gpio_descs->ndescs, my_gpio_descs->desc,
275+
my_gpio_values);
276276

277277
It is also possible to set a completely arbitrary array of descriptors. The
278278
descriptors may be obtained using any combination of gpiod_get() and

Documentation/gpio/gpio-legacy.txt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -751,9 +751,6 @@ requested using gpio_request():
751751
int gpio_export_link(struct device *dev, const char *name,
752752
unsigned gpio)
753753

754-
/* change the polarity of a GPIO node in sysfs */
755-
int gpio_sysfs_set_active_low(unsigned gpio, int value);
756-
757754
After a kernel driver requests a GPIO, it may only be made available in
758755
the sysfs interface by gpio_export(). The driver can control whether the
759756
signal direction may change. This helps drivers prevent userspace code
@@ -767,9 +764,3 @@ After the GPIO has been exported, gpio_export_link() allows creating
767764
symlinks from elsewhere in sysfs to the GPIO sysfs node. Drivers can
768765
use this to provide the interface under their own device in sysfs with
769766
a descriptive name.
770-
771-
Drivers can use gpio_sysfs_set_active_low() to hide GPIO line polarity
772-
differences between boards from user space. This only affects the
773-
sysfs interface. Polarity change can be done both before and after
774-
gpio_export(), and previously enabled poll(2) support for either
775-
rising or falling edge will be reconfigured to follow this setting.

Documentation/gpio/sysfs.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,6 @@ requested using gpio_request():
132132
int gpiod_export_link(struct device *dev, const char *name,
133133
struct gpio_desc *desc);
134134

135-
/* change the polarity of a GPIO node in sysfs */
136-
int gpiod_sysfs_set_active_low(struct gpio_desc *desc, int value);
137-
138135
After a kernel driver requests a GPIO, it may only be made available in
139136
the sysfs interface by gpiod_export(). The driver can control whether the
140137
signal direction may change. This helps drivers prevent userspace code
@@ -148,8 +145,3 @@ After the GPIO has been exported, gpiod_export_link() allows creating
148145
symlinks from elsewhere in sysfs to the GPIO sysfs node. Drivers can
149146
use this to provide the interface under their own device in sysfs with
150147
a descriptive name.
151-
152-
Drivers can use gpiod_sysfs_set_active_low() to hide GPIO line polarity
153-
differences between boards from user space. Polarity change can be done both
154-
before and after gpiod_export(), and previously enabled poll(2) support for
155-
either rising or falling edge will be reconfigured to follow this setting.

Documentation/zh_CN/gpio.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -638,9 +638,6 @@ GPIO 控制器的路径类似 /sys/class/gpio/gpiochip42/ (对于从#42 GPIO
638638
int gpio_export_link(struct device *dev, const char *name,
639639
unsigned gpio)
640640

641-
/* 改变 sysfs 中的一个 GPIO 节点的极性 */
642-
int gpio_sysfs_set_active_low(unsigned gpio, int value);
643-
644641
在一个内核驱动申请一个 GPIO 之后,它可以通过 gpio_export()使其在 sysfs
645642
接口中可见。该驱动可以控制信号方向是否可修改。这有助于防止用户空间代码无意间
646643
破坏重要的系统状态。
@@ -651,8 +648,3 @@ GPIO 控制器的路径类似 /sys/class/gpio/gpiochip42/ (对于从#42 GPIO
651648
在 GPIO 被导出之后,gpio_export_link()允许在 sysfs 文件系统的任何地方
652649
创建一个到这个 GPIO sysfs 节点的符号链接。这样驱动就可以通过一个描述性的
653650
名字,在 sysfs 中他们所拥有的设备下提供一个(到这个 GPIO sysfs 节点的)接口。
654-
655-
驱动可以使用 gpio_sysfs_set_active_low() 来在用户空间隐藏电路板之间
656-
GPIO 线的极性差异。这个仅对 sysfs 接口起作用。极性的改变可以在 gpio_export()
657-
前后进行,且之前使能的轮询操作(poll(2))支持(上升或下降沿)将会被重新配置来遵循
658-
这个设置。

MAINTAINERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2250,6 +2250,13 @@ N: bcm9583*
22502250
N: bcm583*
22512251
N: bcm113*
22522252

2253+
BROADCOM BRCMSTB GPIO DRIVER
2254+
M: Gregory Fong <[email protected]>
2255+
2256+
S: Supported
2257+
F: drivers/gpio/gpio-brcmstb.c
2258+
F: Documentation/devicetree/bindings/gpio/brcm,brcmstb-gpio.txt
2259+
22532260
BROADCOM KONA GPIO DRIVER
22542261
M: Ray Jui <[email protected]>
22552262

drivers/gpio/Kconfig

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,14 @@ config GPIO_BCM_KONA
126126
help
127127
Turn on GPIO support for Broadcom "Kona" chips.
128128

129+
config GPIO_BRCMSTB
130+
tristate "BRCMSTB GPIO support"
131+
default y if ARCH_BRCMSTB
132+
depends on OF_GPIO && (ARCH_BRCMSTB || COMPILE_TEST)
133+
select GPIO_GENERIC
134+
help
135+
Say yes here to enable GPIO support for Broadcom STB (BCM7XXX) SoCs.
136+
129137
config GPIO_CLPS711X
130138
tristate "CLPS711X GPIO support"
131139
depends on ARCH_CLPS711X || COMPILE_TEST
@@ -159,6 +167,14 @@ config GPIO_EP93XX
159167
depends on ARCH_EP93XX
160168
select GPIO_GENERIC
161169

170+
config GPIO_ETRAXFS
171+
bool "Axis ETRAX FS General I/O"
172+
depends on CRIS || COMPILE_TEST
173+
depends on OF
174+
select GPIO_GENERIC
175+
help
176+
Say yes here to support the GPIO controller on Axis ETRAX FS SoCs.
177+
162178
config GPIO_F7188X
163179
tristate "F71869, F71869A, F71882FG and F71889F GPIO support"
164180
depends on X86
@@ -230,6 +246,14 @@ config GPIO_LOONGSON
230246
help
231247
driver for GPIO functionality on Loongson-2F/3A/3B processors.
232248

249+
config GPIO_LPC18XX
250+
bool "NXP LPC18XX/43XX GPIO support"
251+
default y if ARCH_LPC18XX
252+
depends on OF_GPIO && (ARCH_LPC18XX || COMPILE_TEST)
253+
help
254+
Select this option to enable GPIO driver for
255+
NXP LPC18XX/43XX devices.
256+
233257
config GPIO_LYNXPOINT
234258
tristate "Intel Lynxpoint GPIO support"
235259
depends on ACPI && X86
@@ -308,7 +332,7 @@ config GPIO_OCTEON
308332
family of SOCs.
309333

310334
config GPIO_OMAP
311-
bool "TI OMAP GPIO support" if COMPILE_TEST && !ARCH_OMAP2PLUS
335+
tristate "TI OMAP GPIO support" if ARCH_OMAP2PLUS || COMPILE_TEST
312336
default y if ARCH_OMAP
313337
depends on ARM
314338
select GENERIC_IRQ_CHIP
@@ -488,6 +512,17 @@ config GPIO_XILINX
488512
help
489513
Say yes here to support the Xilinx FPGA GPIO device
490514

515+
config GPIO_XLP
516+
tristate "Netlogic XLP GPIO support"
517+
depends on CPU_XLP
518+
select GPIOLIB_IRQCHIP
519+
help
520+
This driver provides support for GPIO interface on Netlogic XLP MIPS64
521+
SoCs. Currently supported XLP variants are XLP8XX, XLP3XX, XLP2XX,
522+
XLP9XX and XLP5XX.
523+
524+
If unsure, say N.
525+
491526
config GPIO_XTENSA
492527
bool "Xtensa GPIO32 support"
493528
depends on XTENSA
@@ -505,7 +540,7 @@ config GPIO_ZEVIO
505540

506541
config GPIO_ZYNQ
507542
tristate "Xilinx Zynq GPIO support"
508-
depends on ARCH_ZYNQ
543+
depends on ARCH_ZYNQ || ARCH_ZYNQMP
509544
select GPIOLIB_IRQCHIP
510545
help
511546
Say yes here to support Xilinx Zynq GPIO controller.

0 commit comments

Comments
 (0)