Skip to content

Commit 2c96606

Browse files
committed
Merge tag 'gpio-updates-for-v6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio updates from Bartosz Golaszewski: "We have some new drivers, significant refactoring of existing intel platforms, lots of improvements all around, mass conversion to using immutable irqchips by drivers that had not been converted individually yet and some changes in the core library code. Summary: New drivers: - add a driver for the Loongson GPIO controller - add a driver for the fxl6408 I2C GPIO expander - add a GPIO module containing code common for Intel Elkhart Lake and Merrifield platforms - add a driver for the Intel Elkhart Lake platform reusing the code from the intel tangier library GPIOLIB core: - GPIO ACPI improvements - simplify gpiochip_add_data_with_keys() fwnode handling - cleanup header inclusions (remove unneeded ones, order the rest alphabetically) - remove duplicate code (reuse krealloc() instead of open-coding it, drop a duplicated check in gpiod_find_and_request()) - reshuffle the code to remove unnecessary forward declarations - coding style cleanups and improvements - add a helper for accessing device fwnodes - small updates in docs Driver improvements: - convert all remaining GPIO irqchip drivers to using immutable irqchips - drop unnecessary of_match_ptr() macro expansions - shrink the code in gpio-merrifield significantly by reusing the code from gpio-tangier + minor tweaks to the driver code - remove MODULE_LICENSE() from drivers that can only be built-in - add device-tree support to gpio-loongson1 - use new regmap features in gpio-104-dio-48e and gpio-pcie-idio-24 - minor tweaks and fixes to gpio-xra1403, gpio-sim, gpio-tegra194, gpio-omap, gpio-aspeed, gpio-raspberrypi-exp - shrink code in gpio-ich and gpio-pxa - Kconfig tweak for gpio-pmic-eic-sprd" * tag 'gpio-updates-for-v6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: (99 commits) gpio: gpiolib: Simplify gpiochip_add_data_with_key() fwnode gpiolib: Add gpiochip_set_data() helper gpiolib: Move gpiochip_get_data() higher in the code gpiolib: Check array_info for NULL only once in gpiod_get_array() gpiolib: Replace open coded krealloc() gpiolib: acpi: Add a ignore wakeup quirk for Clevo NL5xNU gpiolib: acpi: Move ACPI device NULL check to acpi_get_driver_gpio_data() gpiolib: acpi: use the fwnode in acpi_gpiochip_find() gpio: mm-lantiq: Fix typo in the newly added header filename sh: mach-x3proto: Add missing #include <linux/gpio/driver.h> powerpc/40x: Add missing select OF_GPIO_MM_GPIOCHIP gpio: xlp: Convert to immutable irq_chip gpio: xilinx: Convert to immutable irq_chip gpio: xgs-iproc: Convert to immutable irq_chip gpio: visconti: Convert to immutable irq_chip gpio: tqmx86: Convert to immutable irq_chip gpio: thunderx: Convert to immutable irq_chip gpio: stmpe: Convert to immutable irq_chip gpio: siox: Convert to immutable irq_chip gpio: rda: Convert to immutable irq_chip ...
2 parents d849557 + 8a4adcf commit 2c96606

109 files changed

Lines changed: 2411 additions & 1363 deletions

File tree

Some content is hidden

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

Documentation/admin-guide/gpio/sysfs.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ requested using gpio_request()::
145145
/* export the GPIO to userspace */
146146
int gpiod_export(struct gpio_desc *desc, bool direction_may_change);
147147

148-
/* reverse gpio_export() */
148+
/* reverse gpiod_export() */
149149
void gpiod_unexport(struct gpio_desc *desc);
150150

151151
/* create a sysfs link to an exported GPIO node */
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/gpio/fcs,fxl6408.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Fairchild FXL6408 I2C GPIO Expander
8+
9+
maintainers:
10+
- Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
11+
12+
properties:
13+
compatible:
14+
enum:
15+
- fcs,fxl6408
16+
17+
reg:
18+
maxItems: 1
19+
20+
"#gpio-cells":
21+
const: 2
22+
23+
gpio-controller: true
24+
25+
gpio-line-names:
26+
minItems: 1
27+
maxItems: 8
28+
29+
patternProperties:
30+
"^(hog-[0-9]+|.+-hog(-[0-9]+)?)$":
31+
required:
32+
- gpio-hog
33+
34+
required:
35+
- compatible
36+
- reg
37+
- gpio-controller
38+
- "#gpio-cells"
39+
40+
additionalProperties: false
41+
42+
examples:
43+
- |
44+
i2c {
45+
#address-cells = <1>;
46+
#size-cells = <0>;
47+
48+
gpio_expander_43: gpio-expander@43 {
49+
compatible = "fcs,fxl6408";
50+
reg = <0x43>;
51+
gpio-controller;
52+
#gpio-cells = <2>;
53+
gpio-line-names = "Wi-Fi_W_DISABLE", "Wi-Fi_WKUP_WLAN",
54+
"PWR_EN_+V3.3_WiFi_N", "PCIe_REF_CLK_EN",
55+
"USB_RESET_N", "USB_BYPASS_N", "Wi-Fi_PDn",
56+
"Wi-Fi_WKUP_BT";
57+
};
58+
};

Documentation/devicetree/bindings/gpio/gpio.txt

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,35 @@ of the GPIOs that can't be used.
154154

155155
Optionally, a GPIO controller may have a "gpio-line-names" property. This is
156156
an array of strings defining the names of the GPIO lines going out of the
157-
GPIO controller. This name should be the most meaningful producer name
158-
for the system, such as a rail name indicating the usage. Package names
159-
such as pin name are discouraged: such lines have opaque names (since they
160-
are by definition generic purpose) and such names are usually not very
161-
helpful. For example "MMC-CD", "Red LED Vdd" and "ethernet reset" are
162-
reasonable line names as they describe what the line is used for. "GPIO0"
163-
is not a good name to give to a GPIO line. Placeholders are discouraged:
164-
rather use the "" (blank string) if the use of the GPIO line is undefined
165-
in your design. The names are assigned starting from line offset 0 from
166-
left to right from the passed array. An incomplete array (where the number
167-
of passed named are less than ngpios) will still be used up until the last
168-
provided valid line index.
157+
GPIO controller.
158+
159+
For lines which are routed to on-board devices, this name should be
160+
the most meaningful producer name for the system, such as a rail name
161+
indicating the usage. Package names, such as a pin name, are discouraged:
162+
such lines have opaque names (since they are by definition general-purpose)
163+
and such names are usually not very helpful. For example "MMC-CD", "Red LED
164+
Vdd" and "ethernet reset" are reasonable line names as they describe what
165+
the line is used for. "GPIO0" is not a good name to give to a GPIO line
166+
that is hard-wired to a specific device.
167+
168+
However, in the case of lines that are routed to a general purpose header
169+
(e.g. the Raspberry Pi 40-pin header), and therefore are not hard-wired to
170+
specific devices, using a pin number or the names on the header is fine
171+
provided these are real (preferably unique) names. Using an SoC's pad name
172+
or package name, or names made up from kernel-internal software constructs,
173+
are strongly discouraged. For example "pin8 [gpio14/uart0_txd]" is fine
174+
if the board's documentation labels pin 8 as such. However "PortB_24" (an
175+
example of a name from an SoC's reference manual) would not be desirable.
176+
177+
In either case placeholders are discouraged: rather use the "" (blank
178+
string) if the use of the GPIO line is undefined in your design. Ideally,
179+
try to add comments to the dts file describing the naming the convention
180+
you have chosen, and specifying from where the names are derived.
181+
182+
The names are assigned starting from line offset 0, from left to right,
183+
from the passed array. An incomplete array (where the number of passed
184+
names is less than ngpios) will be used up until the last provided valid
185+
line index.
169186

170187
Example:
171188

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/gpio/loongson,ls-gpio.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Loongson GPIO controller.
8+
9+
maintainers:
10+
- Yinbo Zhu <zhuyinbo@loongson.cn>
11+
12+
properties:
13+
compatible:
14+
enum:
15+
- loongson,ls2k-gpio
16+
- loongson,ls7a-gpio
17+
18+
reg:
19+
maxItems: 1
20+
21+
ngpios:
22+
minimum: 1
23+
maximum: 64
24+
25+
"#gpio-cells":
26+
const: 2
27+
28+
gpio-controller: true
29+
30+
gpio-ranges: true
31+
32+
interrupts:
33+
minItems: 1
34+
maxItems: 64
35+
36+
required:
37+
- compatible
38+
- reg
39+
- ngpios
40+
- "#gpio-cells"
41+
- gpio-controller
42+
- gpio-ranges
43+
- interrupts
44+
45+
additionalProperties: false
46+
47+
examples:
48+
- |
49+
#include <dt-bindings/interrupt-controller/irq.h>
50+
51+
gpio0: gpio@1fe00500 {
52+
compatible = "loongson,ls2k-gpio";
53+
reg = <0x1fe00500 0x38>;
54+
ngpios = <64>;
55+
#gpio-cells = <2>;
56+
gpio-controller;
57+
gpio-ranges = <&pctrl 0 0 15>,
58+
<&pctrl 16 16 15>,
59+
<&pctrl 32 32 10>,
60+
<&pctrl 44 44 20>;
61+
interrupt-parent = <&liointc1>;
62+
interrupts = <28 IRQ_TYPE_LEVEL_LOW>,
63+
<29 IRQ_TYPE_LEVEL_LOW>,
64+
<30 IRQ_TYPE_LEVEL_LOW>,
65+
<30 IRQ_TYPE_LEVEL_LOW>,
66+
<26 IRQ_TYPE_LEVEL_LOW>,
67+
<26 IRQ_TYPE_LEVEL_LOW>,
68+
<26 IRQ_TYPE_LEVEL_LOW>,
69+
<26 IRQ_TYPE_LEVEL_LOW>,
70+
<26 IRQ_TYPE_LEVEL_LOW>,
71+
<26 IRQ_TYPE_LEVEL_LOW>,
72+
<26 IRQ_TYPE_LEVEL_LOW>,
73+
<26 IRQ_TYPE_LEVEL_LOW>,
74+
<26 IRQ_TYPE_LEVEL_LOW>,
75+
<26 IRQ_TYPE_LEVEL_LOW>,
76+
<26 IRQ_TYPE_LEVEL_LOW>,
77+
<>,
78+
<26 IRQ_TYPE_LEVEL_LOW>,
79+
<26 IRQ_TYPE_LEVEL_LOW>,
80+
<26 IRQ_TYPE_LEVEL_LOW>,
81+
<26 IRQ_TYPE_LEVEL_LOW>,
82+
<26 IRQ_TYPE_LEVEL_LOW>,
83+
<26 IRQ_TYPE_LEVEL_LOW>,
84+
<26 IRQ_TYPE_LEVEL_LOW>,
85+
<26 IRQ_TYPE_LEVEL_LOW>,
86+
<26 IRQ_TYPE_LEVEL_LOW>,
87+
<26 IRQ_TYPE_LEVEL_LOW>,
88+
<26 IRQ_TYPE_LEVEL_LOW>,
89+
<26 IRQ_TYPE_LEVEL_LOW>,
90+
<26 IRQ_TYPE_LEVEL_LOW>,
91+
<26 IRQ_TYPE_LEVEL_LOW>,
92+
<26 IRQ_TYPE_LEVEL_LOW>,
93+
<26 IRQ_TYPE_LEVEL_LOW>,
94+
<27 IRQ_TYPE_LEVEL_LOW>,
95+
<27 IRQ_TYPE_LEVEL_LOW>,
96+
<27 IRQ_TYPE_LEVEL_LOW>,
97+
<27 IRQ_TYPE_LEVEL_LOW>,
98+
<27 IRQ_TYPE_LEVEL_LOW>,
99+
<>,
100+
<27 IRQ_TYPE_LEVEL_LOW>,
101+
<27 IRQ_TYPE_LEVEL_LOW>,
102+
<27 IRQ_TYPE_LEVEL_LOW>,
103+
<27 IRQ_TYPE_LEVEL_LOW>,
104+
<>,
105+
<>,
106+
<27 IRQ_TYPE_LEVEL_LOW>,
107+
<27 IRQ_TYPE_LEVEL_LOW>,
108+
<27 IRQ_TYPE_LEVEL_LOW>,
109+
<27 IRQ_TYPE_LEVEL_LOW>,
110+
<27 IRQ_TYPE_LEVEL_LOW>,
111+
<27 IRQ_TYPE_LEVEL_LOW>,
112+
<27 IRQ_TYPE_LEVEL_LOW>,
113+
<27 IRQ_TYPE_LEVEL_LOW>,
114+
<27 IRQ_TYPE_LEVEL_LOW>,
115+
<27 IRQ_TYPE_LEVEL_LOW>,
116+
<27 IRQ_TYPE_LEVEL_LOW>,
117+
<27 IRQ_TYPE_LEVEL_LOW>,
118+
<27 IRQ_TYPE_LEVEL_LOW>,
119+
<27 IRQ_TYPE_LEVEL_LOW>,
120+
<27 IRQ_TYPE_LEVEL_LOW>,
121+
<27 IRQ_TYPE_LEVEL_LOW>,
122+
<27 IRQ_TYPE_LEVEL_LOW>,
123+
<27 IRQ_TYPE_LEVEL_LOW>,
124+
<27 IRQ_TYPE_LEVEL_LOW>,
125+
<27 IRQ_TYPE_LEVEL_LOW>;
126+
};
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/gpio/loongson,ls1x-gpio.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Loongson-1 GPIO controller
8+
9+
maintainers:
10+
- Keguang Zhang <keguang.zhang@gmail.com>
11+
12+
properties:
13+
compatible:
14+
const: loongson,ls1x-gpio
15+
16+
reg:
17+
maxItems: 1
18+
19+
gpio-controller: true
20+
21+
"#gpio-cells":
22+
const: 2
23+
24+
ngpios:
25+
minimum: 1
26+
maximum: 32
27+
28+
required:
29+
- compatible
30+
- reg
31+
- gpio-controller
32+
- "#gpio-cells"
33+
- ngpios
34+
35+
additionalProperties: false
36+
37+
examples:
38+
- |
39+
gpio0: gpio@1fd010c0 {
40+
compatible = "loongson,ls1x-gpio";
41+
reg = <0x1fd010c0 0x4>;
42+
43+
gpio-controller;
44+
#gpio-cells = <2>;
45+
46+
ngpios = <32>;
47+
};
48+
49+
...

Documentation/driver-api/gpio/driver.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,10 @@ not support open drain/open source in hardware, the GPIO library will instead
218218
use a trick: when a line is set as output, if the line is flagged as open
219219
drain, and the IN output value is low, it will be driven low as usual. But
220220
if the IN output value is set to high, it will instead *NOT* be driven high,
221-
instead it will be switched to input, as input mode is high impedance, thus
222-
achieving an "open drain emulation" of sorts: electrically the behaviour will
223-
be identical, with the exception of possible hardware glitches when switching
224-
the mode of the line.
221+
instead it will be switched to input, as input mode is an equivalent to
222+
high impedance, thus achieving an "open drain emulation" of sorts: electrically
223+
the behaviour will be identical, with the exception of possible hardware glitches
224+
when switching the mode of the line.
225225

226226
For open source configuration the same principle is used, just that instead
227227
of actively driving the line low, it is set to input.

Documentation/driver-api/gpio/legacy.rst

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,6 @@ setup or driver probe/teardown code, so this is an easy constraint.)::
238238
## gpio_free_array()
239239

240240
gpio_free()
241-
gpio_set_debounce()
242-
243241

244242

245243
Claiming and Releasing GPIOs
@@ -716,27 +714,6 @@ gpiochip nodes (possibly in conjunction with schematics) to determine
716714
the correct GPIO number to use for a given signal.
717715

718716

719-
Exporting from Kernel code
720-
--------------------------
721-
Kernel code can explicitly manage exports of GPIOs which have already been
722-
requested using gpio_request()::
723-
724-
/* export the GPIO to userspace */
725-
int gpio_export(unsigned gpio, bool direction_may_change);
726-
727-
/* reverse gpio_export() */
728-
void gpio_unexport();
729-
730-
After a kernel driver requests a GPIO, it may only be made available in
731-
the sysfs interface by gpio_export(). The driver can control whether the
732-
signal direction may change. This helps drivers prevent userspace code
733-
from accidentally clobbering important system state.
734-
735-
This explicit exporting can help with debugging (by making some kinds
736-
of experiments easier), or can provide an always-there interface that's
737-
suitable for documenting as part of a board support package.
738-
739-
740717
API Reference
741718
=============
742719

Documentation/translations/zh_CN/driver-api/gpio/legacy.rst

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ GPIO 值的命令需要等待其信息排到队首才发送命令,再获得其
219219
## gpio_free_array()
220220

221221
gpio_free()
222-
gpio_set_debounce()
223222

224223

225224

@@ -654,25 +653,6 @@ GPIO 控制器的路径类似 /sys/class/gpio/gpiochip42/ (对于从#42 GPIO
654653
确定给定信号所用的 GPIO 编号。
655654

656655

657-
从内核代码中导出
658-
----------------
659-
660-
内核代码可以明确地管理那些已通过 gpio_request()申请的 GPIO 的导出::
661-
662-
/* 导出 GPIO 到用户空间 */
663-
int gpio_export(unsigned gpio, bool direction_may_change);
664-
665-
/* gpio_export()的逆操作 */
666-
void gpio_unexport();
667-
668-
在一个内核驱动申请一个 GPIO 之后,它可以通过 gpio_export()使其在 sysfs
669-
接口中可见。该驱动可以控制信号方向是否可修改。这有助于防止用户空间代码无意间
670-
破坏重要的系统状态。
671-
672-
这个明确的导出有助于(通过使某些实验更容易来)调试,也可以提供一个始终存在的接口,
673-
与文档配合作为板级支持包的一部分。
674-
675-
676656
API参考
677657
=======
678658

0 commit comments

Comments
 (0)