Skip to content

Commit c0f234f

Browse files
committed
Merge tag 'gpio-updates-for-v6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio updates from Bartosz Golaszewski: "We have a new GPIO multiplexer driver, bunch of driver updates and refactoring in the core GPIO library. GPIO core: - teach gpiolib to work with software nodes for HW description - remove ARCH_NR_GPIOS treewide as we no longer impose any limit on the number of GPIOS since the allocation became entirely dynamic - add support for HW quirks for Cirrus CS42L56 codec, Marvell NFC controller, Freescale PCIe and Ethernet controller, Himax LCDs and Mediatek mt2701 - refactor OF quirk code - some general refactoring of the OF and ACPI code, adding new helpers, minor tweaks and fixes, making fwnode usage consistent etc. GPIO uAPI: - fix an issue where the user-space can trigger a NULL-pointer dereference in the kernel by opening a device file, forcing a driver unbind and then calling one of the syscalls on the associated file descriptor New drivers: - add gpio-latch: a new GPIO multiplexer based on latches connected to other GPIOs Driver updates: - convert i2c GPIO expanders to using .probe_new() - drop the gpio-sta2x11 driver - factor out common code for the ACCES IDIO-16 family of controllers and use this new library wherever applicable in drivers - add DT support to gpio-hisi - allow building gpio-davinci as a module and increase its maxItems property - add support for a new model to gpio-pca9570 - other minor changes to various drivers" * tag 'gpio-updates-for-v6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: (66 commits) gpio: sim: set a limit on the number of GPIOs gpiolib: protect the GPIO device against being dropped while in use by user-space gpiolib: cdev: fix NULL-pointer dereferences gpiolib: Provide to_gpio_device() helper gpiolib: Unify access to the device properties gpio: Do not include <linux/kernel.h> when not really needed. gpio: pcf857x: Convert to i2c's .probe_new() gpio: pca953x: Convert to i2c's .probe_new() gpio: max732x: Convert to i2c's .probe_new() dt-bindings: gpio: gpio-davinci: Increase maxItems in gpio-line-names gpiolib: ensure that fwnode is properly set gpio: sl28cpld: Replace irqchip mask_invert with unmask_base gpiolib: of: Use correct fwnode for DT-probed chips gpiolib: of: Drop redundant check in of_mm_gpiochip_remove() gpiolib: of: Prepare of_mm_gpiochip_add_data() for fwnode gpiolib: add support for software nodes gpiolib: consolidate GPIO lookups gpiolib: acpi: avoid leaking ACPI details into upper gpiolib layers gpiolib: acpi: teach acpi_find_gpio() to handle data-only nodes gpiolib: acpi: change acpi_find_gpio() to accept firmware node ...
2 parents 9fa4abc + 11e47bb commit c0f234f

Some content is hidden

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

50 files changed

+1614
-1213
lines changed

Documentation/devicetree/bindings/gpio/gpio-davinci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ properties:
3535
gpio-line-names:
3636
description: strings describing the names of each gpio line.
3737
minItems: 1
38-
maxItems: 100
38+
maxItems: 144
3939

4040
"#gpio-cells":
4141
const: 2
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/gpio/gpio-latch.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: GPIO latch controller
8+
9+
maintainers:
10+
- Sascha Hauer <s.hauer@pengutronix.de>
11+
12+
description: |
13+
This binding describes a GPIO multiplexer based on latches connected to
14+
other GPIOs, like this:
15+
16+
CLK0 ----------------------. ,--------.
17+
CLK1 -------------------. `--------|> #0 |
18+
| | |
19+
OUT0 ----------------+--|-----------|D0 Q0|-----|<
20+
OUT1 --------------+-|--|-----------|D1 Q1|-----|<
21+
OUT2 ------------+-|-|--|-----------|D2 Q2|-----|<
22+
OUT3 ----------+-|-|-|--|-----------|D3 Q3|-----|<
23+
OUT4 --------+-|-|-|-|--|-----------|D4 Q4|-----|<
24+
OUT5 ------+-|-|-|-|-|--|-----------|D5 Q5|-----|<
25+
OUT6 ----+-|-|-|-|-|-|--|-----------|D6 Q6|-----|<
26+
OUT7 --+-|-|-|-|-|-|-|--|-----------|D7 Q7|-----|<
27+
| | | | | | | | | `--------'
28+
| | | | | | | | |
29+
| | | | | | | | | ,--------.
30+
| | | | | | | | `-----------|> #1 |
31+
| | | | | | | | | |
32+
| | | | | | | `--------------|D0 Q0|-----|<
33+
| | | | | | `----------------|D1 Q1|-----|<
34+
| | | | | `------------------|D2 Q2|-----|<
35+
| | | | `--------------------|D3 Q3|-----|<
36+
| | | `----------------------|D4 Q4|-----|<
37+
| | `------------------------|D5 Q5|-----|<
38+
| `--------------------------|D6 Q6|-----|<
39+
`----------------------------|D7 Q7|-----|<
40+
`--------'
41+
42+
The number of clk-gpios and latched-gpios is not fixed. The actual number
43+
of number of latches and the number of inputs per latch is derived from
44+
the number of GPIOs given in the corresponding device tree properties.
45+
46+
properties:
47+
compatible:
48+
const: gpio-latch
49+
"#gpio-cells":
50+
const: 2
51+
52+
clk-gpios:
53+
description: Array of GPIOs to be used to clock a latch
54+
55+
latched-gpios:
56+
description: Array of GPIOs to be used as inputs per latch
57+
58+
setup-duration-ns:
59+
description: Delay in nanoseconds to wait after the latch inputs have been
60+
set up
61+
62+
clock-duration-ns:
63+
description: Delay in nanoseconds to wait between clock output changes
64+
65+
gpio-controller: true
66+
67+
gpio-line-names: true
68+
69+
required:
70+
- compatible
71+
- "#gpio-cells"
72+
- gpio-controller
73+
- clk-gpios
74+
- latched-gpios
75+
76+
additionalProperties: false
77+
78+
examples:
79+
- |
80+
gpio-latch {
81+
#gpio-cells = <2>;
82+
pinctrl-names = "default";
83+
pinctrl-0 = <&pinctrl_di_do_leds>;
84+
compatible = "gpio-latch";
85+
gpio-controller;
86+
setup-duration-ns = <100>;
87+
clock-duration-ns = <100>;
88+
89+
clk-gpios = <&gpio3 7 0>, <&gpio3 8 0>;
90+
latched-gpios = <&gpio3 21 0>, <&gpio3 22 0>,
91+
<&gpio3 23 0>, <&gpio3 24 0>,
92+
<&gpio3 25 0>, <&gpio3 26 0>,
93+
<&gpio3 27 0>, <&gpio3 28 0>;
94+
};

Documentation/devicetree/bindings/gpio/gpio-pca9570.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ maintainers:
1212
properties:
1313
compatible:
1414
enum:
15+
- dlg,slg7xl45106
1516
- nxp,pca9570
1617
- nxp,pca9571
1718

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/gpio/hisilicon,ascend910-gpio.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: HiSilicon common GPIO controller
8+
9+
maintainers:
10+
- Jay Fang <f.fangjian@huawei.com>
11+
12+
description:
13+
The HiSilicon common GPIO controller can be used for many different
14+
types of SoC such as Huawei Ascend AI series chips.
15+
16+
properties:
17+
compatible:
18+
const: hisilicon,ascend910-gpio
19+
20+
reg:
21+
maxItems: 1
22+
23+
interrupts:
24+
maxItems: 1
25+
26+
gpio-controller: true
27+
28+
"#gpio-cells":
29+
const: 2
30+
31+
ngpios:
32+
minimum: 1
33+
maximum: 32
34+
35+
required:
36+
- compatible
37+
- reg
38+
- interrupts
39+
- gpio-controller
40+
- "#gpio-cells"
41+
- ngpios
42+
43+
additionalProperties: false
44+
45+
examples:
46+
- |
47+
#include <dt-bindings/interrupt-controller/arm-gic.h>
48+
49+
gpio@840d0000 {
50+
compatible = "hisilicon,ascend910-gpio";
51+
reg = <0x840d0000 0x1000>;
52+
ngpios = <32>;
53+
gpio-controller;
54+
#gpio-cells = <2>;
55+
interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
56+
};

Documentation/driver-api/gpio/legacy.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -558,11 +558,6 @@ Platform Support
558558
To force-enable this framework, a platform's Kconfig will "select" GPIOLIB,
559559
else it is up to the user to configure support for GPIO.
560560

561-
It may also provide a custom value for ARCH_NR_GPIOS, so that it better
562-
reflects the number of GPIOs in actual use on that platform, without
563-
wasting static table space. (It should count both built-in/SoC GPIOs and
564-
also ones on GPIO expanders.
565-
566561
If neither of these options are selected, the platform does not support
567562
GPIOs through GPIO-lib and the code cannot be enabled by the user.
568563

MAINTAINERS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,13 @@ L: linux-iio@vger.kernel.org
312312
S: Maintained
313313
F: drivers/counter/104-quad-8.c
314314

315+
ACCES IDIO-16 GPIO LIBRARY
316+
M: William Breathitt Gray <william.gray@linaro.org>
317+
L: linux-gpio@vger.kernel.org
318+
S: Maintained
319+
F: drivers/gpio/gpio-idio-16.c
320+
F: drivers/gpio/gpio-idio-16.h
321+
315322
ACCES PCI-IDIO-16 GPIO DRIVER
316323
M: William Breathitt Gray <william.gray@linaro.org>
317324
L: linux-gpio@vger.kernel.org
@@ -9266,6 +9273,7 @@ HISILICON GPIO DRIVER
92669273
M: Jay Fang <f.fangjian@huawei.com>
92679274
L: linux-gpio@vger.kernel.org
92689275
S: Maintained
9276+
F: Documentation/devicetree/bindings/gpio/hisilicon,ascend910-gpio.yaml
92699277
F: drivers/gpio/gpio-hisi.c
92709278

92719279
HISILICON HIGH PERFORMANCE RSA ENGINE DRIVER (HPRE)

arch/arm/Kconfig

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,27 +1158,6 @@ config ARM_PSCI
11581158
0022A ("Power State Coordination Interface System Software on
11591159
ARM processors").
11601160

1161-
# The GPIO number here must be sorted by descending number. In case of
1162-
# a multiplatform kernel, we just want the highest value required by the
1163-
# selected platforms.
1164-
config ARCH_NR_GPIO
1165-
int
1166-
default 2048 if ARCH_INTEL_SOCFPGA
1167-
default 1024 if ARCH_BRCMSTB || ARCH_RENESAS || ARCH_TEGRA || \
1168-
ARCH_ZYNQ || ARCH_ASPEED
1169-
default 512 if ARCH_EXYNOS || ARCH_KEYSTONE || SOC_OMAP5 || \
1170-
SOC_DRA7XX || ARCH_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210
1171-
default 416 if ARCH_SUNXI
1172-
default 392 if ARCH_U8500
1173-
default 352 if ARCH_VT8500
1174-
default 288 if ARCH_ROCKCHIP
1175-
default 264 if MACH_H4700
1176-
default 0
1177-
help
1178-
Maximum number of GPIOs in the system.
1179-
1180-
If unsure, leave the default value.
1181-
11821161
config HZ_FIXED
11831162
int
11841163
default 128 if SOC_AT91RM9200

arch/arm/include/asm/gpio.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#ifndef _ARCH_ARM_GPIO_H
33
#define _ARCH_ARM_GPIO_H
44

5-
/* Note: this may rely upon the value of ARCH_NR_GPIOS set in mach/gpio.h */
65
#include <asm-generic/gpio.h>
76

87
/* The trivial gpiolib dispatchers */

arch/arm64/Kconfig

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2168,18 +2168,6 @@ config STACKPROTECTOR_PER_TASK
21682168
def_bool y
21692169
depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_SYSREG
21702170

2171-
# The GPIO number here must be sorted by descending number. In case of
2172-
# a multiplatform kernel, we just want the highest value required by the
2173-
# selected platforms.
2174-
config ARCH_NR_GPIO
2175-
int
2176-
default 2048 if ARCH_APPLE
2177-
default 0
2178-
help
2179-
Maximum number of GPIOs in the system.
2180-
2181-
If unsure, leave the default value.
2182-
21832171
config UNWIND_PATCH_PAC_INTO_SCS
21842172
bool "Enable shadow call stack dynamically using code patching"
21852173
# needs Clang with https://reviews.llvm.org/D111780 incorporated

arch/x86/Kconfig

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,6 @@ config ARCH_HAS_CPU_RELAX
361361
config ARCH_HIBERNATION_POSSIBLE
362362
def_bool y
363363

364-
config ARCH_NR_GPIO
365-
int
366-
default 1024 if X86_64
367-
default 512
368-
369364
config ARCH_SUSPEND_POSSIBLE
370365
def_bool y
371366

drivers/gpio/Kconfig

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,15 @@ config GPIO_REGMAP
109109
config GPIO_MAX730X
110110
tristate
111111

112+
config GPIO_IDIO_16
113+
tristate
114+
help
115+
Enables support for the idio-16 library functions. The idio-16 library
116+
provides functions to facilitate communication with devices within the
117+
ACCES IDIO-16 family such as the 104-IDIO-16 and the PCI-IDIO-16.
118+
119+
If built as a module its name will be gpio-idio-16.
120+
112121
menu "Memory mapped GPIO drivers"
113122
depends on HAS_IOMEM
114123

@@ -219,7 +228,7 @@ config GPIO_CLPS711X
219228
Say yes here to support GPIO on CLPS711X SoCs.
220229

221230
config GPIO_DAVINCI
222-
bool "TI Davinci/Keystone GPIO support"
231+
tristate "TI Davinci/Keystone GPIO support"
223232
default y if ARCH_DAVINCI
224233
depends on (ARM || ARM64) && (ARCH_DAVINCI || ARCH_KEYSTONE || ARCH_K3)
225234
help
@@ -310,7 +319,7 @@ config GPIO_GRGPIO
310319

311320
config GPIO_HISI
312321
tristate "HiSilicon GPIO controller driver"
313-
depends on (ARM64 && ACPI) || COMPILE_TEST
322+
depends on ARM64 || COMPILE_TEST
314323
select GPIO_GENERIC
315324
select GPIOLIB_IRQCHIP
316325
help
@@ -600,14 +609,6 @@ config GPIO_SPRD
600609
help
601610
Say yes here to support Spreadtrum GPIO device.
602611

603-
config GPIO_STA2X11
604-
bool "STA2x11/ConneXt GPIO support"
605-
depends on MFD_STA2X11
606-
select GENERIC_IRQ_CHIP
607-
help
608-
Say yes here to support the STA2x11/ConneXt GPIO device.
609-
The GPIO module has 128 GPIO pins with alternate functions.
610-
611612
config GPIO_STP_XWAY
612613
bool "XWAY STP GPIOs"
613614
depends on SOC_XWAY || COMPILE_TEST
@@ -857,6 +858,7 @@ config GPIO_104_IDIO_16
857858
depends on PC104
858859
select ISA_BUS_API
859860
select GPIOLIB_IRQCHIP
861+
select GPIO_IDIO_16
860862
help
861863
Enables GPIO support for the ACCES 104-IDIO-16 family (104-IDIO-16,
862864
104-IDIO-16E, 104-IDO-16, 104-IDIO-8, 104-IDIO-8E, 104-IDO-8). The
@@ -1561,6 +1563,7 @@ config GPIO_PCH
15611563
config GPIO_PCI_IDIO_16
15621564
tristate "ACCES PCI-IDIO-16 GPIO support"
15631565
select GPIOLIB_IRQCHIP
1566+
select GPIO_IDIO_16
15641567
help
15651568
Enables GPIO support for the ACCES PCI-IDIO-16. An interrupt is
15661569
generated when any of the inputs change state (low to high or high to
@@ -1681,6 +1684,12 @@ config GPIO_AGGREGATOR
16811684
industrial control context, to be operated from userspace using
16821685
the GPIO chardev interface.
16831686

1687+
config GPIO_LATCH
1688+
tristate "GPIO latch driver"
1689+
help
1690+
Say yes here to enable a driver for GPIO multiplexers based on latches
1691+
connected to other GPIOs.
1692+
16841693
config GPIO_MOCKUP
16851694
tristate "GPIO Testing Driver"
16861695
select IRQ_SIM

drivers/gpio/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ obj-$(CONFIG_OF_GPIO) += gpiolib-of.o
1010
obj-$(CONFIG_GPIO_CDEV) += gpiolib-cdev.o
1111
obj-$(CONFIG_GPIO_SYSFS) += gpiolib-sysfs.o
1212
obj-$(CONFIG_GPIO_ACPI) += gpiolib-acpi.o
13+
obj-$(CONFIG_GPIOLIB) += gpiolib-swnode.o
1314

1415
# Device drivers. Generally keep list sorted alphabetically
1516
obj-$(CONFIG_GPIO_REGMAP) += gpio-regmap.o
@@ -68,13 +69,15 @@ obj-$(CONFIG_GPIO_HLWD) += gpio-hlwd.o
6869
obj-$(CONFIG_HTC_EGPIO) += gpio-htc-egpio.o
6970
obj-$(CONFIG_GPIO_I8255) += gpio-i8255.o
7071
obj-$(CONFIG_GPIO_ICH) += gpio-ich.o
72+
obj-$(CONFIG_GPIO_IDIO_16) += gpio-idio-16.o
7173
obj-$(CONFIG_GPIO_IDT3243X) += gpio-idt3243x.o
7274
obj-$(CONFIG_GPIO_IMX_SCU) += gpio-imx-scu.o
7375
obj-$(CONFIG_GPIO_IOP) += gpio-iop.o
7476
obj-$(CONFIG_GPIO_IT87) += gpio-it87.o
7577
obj-$(CONFIG_GPIO_IXP4XX) += gpio-ixp4xx.o
7678
obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o
7779
obj-$(CONFIG_GPIO_KEMPLD) += gpio-kempld.o
80+
obj-$(CONFIG_GPIO_LATCH) += gpio-latch.o
7881
obj-$(CONFIG_GPIO_LOGICVC) += gpio-logicvc.o
7982
obj-$(CONFIG_GPIO_LOONGSON1) += gpio-loongson1.o
8083
obj-$(CONFIG_GPIO_LOONGSON) += gpio-loongson.o
@@ -140,7 +143,6 @@ obj-$(CONFIG_GPIO_SL28CPLD) += gpio-sl28cpld.o
140143
obj-$(CONFIG_GPIO_SODAVILLE) += gpio-sodaville.o
141144
obj-$(CONFIG_GPIO_SPEAR_SPICS) += gpio-spear-spics.o
142145
obj-$(CONFIG_GPIO_SPRD) += gpio-sprd.o
143-
obj-$(CONFIG_GPIO_STA2X11) += gpio-sta2x11.o
144146
obj-$(CONFIG_GPIO_STMPE) += gpio-stmpe.o
145147
obj-$(CONFIG_GPIO_STP_XWAY) += gpio-stp-xway.o
146148
obj-$(CONFIG_GPIO_SYSCON) += gpio-syscon.o

drivers/gpio/TODO

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,13 @@ Work items:
124124
this with dry-coding and sending to maintainers to test
125125

126126

127+
Generic regmap GPIO
128+
129+
In the very similar way to Generic MMIO GPIO convert the users which can
130+
take advantage of using regmap over direct IO accessors. Note, even in
131+
MMIO case the regmap MMIO with gpio-regmap.c is preferable over gpio-mmio.c.
132+
133+
127134
GPIOLIB irqchip
128135

129136
The GPIOLIB irqchip is a helper irqchip for "simple cases" that should

0 commit comments

Comments
 (0)