Skip to content

Commit b05ddad

Browse files
committed
Merge tag 'gpio-updates-for-v6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio updates from Bartosz Golaszewski: "We don't have any new drivers. The loongson driver is getting extended with support for new models. There's a big refactor of gpio-pca953x and many small improvements to others. The GPIO code in the kernel has acquired a lot of cruft over the years as well as many abusers of the API across the kernel tree. This release cycle we have started a major cleanup and improvement effort that will most likely span several releases. We have started by converting external users of struct gpio_chip to accessing the wrapper around it - struct gpio_device. This is because the latter is reference counted while the former is removed when the provider is unbound. We also removed several instances of drivers accessing private GPIOLIB structures and including the private header from drivers/gpio/. To that end you'll see several commits aimed at different subsystems (acked by relevant maintainers) as well as two merges from the x86/platform tree. We'll then rework the locking in GPIOLIB which currently uses a big spinlock for many different things and could use becoming more fine-grained, especially as it doesn't even get the locking right. We'll also use SRCU for protecting the gpio_chip pointer against in-kernel hot-unplug crashes similar to what we saw triggered from user-space and fixed with semaphores in gpiolib-cdev. The core GPIOLIB is still vulnerable to these use-cases. I'm just mentioning the plans here, this is not part of this PR. You'll see some new instances of using __free(). We've added a gpio_device_put cleanup helper similar to the put_device one introduced by Peter Zijlstra and used it according to the preferred pattern except where it didn't make sense. GPIOLIB core: - provide interfaces allowing users to retrieve, manage and query the reference counted GPIO device instead of accessing the private gpio_chip structure - replace gpiochip_find() with gpio_device_find() - remove unused acpi_get_and_request_gpiod() - improve the ignore_interrupt functionality in GPIO ACPI - correct notifier return codes in gpiolib-of - unexport gpiod_set_transitory() as it's unused outside of core GPIO code - while there are still external users accessing struct gpio_chip, let's make gpiochip_get_desc() public so that they at least use the preferred helper - improve locking for lookup tables - annotate struct linereq with __counted_by - improve GPIOLIB docs - add an OF quirk for LED trigger sources Driver improvements: - convert all GPIO drivers with .remove() callbacks to using the new variant returning void instead of int - stop accessing the GPIOLIB private structures in gpio-mockup, i2c-mux-gpio, hte-tegra194, gpio-sim - use the recommended pattern for autofree variables in gpio-sim - add support for more models to gpio-loongson - use a notifier chain to notify other blocks about interrupts in gpio-eic-sprd instead of looking up GPIO devices on every interrupt - convert gpio-pca953x and gpio-fx6408 to using the maple tree regmap cache - don't include GPIOLIB internal headers in drivers which don't need them - move the ingenic NAND quirk into gpiolib-of - add an ignore interrupt quirk for Peaq C1010 - drop static GPIO base from gpio-omap, gpio-f7188x - use the preferred device_get_match_data() function in drivers that still don't - refactor gpio-pca953x: switch to using DEFINE_SIMPLE_DEV_PM_OPS(), use cleanup helpers, use dev_err_probe() where it makes sense, fully convert to using devres and some other minor tweaks DT bindings: - add support for a new model to gpio-vf610 and update existing properties - add support for more loongson models - add missing support for imx models that are used but undocumented - convert bindings for Intel IXP4xx to schema Minor stuff: - deprecate gpio-mockup in favor of gpio-sim - include missing headers here and there - stop using gpiochip_find() in OMAP1 board files - minor tweaks in gpio-vf610, gpio-hisi - remove unneeded 'extern' specifiers from headers" * tag 'gpio-updates-for-v6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: (108 commits) hte: tegra194: add GPIOLIB dependency hte: tegra194: don't access struct gpio_chip gpiolib: provide gpio_device_get_base() i2c: mux: gpio: don't fiddle with GPIOLIB internals gpiolib: provide gpiod_to_gpio_device() gpiolib: provide gpio_device_to_device() gpio: hisi: Fix format specifier gpiolib: provide gpio_device_find_by_fwnode() gpio: acpi: remove acpi_get_and_request_gpiod() gpio: Use device_get_match_data() gpio: vf610: update comment for i.MX8ULP and i.MX93 legacy compatibles platform/x86: int3472: Switch to devm_get_gpiod() platform/x86: int3472: Stop using gpiod_toggle_active_low() platform/x86: int3472: Add new skl_int3472_gpiod_get_from_temp_lookup() helper platform/x86: int3472: Add new skl_int3472_fill_gpiod_lookup() helper gpio: vf610: simplify code by dropping data check gpio: vf610: add i.MX8ULP of_device_id entry dt-bindings: gpio: vf610: add i.MX95 compatible dt-bindings: gpio: vf610: correct i.MX8ULP and i.MX93 dt-bindings: gpio: vf610: update gpio-ranges ...
2 parents ad1871a + 9bc6331 commit b05ddad

Some content is hidden

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

71 files changed

+1333
-924
lines changed

Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,17 @@ properties:
1818
- fsl,imx31-gpio
1919
- fsl,imx35-gpio
2020
- fsl,imx7d-gpio
21+
- items:
22+
- enum:
23+
- fsl,imx27-gpio
24+
- const: fsl,imx21-gpio
2125
- items:
2226
- const: fsl,imx35-gpio
2327
- const: fsl,imx31-gpio
28+
- items:
29+
- enum:
30+
- fsl,imx25-gpio
31+
- const: fsl,imx35-gpio
2432
- items:
2533
- enum:
2634
- fsl,imx50-gpio

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

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,26 @@ description: |
2020
properties:
2121
compatible:
2222
oneOf:
23+
- const: fsl,imx8ulp-gpio
2324
- const: fsl,vf610-gpio
2425
- items:
2526
- const: fsl,imx7ulp-gpio
2627
- const: fsl,vf610-gpio
2728
- items:
2829
- enum:
2930
- fsl,imx93-gpio
30-
- fsl,imx8ulp-gpio
31-
- const: fsl,imx7ulp-gpio
31+
- fsl,imx95-gpio
32+
- const: fsl,imx8ulp-gpio
3233

3334
reg:
34-
description: The first reg tuple represents the PORT module, the second tuple
35-
represents the GPIO module.
35+
minItems: 1
3636
maxItems: 2
3737

3838
interrupts:
39-
maxItems: 1
39+
items:
40+
- description: GPIO Trustzone non-secure interrupt number
41+
- description: GPIO Trustzone secure interrupt number
42+
minItems: 1
4043

4144
interrupt-controller: true
4245

@@ -59,7 +62,8 @@ properties:
5962
- const: port
6063

6164
gpio-ranges:
62-
maxItems: 1
65+
minItems: 1
66+
maxItems: 4
6367

6468
patternProperties:
6569
"^.+-hog(-[0-9]+)?$":
@@ -77,6 +81,30 @@ required:
7781
- "#gpio-cells"
7882
- gpio-controller
7983

84+
allOf:
85+
- if:
86+
properties:
87+
compatible:
88+
contains:
89+
enum:
90+
- fsl,vf610-gpio
91+
- fsl,imx7ulp-gpio
92+
then:
93+
properties:
94+
interrupts:
95+
maxItems: 1
96+
reg:
97+
items:
98+
- description: PORT register base address
99+
- description: GPIO register base address
100+
else:
101+
properties:
102+
interrupts:
103+
minItems: 2
104+
reg:
105+
items:
106+
- description: GPIO register base address
107+
80108
additionalProperties: false
81109

82110
examples:

Documentation/devicetree/bindings/gpio/intel,ixp4xx-gpio.txt

Lines changed: 0 additions & 38 deletions
This file was deleted.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/gpio/intel,ixp4xx-gpio.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Intel IXP4xx XScale Networking Processors GPIO Controller
8+
9+
description: |
10+
This GPIO controller is found in the Intel IXP4xx
11+
processors. It supports 16 GPIO lines.
12+
The interrupt portions of the GPIO controller is hierarchical.
13+
The synchronous edge detector is part of the GPIO block, but the
14+
actual enabling/disabling of the interrupt line is done in the
15+
main IXP4xx interrupt controller which has a 1-to-1 mapping for
16+
the first 12 GPIO lines to 12 system interrupts.
17+
The remaining 4 GPIO lines can not be used for receiving
18+
interrupts.
19+
The interrupt parent of this GPIO controller must be the
20+
IXP4xx interrupt controller.
21+
GPIO 14 and 15 can be used as clock outputs rather than GPIO,
22+
and this can be enabled by a special flag.
23+
24+
maintainers:
25+
- Linus Walleij <[email protected]>
26+
27+
properties:
28+
compatible:
29+
const: intel,ixp4xx-gpio
30+
31+
reg:
32+
maxItems: 1
33+
34+
gpio-controller: true
35+
36+
"#gpio-cells":
37+
const: 2
38+
39+
interrupt-controller: true
40+
41+
"#interrupt-cells":
42+
const: 2
43+
44+
intel,ixp4xx-gpio14-clkout:
45+
description: If defined, enables clock output on GPIO 14
46+
instead of GPIO.
47+
type: boolean
48+
49+
intel,ixp4xx-gpio15-clkout:
50+
description: If defined, enables clock output on GPIO 15
51+
instead of GPIO.
52+
type: boolean
53+
54+
required:
55+
- compatible
56+
- reg
57+
- "#gpio-cells"
58+
- interrupt-controller
59+
- "#interrupt-cells"
60+
61+
additionalProperties: false
62+
63+
examples:
64+
- |
65+
#include <dt-bindings/interrupt-controller/irq.h>
66+
gpio@c8004000 {
67+
compatible = "intel,ixp4xx-gpio";
68+
reg = <0xc8004000 0x1000>;
69+
gpio-controller;
70+
#gpio-cells = <2>;
71+
interrupt-controller;
72+
#interrupt-cells = <2>;
73+
};

Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,22 @@ maintainers:
1111

1212
properties:
1313
compatible:
14-
enum:
15-
- loongson,ls2k-gpio
16-
- loongson,ls7a-gpio
14+
oneOf:
15+
- enum:
16+
- loongson,ls2k-gpio
17+
- loongson,ls2k0500-gpio0
18+
- loongson,ls2k0500-gpio1
19+
- loongson,ls2k2000-gpio0
20+
- loongson,ls2k2000-gpio1
21+
- loongson,ls2k2000-gpio2
22+
- loongson,ls3a5000-gpio
23+
- loongson,ls7a-gpio
24+
- items:
25+
- const: loongson,ls2k1000-gpio
26+
- const: loongson,ls2k-gpio
27+
- items:
28+
- const: loongson,ls7a1000-gpio
29+
- const: loongson,ls7a-gpio
1730

1831
reg:
1932
maxItems: 1
@@ -49,7 +62,7 @@ examples:
4962
#include <dt-bindings/interrupt-controller/irq.h>
5063
5164
gpio0: gpio@1fe00500 {
52-
compatible = "loongson,ls2k-gpio";
65+
compatible = "loongson,ls2k1000-gpio", "loongson,ls2k-gpio";
5366
reg = <0x1fe00500 0x38>;
5467
ngpios = <64>;
5568
#gpio-cells = <2>;

Documentation/driver-api/gpio/consumer.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ warnings. These stubs are used for two use cases:
2929
will use it under other compile-time configurations. In this case the
3030
consumer must make sure not to call into these functions, or the user will
3131
be met with console warnings that may be perceived as intimidating.
32+
Combining truly optional GPIOLIB usage with calls to
33+
``[devm_]gpiod_get_optional()`` is a *bad idea*, and will result in weird
34+
error messages. Use the ordinary getter functions with optional GPIOLIB:
35+
some open coding of error handling should be expected when you do this.
3236

3337
All the functions that work with the descriptor-based GPIO interface are
3438
prefixed with ``gpiod_``. The ``gpio_`` prefix is used for the legacy

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2224,7 +2224,7 @@ M: Imre Kaloz <[email protected]>
22242224
L: [email protected] (moderated for non-subscribers)
22252225
S: Maintained
22262226
F: Documentation/devicetree/bindings/arm/intel-ixp4xx.yaml
2227-
F: Documentation/devicetree/bindings/gpio/intel,ixp4xx-gpio.txt
2227+
F: Documentation/devicetree/bindings/gpio/intel,ixp4xx-gpio.yaml
22282228
F: Documentation/devicetree/bindings/interrupt-controller/intel,ixp4xx-interrupt.yaml
22292229
F: Documentation/devicetree/bindings/memory-controllers/intel,ixp4xx-expansion*
22302230
F: Documentation/devicetree/bindings/rng/intel,ixp46x-rng.yaml

arch/arm/mach-omap1/board-ams-delta.c

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -561,22 +561,6 @@ static struct gpiod_lookup_table *ams_delta_gpio_tables[] __initdata = {
561561
&ams_delta_nand_gpio_table,
562562
};
563563

564-
/*
565-
* Some drivers may not use GPIO lookup tables but need to be provided
566-
* with GPIO numbers. The same applies to GPIO based IRQ lines - some
567-
* drivers may even not use GPIO layer but expect just IRQ numbers.
568-
* We could either define GPIO lookup tables then use them on behalf
569-
* of those devices, or we can use GPIO driver level methods for
570-
* identification of GPIO and IRQ numbers. For the purpose of the latter,
571-
* defina a helper function which identifies GPIO chips by their labels.
572-
*/
573-
static int gpiochip_match_by_label(struct gpio_chip *chip, void *data)
574-
{
575-
char *label = data;
576-
577-
return !strcmp(label, chip->label);
578-
}
579-
580564
static struct gpiod_hog ams_delta_gpio_hogs[] = {
581565
GPIO_HOG(LATCH2_LABEL, LATCH2_PIN_KEYBRD_DATAOUT, "keybrd_dataout",
582566
GPIO_ACTIVE_HIGH, GPIOD_OUT_LOW),
@@ -616,14 +600,28 @@ static void __init modem_assign_irq(struct gpio_chip *chip)
616600
*/
617601
static void __init omap_gpio_deps_init(void)
618602
{
603+
struct gpio_device *gdev;
619604
struct gpio_chip *chip;
620605

621-
chip = gpiochip_find(OMAP_GPIO_LABEL, gpiochip_match_by_label);
622-
if (!chip) {
623-
pr_err("%s: OMAP GPIO chip not found\n", __func__);
606+
/*
607+
* Some drivers may not use GPIO lookup tables but need to be provided
608+
* with GPIO numbers. The same applies to GPIO based IRQ lines - some
609+
* drivers may even not use GPIO layer but expect just IRQ numbers.
610+
* We could either define GPIO lookup tables then use them on behalf
611+
* of those devices, or we can use GPIO driver level methods for
612+
* identification of GPIO and IRQ numbers.
613+
*
614+
* This reference will be leaked but that's alright as this device
615+
* never goes down.
616+
*/
617+
gdev = gpio_device_find_by_label(OMAP_GPIO_LABEL);
618+
if (!gdev) {
619+
pr_err("%s: OMAP GPIO device not found\n", __func__);
624620
return;
625621
}
626622

623+
chip = gpio_device_get_chip(gdev);
624+
627625
/*
628626
* Start with FIQ initialization as it may have to request
629627
* and release successfully each OMAP GPIO pin in turn.

arch/arm/mach-omap1/board-palmte.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@
5151
#define PALMTE_HDQ_GPIO 11
5252
#define PALMTE_HEADPHONES_GPIO 14
5353
#define PALMTE_SPEAKER_GPIO 15
54-
#define PALMTE_DC_GPIO OMAP_MPUIO(2)
55-
#define PALMTE_MMC_SWITCH_GPIO OMAP_MPUIO(4)
56-
#define PALMTE_MMC1_GPIO OMAP_MPUIO(6)
57-
#define PALMTE_MMC2_GPIO OMAP_MPUIO(7)
58-
#define PALMTE_MMC3_GPIO OMAP_MPUIO(11)
5954

6055
static const unsigned int palmte_keymap[] = {
6156
KEY(0, 0, KEY_F1), /* Calendar */

drivers/gpio/Kconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1790,9 +1790,11 @@ config GPIO_LATCH
17901790
connected to other GPIOs.
17911791

17921792
config GPIO_MOCKUP
1793-
tristate "GPIO Testing Driver"
1793+
tristate "GPIO Testing Driver (DEPRECATED)"
17941794
select IRQ_SIM
17951795
help
1796+
This module is DEPRECATED. Please consider using gpio-sim instead.
1797+
17961798
This enables GPIO Testing driver, which provides a way to test GPIO
17971799
subsystem through sysfs (or char device) and debugfs.
17981800
User could use it through the script in

0 commit comments

Comments
 (0)