Skip to content

Commit 576db73

Browse files
committed
Merge tag 'gpio-updates-for-v6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio updates from Bartosz Golaszewski: "We have two new drivers, an assortment of updates and cleanups to many others, and first part of the big rework of the core GPIOLIB that's currently underway. Add to that some code shrink in the character device module and updates to DT bindings and that's pretty much it. Core GPIOLIB: - protect the global list of GPIO devices with a read-write semaphore as it is rarely modified but can be traversed by multiple readers at once - remove GPIO devices from the global list when they are *unregistered* and not when they are *released* (which only happens when the last reference is dropped) as this may lead to a successful lookup of an unregistered device - remove the unnecessary "extra_checks" switch - rename functions that are called with a lock taken - remove duplicate includes Character device handling: - use locking guards to reduce the code size - allocate the big linereq structure using the more suitable kvzalloc() - redulce the size of critical sections - improve documentation - move the debounce_period_us field out of struct gpio_desc New drivers: - Nuvoton NPCM SGPIO driver for BMC NPCM7xx/NPCM8xx - Realtek DHC (Digital Home Center) SoC GPIO driver Driver improvements: - replace gpiochip_is_requested() with a safer alternative in the form of gpiochip_dup_line_label() as the former returns a pointer to a string that can be deleted - implement the dbg_show() callback in gpio-sim - improve the coding style for local variables by removing unnecessary tabs - use generic device properties instead of OF variants in gpio-mmio - use the preferred coding style for __free() in gpio-mockup - reuse PM ops from the gpio-tangier in gpio-elkhartlake - rework PM and use cleanup helpers in gpio-tangier - fix the EIC configuration in gpio-pmic-eic-sprd - remove the unneeded call to platform_set_drvdata() in gpio-sifive - use generic GPIO helpers for driver callbacks in gpio-dwapb - add clock support on certain pins of gpio-ixp4xx - don't use the core-specific DEBUG_GPIO switch in drivers - kerneldoc improvements DT bindings: - add bindings for the new Realtek and Nuvoton devices - allow gpio-ranges in gpio-dwapb - support GPIO hogs in gpio-rockchip - describe the label property in gpio-zynqmp-modepin Other: - header cleanups - forward declarations cleanups" * tag 'gpio-updates-for-v6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: (55 commits) gpiolib: replace the GPIO device mutex with a read-write semaphore gpiolib: remove the GPIO device from the list when it's unregistered gpio: nuvoton: Add Nuvoton NPCM sgpio driver dt-bindings: gpio: add NPCM sgpio driver bindings gpio: rtd: Add support for Realtek DHC(Digital Home Center) RTD SoCs dt-bindings: gpio: realtek: Add realtek,rtd-gpio gpio: pmic-eic-sprd: Configure the bit corresponding to the EIC through offset gpio: dwapb: Use generic request, free and set_config gpio: sysfs: drop tabs from local variable declarations gpiolib: drop tabs from local variable declarations gpiolib: remove extra_checks gpio: tps65219: don't use CONFIG_DEBUG_GPIO gpiolib: cdev: replace locking wrappers for gpio_device with guards gpiolib: cdev: replace locking wrappers for config_mutex with guards gpiolib: cdev: allocate linereq using kvzalloc() gpiolib: cdev: include overflow.h gpiolib: cdev: reduce locking in gpio_desc_to_lineinfo() gpiolib: cdev: improve documentation of get/set values gpiolib: cdev: fully adopt guard() and scoped_guard() gpiolib: remove debounce_period_us from struct gpio_desc ...
2 parents 61f4c3e + 1979a28 commit 576db73

37 files changed

+2184
-701
lines changed

Documentation/devicetree/bindings/gpio/brcm,brcmstb-gpio.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ required:
7272
- reg
7373
- gpio-controller
7474
- "#gpio-cells"
75-
- "brcm,gpio-bank-widths"
75+
- brcm,gpio-bank-widths
7676

7777
additionalProperties: false
7878

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/gpio/nuvoton,sgpio.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Nuvoton SGPIO controller
8+
9+
maintainers:
10+
- Jim LIU <[email protected]>
11+
12+
description: |
13+
This SGPIO controller is for NUVOTON NPCM7xx and NPCM8xx SoC and detailed
14+
information is in the NPCM7XX/8XX SERIAL I/O EXPANSION INTERFACE section.
15+
Nuvoton NPCM7xx SGPIO module is combines a serial to parallel IC (HC595)
16+
and a parallel to serial IC (HC165).
17+
Clock is a division of the APB3 clock.
18+
This interface has 4 pins (D_out , D_in, S_CLK, LDSH).
19+
NPCM7xx/NPCM8xx have two sgpio modules. Each module can support up
20+
to 64 output pins, and up to 64 input pins, the pin is only for GPI or GPO.
21+
GPIO pins can be programmed to support the following options
22+
- Support interrupt option for each input port and various interrupt
23+
sensitivity options (level-high, level-low, edge-high, edge-low)
24+
- ngpios is number of nuvoton,input-ngpios GPIO lines and nuvoton,output-ngpios GPIO lines.
25+
nuvoton,input-ngpios GPIO lines is only for GPI.
26+
nuvoton,output-ngpios GPIO lines is only for GPO.
27+
28+
properties:
29+
compatible:
30+
enum:
31+
- nuvoton,npcm750-sgpio
32+
- nuvoton,npcm845-sgpio
33+
34+
reg:
35+
maxItems: 1
36+
37+
gpio-controller: true
38+
39+
'#gpio-cells':
40+
const: 2
41+
42+
interrupts:
43+
maxItems: 1
44+
45+
clocks:
46+
maxItems: 1
47+
48+
nuvoton,input-ngpios:
49+
$ref: /schemas/types.yaml#/definitions/uint32
50+
description:
51+
The numbers of GPIO's exposed. GPIO lines are only for GPI.
52+
minimum: 0
53+
maximum: 64
54+
55+
nuvoton,output-ngpios:
56+
$ref: /schemas/types.yaml#/definitions/uint32
57+
description:
58+
The numbers of GPIO's exposed. GPIO lines are only for GPO.
59+
minimum: 0
60+
maximum: 64
61+
62+
required:
63+
- compatible
64+
- reg
65+
- gpio-controller
66+
- '#gpio-cells'
67+
- interrupts
68+
- nuvoton,input-ngpios
69+
- nuvoton,output-ngpios
70+
- clocks
71+
72+
additionalProperties: false
73+
74+
examples:
75+
- |
76+
#include <dt-bindings/clock/nuvoton,npcm7xx-clock.h>
77+
#include <dt-bindings/interrupt-controller/arm-gic.h>
78+
gpio8: gpio@101000 {
79+
compatible = "nuvoton,npcm750-sgpio";
80+
reg = <0x101000 0x200>;
81+
clocks = <&clk NPCM7XX_CLK_APB3>;
82+
interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
83+
gpio-controller;
84+
#gpio-cells = <2>;
85+
nuvoton,input-ngpios = <64>;
86+
nuvoton,output-ngpios = <64>;
87+
};
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2+
# Copyright 2023 Realtek Semiconductor Corporation
3+
%YAML 1.2
4+
---
5+
$id: http://devicetree.org/schemas/gpio/realtek,rtd-gpio.yaml#
6+
$schema: http://devicetree.org/meta-schemas/core.yaml#
7+
8+
title: Realtek DHC GPIO controller
9+
10+
maintainers:
11+
- Tzuyi Chang <[email protected]>
12+
13+
description:
14+
The GPIO controller is designed for the Realtek DHC (Digital Home Center)
15+
RTD series SoC family, which are high-definition media processor SoCs.
16+
17+
properties:
18+
compatible:
19+
enum:
20+
- realtek,rtd1295-misc-gpio
21+
- realtek,rtd1295-iso-gpio
22+
- realtek,rtd1315e-iso-gpio
23+
- realtek,rtd1319-iso-gpio
24+
- realtek,rtd1319d-iso-gpio
25+
- realtek,rtd1395-iso-gpio
26+
- realtek,rtd1619-iso-gpio
27+
- realtek,rtd1619b-iso-gpio
28+
29+
reg:
30+
items:
31+
- description: GPIO controller registers
32+
- description: GPIO interrupt registers
33+
34+
interrupts:
35+
items:
36+
- description: Interrupt number of the assert GPIO interrupt, which is
37+
triggered when there is a rising edge.
38+
- description: Interrupt number of the deassert GPIO interrupt, which is
39+
triggered when there is a falling edge.
40+
41+
gpio-ranges: true
42+
43+
gpio-controller: true
44+
45+
"#gpio-cells":
46+
const: 2
47+
48+
required:
49+
- compatible
50+
- reg
51+
- interrupts
52+
- gpio-ranges
53+
- gpio-controller
54+
- "#gpio-cells"
55+
56+
additionalProperties: false
57+
58+
examples:
59+
- |
60+
gpio@100 {
61+
compatible = "realtek,rtd1319d-iso-gpio";
62+
reg = <0x100 0x100>,
63+
<0x0 0xb0>;
64+
interrupt-parent = <&iso_irq_mux>;
65+
interrupts = <19>, <20>;
66+
gpio-ranges = <&pinctrl 0 0 82>;
67+
gpio-controller;
68+
#gpio-cells = <2>;
69+
};

Documentation/devicetree/bindings/gpio/rockchip,gpio-bank.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ properties:
4141
"#interrupt-cells":
4242
const: 2
4343

44+
patternProperties:
45+
"^.+-hog(-[0-9]+)?$":
46+
type: object
47+
48+
required:
49+
- gpio-hog
50+
4451
required:
4552
- compatible
4653
- reg

Documentation/devicetree/bindings/gpio/snps,dw-apb-gpio.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ patternProperties:
6565
minItems: 1
6666
maxItems: 32
6767

68+
gpio-ranges: true
69+
6870
ngpios:
6971
default: 32
7072
minimum: 1

Documentation/devicetree/bindings/gpio/xlnx,zynqmp-gpio-modepin.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ properties:
2323
"#gpio-cells":
2424
const: 2
2525

26+
label: true
27+
2628
required:
2729
- compatible
2830
- gpio-controller
@@ -37,6 +39,7 @@ examples:
3739
compatible = "xlnx,zynqmp-gpio-modepin";
3840
gpio-controller;
3941
#gpio-cells = <2>;
42+
label = "modepin";
4043
};
4144
};
4245

drivers/gpio/Kconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,13 @@ config GPIO_MXS
478478
select GPIO_GENERIC
479479
select GENERIC_IRQ_CHIP
480480

481+
config GPIO_NPCM_SGPIO
482+
bool "Nuvoton SGPIO support"
483+
depends on ARCH_NPCM || COMPILE_TEST
484+
select GPIOLIB_IRQCHIP
485+
help
486+
Say Y here to support Nuvoton NPCM7XX/NPCM8XX SGPIO functionality.
487+
481488
config GPIO_OCTEON
482489
tristate "Cavium OCTEON GPIO"
483490
depends on CAVIUM_OCTEON_SOC
@@ -553,6 +560,19 @@ config GPIO_ROCKCHIP
553560
help
554561
Say yes here to support GPIO on Rockchip SoCs.
555562

563+
config GPIO_RTD
564+
tristate "Realtek DHC GPIO support"
565+
depends on ARCH_REALTEK
566+
default y
567+
select GPIOLIB_IRQCHIP
568+
help
569+
This option enables support for GPIOs found on Realtek DHC(Digital
570+
Home Center) SoCs family, including RTD1295, RTD1315E, RTD1319,
571+
RTD1319D, RTD1395, RTD1619 and RTD1619B.
572+
573+
Say yes here to support GPIO functionality and GPIO interrupt on
574+
Realtek DHC SoCs.
575+
556576
config GPIO_SAMA5D2_PIOBU
557577
tristate "SAMA5D2 PIOBU GPIO support"
558578
depends on MFD_SYSCON

drivers/gpio/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ obj-$(CONFIG_GPIO_MT7621) += gpio-mt7621.o
116116
obj-$(CONFIG_GPIO_MVEBU) += gpio-mvebu.o
117117
obj-$(CONFIG_GPIO_MXC) += gpio-mxc.o
118118
obj-$(CONFIG_GPIO_MXS) += gpio-mxs.o
119+
obj-$(CONFIG_GPIO_NPCM_SGPIO) += gpio-npcm-sgpio.o
119120
obj-$(CONFIG_GPIO_OCTEON) += gpio-octeon.o
120121
obj-$(CONFIG_GPIO_OMAP) += gpio-omap.o
121122
obj-$(CONFIG_GPIO_PALMAS) += gpio-palmas.o
@@ -137,6 +138,7 @@ obj-$(CONFIG_GPIO_RDC321X) += gpio-rdc321x.o
137138
obj-$(CONFIG_GPIO_REALTEK_OTTO) += gpio-realtek-otto.o
138139
obj-$(CONFIG_GPIO_REG) += gpio-reg.o
139140
obj-$(CONFIG_GPIO_ROCKCHIP) += gpio-rockchip.o
141+
obj-$(CONFIG_GPIO_RTD) += gpio-rtd.o
140142
obj-$(CONFIG_ARCH_SA1100) += gpio-sa1100.o
141143
obj-$(CONFIG_GPIO_SAMA5D2_PIOBU) += gpio-sama5d2-piobu.o
142144
obj-$(CONFIG_GPIO_SCH311X) += gpio-sch311x.o

drivers/gpio/gpio-dwapb.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -416,11 +416,12 @@ static int dwapb_gpio_set_config(struct gpio_chip *gc, unsigned offset,
416416
{
417417
u32 debounce;
418418

419-
if (pinconf_to_config_param(config) != PIN_CONFIG_INPUT_DEBOUNCE)
420-
return -ENOTSUPP;
419+
if (pinconf_to_config_param(config) == PIN_CONFIG_INPUT_DEBOUNCE) {
420+
debounce = pinconf_to_config_argument(config);
421+
return dwapb_gpio_set_debounce(gc, offset, debounce);
422+
}
421423

422-
debounce = pinconf_to_config_argument(config);
423-
return dwapb_gpio_set_debounce(gc, offset, debounce);
424+
return gpiochip_generic_config(gc, offset, config);
424425
}
425426

426427
static int dwapb_convert_irqs(struct dwapb_gpio_port_irqchip *pirq,
@@ -530,10 +531,14 @@ static int dwapb_gpio_add_port(struct dwapb_gpio *gpio,
530531
port->gc.fwnode = pp->fwnode;
531532
port->gc.ngpio = pp->ngpio;
532533
port->gc.base = pp->gpio_base;
534+
port->gc.request = gpiochip_generic_request;
535+
port->gc.free = gpiochip_generic_free;
533536

534537
/* Only port A support debounce */
535538
if (pp->idx == 0)
536539
port->gc.set_config = dwapb_gpio_set_config;
540+
else
541+
port->gc.set_config = gpiochip_generic_config;
537542

538543
/* Only port A can provide interrupts in all configurations of the IP */
539544
if (pp->idx == 0)

drivers/gpio/gpio-elkhartlake.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,6 @@ static int ehl_gpio_probe(struct platform_device *pdev)
5555
return 0;
5656
}
5757

58-
static int ehl_gpio_suspend(struct device *dev)
59-
{
60-
return tng_gpio_suspend(dev);
61-
}
62-
63-
static int ehl_gpio_resume(struct device *dev)
64-
{
65-
return tng_gpio_resume(dev);
66-
}
67-
68-
static DEFINE_SIMPLE_DEV_PM_OPS(ehl_gpio_pm_ops, ehl_gpio_suspend, ehl_gpio_resume);
69-
7058
static const struct platform_device_id ehl_gpio_ids[] = {
7159
{ "gpio-elkhartlake" },
7260
{ }
@@ -76,7 +64,7 @@ MODULE_DEVICE_TABLE(platform, ehl_gpio_ids);
7664
static struct platform_driver ehl_gpio_driver = {
7765
.driver = {
7866
.name = "gpio-elkhartlake",
79-
.pm = pm_sleep_ptr(&ehl_gpio_pm_ops),
67+
.pm = pm_sleep_ptr(&tng_gpio_pm_ops),
8068
},
8169
.probe = ehl_gpio_probe,
8270
.id_table = ehl_gpio_ids,

0 commit comments

Comments
 (0)