Skip to content

Commit 131561f

Browse files
committed
Merge tag 'gpio-updates-for-v6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio updates from Bartosz Golaszewski: "Three new drivers, support for some new models in existing ones and lots of various tweaks and improvements across the board (switching to using recommended APIs, code shrink and simplification, etc.). Also a new feature in the character device uAPI where we now notify the user-space about changes triggered by in-kernel users as well, not only when they were done by other user-space agents. Summary: GPIOLIB core: - use the new mem_is_zero() instead of memchr_inv(s, 0, n) - don't store debounce period twice needlessly - clean-up debugfs handling - remove leftover comments referring to no longer used spinlocks - unduplicate some operations like SRCU locks and initializing GPIO descriptors - constify the sysfs class struct - use lock guards in GPIO sysfs code - update GPIO uAPI internal flags all at once atomically for consistency with other places - modify the behavior of the sysfs interface by no longer exporting lines that are named inside the driver code or board files with the sysfs links bearing the line names as this has for many years been largely unused due to the prevalence of DT, ACPI and firmware nodes over board files and made the API inconsistent - for GPIO interrupt providers: free irqs that are still requested by users when removing the chip GPIO uAPI: - notify user-space about changes to GPIO lines' state (requested, released, reconfigured) triggered from the kernel as well (until now we'd only do this for changes triggered from user-space) - to that end: modify the internal workings of the notification mechanism by switching to an atomic notifier which allows us to send events from atomic context - also to that end store the debounce period in the GPIO descriptor struct and not in the character device context struct - while at it, also cover the corner-case of users introducing changes over sysfs while others watch them via the character device - don't report GPIO lines requested as interrupts as "used" to user-space as it can still request them as GPIOs New drivers: - GPIO part of the MFD Congatec Board Controller - PolarFire GPIO controller - GPIOs on FTDI FT2232H Driver improvements: - use generic device property accessors instead of OF-specific ones across many GPIO drivers (mpc8xxx, vf610, eic-sprd, davinci, ts4900, xilinx, mvebu) - use devres helpers to simplify error paths and either shrink or entirely remove the driver's remove() callback (grgpio, amdpt, menz127, max730x, ftgpio010, 74x164, ljca) - use helper variables to store the address of pdev->dev and avoid some line-breaks - use device_for_each_child_node_scoped() to avoid having to put the fwnode on breaks or errors (gpio-sim, gpio-dwapb, gpiolib-acpi) - use a scoped bitmap to simplify the code and drop goto labels in gpio-aggregator - drop unneeded Kconfig dependencies on OF_GPIO (grgpio, mveby, xilinx) - add support for new models to gpio-aspeed, gpio-rockchip and gpio-dwapb - clean-up ACPI handling and some other bits in gpio-xgene-sb - replace deprecated PCI functions in pcie-idio-24 and pci-idio-16 - allow to build davinci and mvebu drivers with COMPILE_TEST=y - remove dead code in gpio-mb86s7x - switch back to using platform_driver::remove() (after the conversion to remove_new()) across the GPIO drivers - remove remaining uses of GPIOF_ACTIVE_LOW across the tree and drop this deprecated symbol - convert the gpio-altera driver to no longer pull in the deprecated legacy-of-mm-gpiochip.h header - use of_property_present() instead of of_property_read_bool() in gpiolib-of and gpio-rockchip - allow to build the tegra186 driver on Tegra234 platforms in Kconfig Late fixes: - add a missing return value check after devm_kasprintf() to gpio-grgpio DT bindings: - document the ngpios property of gpio-mmio - add support for a new aspeed model - fix the example for st,nomadik-gpio Other: - kernel doc and comments tweaks - fix typos in TODO - reorder headers alphabetically in some drivers - fix incorrect format specifiers in gpio tools" * tag 'gpio-updates-for-v6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: (98 commits) gpio: tegra186: Allow to enable driver on Tegra234 gpio: grgpio: Add NULL check in grgpio_probe tools: gpio: Fix several incorrect format specifiers gpio: mpfs: add CoreGPIO support gpio: rockchip: support new version GPIO gpio: rockchip: change the GPIO version judgment logic gpio: rockchip: explan the format of the GPIO version ID gpiolib: cdev: use !mem_is_zero() instead of memchr_inv(s, 0, n) MAINTAINERS: add gpio driver to PolarFire entry gpio: Get rid of GPIOF_ACTIVE_LOW USB: gadget: pxa27x_udc: Avoid using GPIOF_ACTIVE_LOW pcmcia: soc_common: Avoid using GPIOF_ACTIVE_LOW leds: gpio: Avoid using GPIOF_ACTIVE_LOW Input: gpio_keys_polled - avoid using GPIOF_ACTIVE_LOW Input: gpio_keys - avoid using GPIOF_ACTIVE_LOW gpio: Use of_property_present() for non-boolean properties gpio: mpfs: add polarfire soc gpio support gpio: altera: Drop legacy-of-mm-gpiochip.h header gpio: pcie-idio-24: Replace deprecated PCI functions gpio: pci-idio-16: Replace deprecated PCI functions ...
2 parents 7d75606 + bef29ca commit 131561f

Some content is hidden

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

73 files changed

+3246
-1065
lines changed

Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ properties:
1515
- aspeed,ast2400-gpio
1616
- aspeed,ast2500-gpio
1717
- aspeed,ast2600-gpio
18+
- aspeed,ast2700-gpio
1819

1920
reg:
2021
maxItems: 1
@@ -25,7 +26,7 @@ properties:
2526

2627
gpio-controller: true
2728
gpio-line-names:
28-
minItems: 36
29+
minItems: 12
2930
maxItems: 232
3031

3132
gpio-ranges: true
@@ -42,7 +43,7 @@ properties:
4243
const: 2
4344

4445
ngpios:
45-
minimum: 36
46+
minimum: 12
4647
maximum: 232
4748

4849
required:
@@ -93,6 +94,20 @@ allOf:
9394
enum: [ 36, 208 ]
9495
required:
9596
- ngpios
97+
- if:
98+
properties:
99+
compatible:
100+
contains:
101+
const: aspeed,ast2700-gpio
102+
then:
103+
properties:
104+
gpio-line-names:
105+
minItems: 12
106+
maxItems: 216
107+
ngpios:
108+
enum: [ 12, 216 ]
109+
required:
110+
- ngpios
96111

97112
additionalProperties: false
98113

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ properties:
3737
description:
3838
A list of registers in the controller. The width of each register is
3939
determined by its size. All registers must have the same width. The number
40-
of GPIOs is set by the width, with bit 0 corresponding to GPIO 0.
40+
of GPIOs is set by the width, with bit 0 corresponding to GPIO 0, unless
41+
the ngpios property further restricts the number of used lines.
4142
items:
4243
- description:
4344
Register to READ the value of the GPIO lines. If GPIO line is high,
@@ -74,6 +75,15 @@ properties:
7475

7576
native-endian: true
7677

78+
ngpios:
79+
minimum: 1
80+
maximum: 63
81+
description:
82+
If this property is present the number of usable GPIO lines are restricted
83+
to the first 0 .. ngpios lines. This is useful when the GPIO MMIO register
84+
has 32 bits for GPIO but only the first 12 are actually connected to
85+
real electronics, and then we set ngpios to 12.
86+
7787
no-output:
7888
$ref: /schemas/types.yaml#/definitions/flag
7989
description:
@@ -111,6 +121,7 @@ examples:
111121
compatible = "brcm,bcm6345-gpio";
112122
reg-names = "dirout", "dat";
113123
reg = <0xfffe0406 2>, <0xfffe040a 2>;
124+
ngpios = <15>;
114125
native-endian;
115126
gpio-controller;
116127
#gpio-cells = <2>;

Documentation/devicetree/bindings/gpio/st,nomadik-gpio.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ examples:
8989
interrupts = <0 120 0x4>;
9090
#gpio-cells = <2>;
9191
gpio-controller;
92+
#interrupt-cells = <2>;
9293
interrupt-controller;
9394
st,supports-sleepmode;
9495
gpio-bank = <1>;

MAINTAINERS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5741,6 +5741,15 @@ F: fs/configfs/
57415741
F: include/linux/configfs.h
57425742
F: samples/configfs/
57435743

5744+
CONGATEC BOARD CONTROLLER MFD DRIVER
5745+
M: Thomas Richard <thomas.richard@bootlin.com>
5746+
S: Maintained
5747+
F: drivers/gpio/gpio-cgbc.c
5748+
F: drivers/i2c/busses/i2c-cgbc.c
5749+
F: drivers/mfd/cgbc-core.c
5750+
F: drivers/watchdog/cgbc_wdt.c
5751+
F: include/linux/mfd/cgbc.h
5752+
57445753
CONSOLE SUBSYSTEM
57455754
M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
57465755
S: Supported
@@ -19879,6 +19888,7 @@ F: arch/riscv/boot/dts/microchip/
1987919888
F: drivers/char/hw_random/mpfs-rng.c
1988019889
F: drivers/clk/microchip/clk-mpfs*.c
1988119890
F: drivers/firmware/microchip/mpfs-auto-update.c
19891+
F: drivers/gpio/gpio-mpfs.c
1988219892
F: drivers/i2c/busses/i2c-microchip-corei2c.c
1988319893
F: drivers/mailbox/mailbox-mpfs.c
1988419894
F: drivers/pci/controller/plda/pcie-microchip-host.c

drivers/gpio/Kconfig

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ config GPIO_SYSFS
7070
ioctl() operations instead.
7171

7272
config GPIO_CDEV
73-
bool
74-
prompt "Character device (/dev/gpiochipN) support" if EXPERT
73+
bool "Character device (/dev/gpiochipN) support" if EXPERT
7574
default y
7675
help
7776
Say Y here to add the character device /dev/gpiochipN interface
@@ -149,9 +148,7 @@ config GPIO_74XX_MMIO
149148

150149
config GPIO_ALTERA
151150
tristate "Altera GPIO"
152-
depends on OF_GPIO
153151
select GPIOLIB_IRQCHIP
154-
select OF_GPIO_MM_GPIOCHIP
155152
help
156153
Say Y or M here to build support for the Altera PIO device.
157154

@@ -243,7 +240,7 @@ config GPIO_CLPS711X
243240
config GPIO_DAVINCI
244241
tristate "TI Davinci/Keystone GPIO support"
245242
default y if ARCH_DAVINCI
246-
depends on (ARM || ARM64) && (ARCH_DAVINCI || ARCH_KEYSTONE || ARCH_K3)
243+
depends on ((ARM || ARM64) && (ARCH_DAVINCI || ARCH_KEYSTONE || ARCH_K3)) || COMPILE_TEST
247244
help
248245
Say yes here to enable GPIO support for TI Davinci/Keystone SoCs.
249246

@@ -341,7 +338,6 @@ config GPIO_GRANITERAPIDS
341338

342339
config GPIO_GRGPIO
343340
tristate "Aeroflex Gaisler GRGPIO support"
344-
depends on OF_GPIO
345341
select GPIO_GENERIC
346342
select IRQ_DOMAIN
347343
help
@@ -487,8 +483,7 @@ config GPIO_MT7621
487483

488484
config GPIO_MVEBU
489485
def_bool y
490-
depends on PLAT_ORION || ARCH_MVEBU
491-
depends on OF_GPIO
486+
depends on PLAT_ORION || ARCH_MVEBU || COMPILE_TEST
492487
select GENERIC_IRQ_CHIP
493488
select REGMAP_MMIO
494489

@@ -549,6 +544,12 @@ config GPIO_PL061
549544
help
550545
Say yes here to support the PrimeCell PL061 GPIO device.
551546

547+
config GPIO_POLARFIRE_SOC
548+
bool "Microchip FPGA GPIO support"
549+
select REGMAP_MMIO
550+
help
551+
Say yes here to support the GPIO controllers on Microchip FPGAs.
552+
552553
config GPIO_PXA
553554
bool "PXA GPIO support"
554555
depends on ARCH_PXA || ARCH_MMP || COMPILE_TEST
@@ -714,13 +715,13 @@ config GPIO_TEGRA
714715

715716
config GPIO_TEGRA186
716717
tristate "NVIDIA Tegra186 GPIO support"
717-
default ARCH_TEGRA_186_SOC || ARCH_TEGRA_194_SOC
718-
depends on ARCH_TEGRA_186_SOC || ARCH_TEGRA_194_SOC || COMPILE_TEST
718+
default ARCH_TEGRA_186_SOC || ARCH_TEGRA_194_SOC || ARCH_TEGRA_234_SOC
719+
depends on ARCH_TEGRA_186_SOC || ARCH_TEGRA_194_SOC || ARCH_TEGRA_234_SOC || COMPILE_TEST
719720
depends on OF_GPIO
720721
select GPIOLIB_IRQCHIP
721722
select IRQ_DOMAIN_HIERARCHY
722723
help
723-
Say yes here to support GPIO pins on NVIDIA Tegra186 SoCs.
724+
Say yes here to support GPIO pins on NVIDIA Tegra186, 194 and 234 SoCs.
724725

725726
config GPIO_TS4800
726727
tristate "TS-4800 DIO blocks and compatibles"
@@ -796,7 +797,6 @@ config GPIO_XGENE_SB
796797
config GPIO_XILINX
797798
tristate "Xilinx GPIO support"
798799
select GPIOLIB_IRQCHIP
799-
depends on OF_GPIO
800800
help
801801
Say yes here to support the Xilinx FPGA GPIO device.
802802

@@ -1287,6 +1287,16 @@ config GPIO_BD9571MWV
12871287
This driver can also be built as a module. If so, the module
12881288
will be called gpio-bd9571mwv.
12891289

1290+
config GPIO_CGBC
1291+
tristate "Congatec Board Controller GPIO support"
1292+
depends on MFD_CGBC
1293+
help
1294+
Select this option to enable GPIO support for the Congatec Board
1295+
Controller.
1296+
1297+
This driver can also be built as a module. If so, the module will be
1298+
called gpio-cgbc.
1299+
12901300
config GPIO_CROS_EC
12911301
tristate "ChromeOS EC GPIO support"
12921302
depends on CROS_EC
@@ -1844,6 +1854,13 @@ config GPIO_VIPERBOARD
18441854
River Tech's viperboard.h for detailed meaning
18451855
of the module parameters.
18461856

1857+
config GPIO_MPSSE
1858+
tristate "FTDI MPSSE GPIO support"
1859+
select GPIOLIB_IRQCHIP
1860+
help
1861+
GPIO driver for FTDI's MPSSE interface. These can do input and
1862+
output. Each MPSSE provides 16 IO pins.
1863+
18471864
endmenu
18481865

18491866
menu "Virtual GPIO drivers"

drivers/gpio/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ obj-$(CONFIG_GPIO_BD9571MWV) += gpio-bd9571mwv.o
4545
obj-$(CONFIG_GPIO_BRCMSTB) += gpio-brcmstb.o
4646
obj-$(CONFIG_GPIO_BT8XX) += gpio-bt8xx.o
4747
obj-$(CONFIG_GPIO_CADENCE) += gpio-cadence.o
48+
obj-$(CONFIG_GPIO_CGBC) += gpio-cgbc.o
4849
obj-$(CONFIG_GPIO_CLPS711X) += gpio-clps711x.o
4950
obj-$(CONFIG_GPIO_SNPS_CREG) += gpio-creg-snps.o
5051
obj-$(CONFIG_GPIO_CROS_EC) += gpio-cros-ec.o
@@ -114,6 +115,7 @@ obj-$(CONFIG_GPIO_MOCKUP) += gpio-mockup.o
114115
obj-$(CONFIG_GPIO_MOXTET) += gpio-moxtet.o
115116
obj-$(CONFIG_GPIO_MPC5200) += gpio-mpc5200.o
116117
obj-$(CONFIG_GPIO_MPC8XXX) += gpio-mpc8xxx.o
118+
obj-$(CONFIG_GPIO_MPSSE) += gpio-mpsse.o
117119
obj-$(CONFIG_GPIO_MSC313) += gpio-msc313.o
118120
obj-$(CONFIG_GPIO_MT7621) += gpio-mt7621.o
119121
obj-$(CONFIG_GPIO_MVEBU) += gpio-mvebu.o
@@ -133,6 +135,7 @@ obj-$(CONFIG_GPIO_PCI_IDIO_16) += gpio-pci-idio-16.o
133135
obj-$(CONFIG_GPIO_PISOSR) += gpio-pisosr.o
134136
obj-$(CONFIG_GPIO_PL061) += gpio-pl061.o
135137
obj-$(CONFIG_GPIO_PMIC_EIC_SPRD) += gpio-pmic-eic-sprd.o
138+
obj-$(CONFIG_GPIO_POLARFIRE_SOC) += gpio-mpfs.o
136139
obj-$(CONFIG_GPIO_PXA) += gpio-pxa.o
137140
obj-$(CONFIG_GPIO_RASPBERRYPI_EXP) += gpio-raspberrypi-exp.o
138141
obj-$(CONFIG_GPIO_RC5T583) += gpio-rc5t583.o

drivers/gpio/TODO

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ Work items:
6161

6262
- Change all consumer drivers that #include <linux/of_gpio.h> to
6363
#include <linux/gpio/consumer.h> and stop doing custom parsing of the
64-
GPIO lines from the device tree. This can be tricky and often ivolves
65-
changing boardfiles, etc.
64+
GPIO lines from the device tree. This can be tricky and often involves
65+
changing board files, etc.
6666

6767
- Pull semantics for legacy device tree (OF) GPIO lookups into
6868
gpiolib-of.c: in some cases subsystems are doing custom flags and

drivers/gpio/gpio-74x164.c

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -143,33 +143,24 @@ static int gen_74x164_probe(struct spi_device *spi)
143143
chip->gpio_chip.parent = &spi->dev;
144144
chip->gpio_chip.owner = THIS_MODULE;
145145

146-
mutex_init(&chip->lock);
146+
ret = devm_mutex_init(&spi->dev, &chip->lock);
147+
if (ret)
148+
return ret;
147149

148150
ret = __gen_74x164_write_config(chip);
149-
if (ret) {
150-
dev_err(&spi->dev, "Failed writing: %d\n", ret);
151-
goto exit_destroy;
152-
}
151+
if (ret)
152+
return dev_err_probe(&spi->dev, ret, "Config write failed\n");
153153

154154
gpiod_set_value_cansleep(chip->gpiod_oe, 1);
155155

156-
ret = gpiochip_add_data(&chip->gpio_chip, chip);
157-
if (!ret)
158-
return 0;
159-
160-
exit_destroy:
161-
mutex_destroy(&chip->lock);
162-
163-
return ret;
156+
return devm_gpiochip_add_data(&spi->dev, &chip->gpio_chip, chip);
164157
}
165158

166159
static void gen_74x164_remove(struct spi_device *spi)
167160
{
168161
struct gen_74x164_chip *chip = spi_get_drvdata(spi);
169162

170163
gpiod_set_value_cansleep(chip->gpiod_oe, 0);
171-
gpiochip_remove(&chip->gpio_chip);
172-
mutex_destroy(&chip->lock);
173164
}
174165

175166
static const struct spi_device_id gen_74x164_spi_ids[] = {

drivers/gpio/gpio-aggregator.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ static int aggr_parse(struct gpio_aggregator *aggr)
6565
{
6666
char *args = skip_spaces(aggr->args);
6767
char *name, *offsets, *p;
68-
unsigned long *bitmap;
6968
unsigned int i, n = 0;
7069
int error = 0;
7170

72-
bitmap = bitmap_alloc(AGGREGATOR_MAX_GPIOS, GFP_KERNEL);
71+
unsigned long *bitmap __free(bitmap) =
72+
bitmap_alloc(AGGREGATOR_MAX_GPIOS, GFP_KERNEL);
7373
if (!bitmap)
7474
return -ENOMEM;
7575

@@ -82,7 +82,7 @@ static int aggr_parse(struct gpio_aggregator *aggr)
8282
/* Named GPIO line */
8383
error = aggr_add_gpio(aggr, name, U16_MAX, &n);
8484
if (error)
85-
goto free_bitmap;
85+
return error;
8686

8787
name = offsets;
8888
continue;
@@ -92,26 +92,24 @@ static int aggr_parse(struct gpio_aggregator *aggr)
9292
error = bitmap_parselist(offsets, bitmap, AGGREGATOR_MAX_GPIOS);
9393
if (error) {
9494
pr_err("Cannot parse %s: %d\n", offsets, error);
95-
goto free_bitmap;
95+
return error;
9696
}
9797

9898
for_each_set_bit(i, bitmap, AGGREGATOR_MAX_GPIOS) {
9999
error = aggr_add_gpio(aggr, name, i, &n);
100100
if (error)
101-
goto free_bitmap;
101+
return error;
102102
}
103103

104104
args = next_arg(args, &name, &p);
105105
}
106106

107107
if (!n) {
108108
pr_err("No GPIOs specified\n");
109-
error = -EINVAL;
109+
return -EINVAL;
110110
}
111111

112-
free_bitmap:
113-
bitmap_free(bitmap);
114-
return error;
112+
return 0;
115113
}
116114

117115
static ssize_t new_device_store(struct device_driver *driver, const char *buf,

0 commit comments

Comments
 (0)