Skip to content

Commit fcb117e

Browse files
committed
Merge tag 'gpio-updates-for-v6.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio updates from Bartosz Golaszewski: "There's one new driver (Apple SMC) and extensions to existing drivers for supporting new HW models. A lot of different impovements across drivers and in core GPIO code. Details on that are in the signed tag as usual. We managed to remove some of the legacy APIs. Arnd Bergmann started to work on making the legacy bits optional so that we may compile them only for older platforms that still really need them. Rob Herring has done a lot of work to convert legacy .txt dt-bindings for GPIO controllers to YAML. There are only a few left now in the GPIO tree. A big part of the commits in this PR concern the conversion of GPIO drivers to using the new line value setter callbacks. This conversion is now complete treewide (unless I've missed something) and once all the changes from different trees land in mainline, I'll send you another PR containing a commit dropping the legacy callbacks from the tree. As the quest to pay back technical dept never really ends, we're starting another set of interface conversions, this time it's about moving fields specific to only a handful of drivers using the gpio-mmio helper out of the core gpio_chip structure that every controller implements and uses. This cycle we introduce a new set of APIs and convert a few drivers under drivers/gpio/, next cycle we'll convert remaining modules treewide (in gpio, pinctrl and mfd trees) and finally remove the old interfaces and move the gpio-mmio fields into their own structure wrapping gpio_chip. One last change I should mention here is the rework of the sysfs interface. In 2016, we introduced the GPIO character device as the preferred alternative to the sysfs class under /sys/class/gpio. While it has seen a wide adoption with the help of its user-space counterpart - libgpiod - there are still users who prefer the simplicity of sysfs. As far as the GPIO subsystem is concerned, the problem is not the existince of the GPIO class as such but rather the fact that it exposes the global GPIO numbers to the user-space, stopping us from ever being able to remove the numberspace from the kernel. To that end, this release we introduced a parallel, limited sysfs interface that doesn't expose these numbers and only implements a subset of features that are relevant to the existing users. This is a result of several discussions over the course of last year and should allow us to remove the legacy part some time in the future. Summary: GPIOLIB core: - introduce a parallel, limited sysfs user ABI that doesn't expose the global GPIO numbers to user-space while maintaining backward compatibility with the end goal of it completely replacing the existing interface, allowing us to remove it - remove the legacy devm_gpio_request() routine which has no more users - start the process of allowing to compile-out the legacy parts of the GPIO core for users who don't need it by introducing a new Kconfig option: GPIOLIB_LEGACY - don't use global GPIO numbers in debugfs output from the core code (drivers still do it, the work is ongoing) - start the process of moving the fields specific to the gpio-mmio helper out of the core struct gpio_chip into their own structure that wraps it: create a new header with modern interfaces and convert several drivers to using it - remove the platform data structure associated with the gpio-mmio helper from the kernel after having converted all remaining users to generic device properties - remove legacy struct gpio definition as it has no more users New drivers: - add the GPIO driver for the Apple System Management Controller Driver improvements: - add support for new models to gpio-adp5585, gpio-tps65219 and gpio-pca953x - extend the interrupt support in gpio-loongson-64bit - allow to mark the simulated GPIO lines as invalid in gpio-sim - convert all remaining GPIO drivers to using the new GPIO value setter callbacks - convert gpio-rcar to using simple device power management ops callbacks - don't check if current direction of a line is output before setting the value in gpio-pisosr and ti-fpc202: the GPIO core already handles that - also drop unneeded GPIO range checks in drivers, the core already makes sure we're within bounds when calling driver callbacks - use dev_fwnode() where applicable across GPIO drivers - set line value in gpio-zynqmp-modepin and gpio-twl6040 when the user wants to change direction of the pin to output even though these drivers don't need to do anything else to actually set the direction, otherwise a call like gpiod_direction_output(d, 1) will not result in the line driver high - remove the reduntant call to pm_runtime_mark_last_busy() from gpio-arizona - use lock guards in gpio-cadence and gpio-mxc - check the return values of regmap functions in gpio-wcd934x and gpio-tps65912 - use better regmap interfaces in gpio-wcove and gpio-pca953x - remove dummy GPIO chip callbacks from several drivers in cases where the GPIO core can already handle their absence - allow building gpio-palmas as a module Fixes: - use correct bit widths (according to the documentation) in gpio-virtio Device-tree bindings: - convert several of the legacy .txt documents for many different devices to YAML, improving automatic validation - create a "trivial" GPIO DT schema that covers a wide range of simple hardware that share a set of basic GPIO properties - document new HW: Apple MAC SMC GPIO block and adp5589 I/O expander - document a new model for pca95xx - add and/or remove properties in YAML documents for gpio-rockchip, fsl,qoriq-gpio, arm,pl061 and gpio-xilinx Misc: - some minor refactoring in several places, adding/removing forward declarations, moving defines to better places, constify the arguments in some functions, remove duplicate includes, etc. - documentation updates" * tag 'gpio-updates-for-v6.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: (202 commits) MIPS: alchemy: gpio: use new GPIO line value setter callbacks for the remaining chips gpiolib: enable CONFIG_GPIOLIB_LEGACY even for !GPIOLIB gpio: virtio: Fix config space reading. gpiolib: make legacy interfaces optional dt-bindings: gpio: rockchip: Allow use of a power-domain gpiolib: of: add forward declaration for struct device_node power: reset: macsmc-reboot: Add driver for rebooting via Apple SMC gpio: Add new gpio-macsmc driver for Apple Macs mfd: Add Apple Silicon System Management Controller soc: apple: rtkit: Make shmem_destroy optional dt-bindings: mfd: Add Apple Mac System Management Controller dt-bindings: power: reboot: Add Apple Mac SMC Reboot Controller dt-bindings: gpio: Add Apple Mac SMC GPIO block gpio: cadence: Remove duplicated include in gpio-cadence.c gpio: tps65219: Add support for TI TPS65214 PMIC gpio: tps65219: Update _IDX & _OFFSET macro prefix gpio: sysfs: Fix an end of loop test in gpiod_unexport() dt-bindings: gpio: Convert qca,ar7100-gpio to DT schema dt-bindings: gpio: Convert maxim,max3191x to DT schema dt-bindings: gpio: fsl,qoriq-gpio: Add missing mpc8xxx compatibles ...
2 parents 177bf86 + 6b94bf9 commit fcb117e

File tree

201 files changed

+6502
-3711
lines changed

Some content is hidden

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

201 files changed

+6502
-3711
lines changed

Documentation/ABI/obsolete/sysfs-gpio

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,22 @@ Description:
1919
/export ... asks the kernel to export a GPIO to userspace
2020
/unexport ... to return a GPIO to the kernel
2121
/gpioN ... for each exported GPIO #N OR
22-
/<LINE-NAME> ... for a properly named GPIO line
2322
/value ... always readable, writes fail for input GPIOs
2423
/direction ... r/w as: in, out (default low); write: high, low
2524
/edge ... r/w as: none, falling, rising, both
25+
/active_low ... r/w as: 0, 1
2626
/gpiochipN ... for each gpiochip; #N is its first GPIO
2727
/base ... (r/o) same as N
28-
/label ... (r/o) descriptive, not necessarily unique
28+
/label ... (r/o) descriptive chip name
2929
/ngpio ... (r/o) number of GPIOs; numbered N to N + (ngpio - 1)
30+
/gpio<OFFSET>
31+
/value ... always readable, writes fail for input GPIOs
32+
/direction ... r/w as: in, out (default low); write: high, low
33+
/chipX ... for each gpiochip; #X is the gpio device ID
34+
/export ... asks the kernel to export a GPIO at HW offset X to userspace
35+
/unexport ... to return a GPIO at HW offset X to the kernel
36+
/label ... (r/o) descriptive chip name
37+
/ngpio ... (r/o) number of GPIOs exposed by the chip
3038

3139
This ABI is obsoleted by Documentation/ABI/testing/gpio-cdev and will be
3240
removed after 2020.

Documentation/admin-guide/gpio/gpio-sim.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,11 @@ the number of lines exposed by this bank.
5050

5151
**Attribute:** ``/config/gpio-sim/gpio-device/gpio-bankX/lineY/name``
5252

53-
This group represents a single line at the offset Y. The 'name' attribute
54-
allows to set the line name as represented by the 'gpio-line-names' property.
53+
**Attribute:** ``/config/gpio-sim/gpio-device/gpio-bankX/lineY/valid``
54+
55+
This group represents a single line at the offset Y. The ``valid`` attribute
56+
indicates whether the line can be used as GPIO. The ``name`` attribute allows
57+
to set the line name as represented by the 'gpio-line-names' property.
5558

5659
**Item:** ``/config/gpio-sim/gpio-device/gpio-bankX/lineY/hog``
5760

Documentation/devicetree/bindings/fpga/fpga-region.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ examples:
316316
reg = <0x40000000 0x10000>;
317317
gpio-controller;
318318
#gpio-cells = <2>;
319+
clocks = <&clk>;
319320
};
320321
};
321322

Documentation/devicetree/bindings/gpio/8xxx_gpio.txt

Lines changed: 0 additions & 72 deletions
This file was deleted.

Documentation/devicetree/bindings/gpio/abilis,tb10x-gpio.txt

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/gpio/abilis,tb10x-gpio.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Abilis TB10x GPIO controller
8+
9+
maintainers:
10+
- Christian Ruppert <[email protected]>
11+
12+
properties:
13+
compatible:
14+
const: abilis,tb10x-gpio
15+
16+
reg:
17+
maxItems: 1
18+
19+
gpio-controller: true
20+
21+
'#gpio-cells':
22+
const: 2
23+
24+
gpio-ranges: true
25+
26+
gpio-ranges-group-names: true
27+
28+
interrupt-controller: true
29+
30+
'#interrupt-cells':
31+
const: 1
32+
description: Interrupts are triggered on both edges
33+
34+
interrupts:
35+
maxItems: 1
36+
37+
abilis,ngpio:
38+
description: Number of GPIO pins this driver controls
39+
$ref: /schemas/types.yaml#/definitions/uint32
40+
41+
required:
42+
- compatible
43+
- reg
44+
- gpio-controller
45+
- '#gpio-cells'
46+
- abilis,ngpio
47+
48+
additionalProperties: false
49+
50+
examples:
51+
- |
52+
gpio@ff140000 {
53+
compatible = "abilis,tb10x-gpio";
54+
interrupt-controller;
55+
#interrupt-cells = <1>;
56+
interrupts = <27 2>;
57+
reg = <0xff140000 0x1000>;
58+
gpio-controller;
59+
#gpio-cells = <2>;
60+
abilis,ngpio = <3>;
61+
gpio-ranges = <&iomux 0 0 0>;
62+
gpio-ranges-group-names = "gpioa_pins";
63+
};
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/gpio/altr-pio-1.0.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Altera GPIO controller
8+
9+
maintainers:
10+
- Dinh Nguyen <[email protected]>
11+
- Marek Vasut <[email protected]>
12+
- Mathieu Malaterre <[email protected]>
13+
- Tien Hock Loh <[email protected]>
14+
15+
properties:
16+
compatible:
17+
const: altr,pio-1.0
18+
19+
reg:
20+
maxItems: 1
21+
22+
gpio-controller: true
23+
24+
"#gpio-cells":
25+
const: 2
26+
description:
27+
First cell is the GPIO offset number. Second cell is reserved and
28+
currently unused.
29+
30+
interrupts:
31+
maxItems: 1
32+
33+
interrupt-controller: true
34+
35+
"#interrupt-cells":
36+
const: 2
37+
38+
altr,ngpio:
39+
$ref: /schemas/types.yaml#/definitions/uint32
40+
description: Width of the GPIO bank.
41+
default: 32
42+
43+
altr,interrupt-type:
44+
$ref: /schemas/types.yaml#/definitions/uint32
45+
description: >
46+
Specifies the interrupt trigger type synthesized by hardware.
47+
Values defined in <dt-bindings/interrupt-controller/irq.h>.
48+
enum: [1, 2, 3, 4]
49+
50+
required:
51+
- compatible
52+
- reg
53+
- gpio-controller
54+
- "#gpio-cells"
55+
- interrupts
56+
- interrupt-controller
57+
- "#interrupt-cells"
58+
59+
additionalProperties: false
60+
61+
examples:
62+
- |
63+
#include <dt-bindings/interrupt-controller/irq.h>
64+
65+
gpio@ff200000 {
66+
compatible = "altr,pio-1.0";
67+
reg = <0xff200000 0x10>;
68+
interrupts = <45 4>;
69+
interrupt-controller;
70+
#interrupt-cells = <2>;
71+
gpio-controller;
72+
#gpio-cells = <2>;
73+
altr,ngpio = <32>;
74+
altr,interrupt-type = <IRQ_TYPE_EDGE_RISING>;
75+
};
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/apm,xgene-gpio-sb.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: APM X-Gene Standby GPIO controller
8+
9+
maintainers:
10+
- Khuong Dinh <[email protected]>
11+
12+
description: |
13+
This is a gpio controller in the standby domain. It also supports interrupt in
14+
some particular pins which are sourced to its parent interrupt controller
15+
as diagram below:
16+
+-----------------+
17+
| X-Gene standby |
18+
| GPIO controller +------ GPIO_0
19+
+------------+ | | ...
20+
| Parent IRQ | EXT_INT_0 | +------ GPIO_8/EXT_INT_0
21+
| controller | (SPI40) | | ...
22+
| (GICv2) +--------------+ +------ GPIO_[N+8]/EXT_INT_N
23+
| | ... | |
24+
| | EXT_INT_N | +------ GPIO_[N+9]
25+
| | (SPI[40 + N])| | ...
26+
| +--------------+ +------ GPIO_MAX
27+
+------------+ +-----------------+
28+
29+
properties:
30+
compatible:
31+
const: apm,xgene-gpio-sb
32+
33+
reg:
34+
maxItems: 1
35+
36+
'#gpio-cells':
37+
const: 2
38+
39+
gpio-controller: true
40+
41+
interrupts:
42+
description:
43+
List of interrupt specifiers for EXT_INT_0 through EXT_INT_N. The first
44+
entry must correspond to EXT_INT_0.
45+
46+
'#interrupt-cells':
47+
const: 2
48+
description:
49+
First cell selects EXT_INT_N (0-N), second cell specifies flags
50+
51+
interrupt-controller: true
52+
53+
apm,nr-gpios:
54+
$ref: /schemas/types.yaml#/definitions/uint32
55+
description: Number of GPIO pins
56+
57+
apm,nr-irqs:
58+
$ref: /schemas/types.yaml#/definitions/uint32
59+
description: Number of interrupt pins
60+
61+
apm,irq-start:
62+
$ref: /schemas/types.yaml#/definitions/uint32
63+
description: Lowest GPIO pin supporting interrupts
64+
65+
required:
66+
- compatible
67+
- reg
68+
- '#gpio-cells'
69+
- gpio-controller
70+
- interrupts
71+
- '#interrupt-cells'
72+
- interrupt-controller
73+
74+
additionalProperties: false
75+
76+
examples:
77+
- |
78+
gpio@17001000 {
79+
compatible = "apm,xgene-gpio-sb";
80+
reg = <0x17001000 0x400>;
81+
#gpio-cells = <2>;
82+
gpio-controller;
83+
interrupts = <0x0 0x28 0x1>,
84+
<0x0 0x29 0x1>,
85+
<0x0 0x2a 0x1>,
86+
<0x0 0x2b 0x1>,
87+
<0x0 0x2c 0x1>,
88+
<0x0 0x2d 0x1>;
89+
#interrupt-cells = <2>;
90+
interrupt-controller;
91+
apm,nr-gpios = <22>;
92+
apm,nr-irqs = <6>;
93+
apm,irq-start = <8>;
94+
};

0 commit comments

Comments
 (0)