All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] gpio: realtek-otto: add pinctrl support
@ 2026-08-20  7:14 misha.zavertkin
  2026-08-20  7:14 ` [PATCH v3 1/2] dt-bindings: gpio: otto-gpio: Add gpio-ranges misha.zavertkin
  2026-08-20  7:14 ` [PATCH v3 2/2] gpio: realtek-otto: add pinctrl support misha.zavertkin
  0 siblings, 2 replies; 4+ messages in thread
From: misha.zavertkin @ 2026-08-20  7:14 UTC (permalink / raw)
  To: linux-gpio
  Cc: Linus Walleij, Bartosz Golaszewski, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Sander Vanheule,
	Bert Vermeulen, devicetree, linux-kernel, Michael Zavertkin

This series adds pinctrl support for RTL9607C and referes it
in documentation.

Signed-off-by: Michael Zavertkin <misha.zavertkin@mail.ru>
---
Changes in v3:
- 'gpio-ranges' is optional in dt-bindings
- pinctrl supported for all SoCs (no-op if disabled in configuration)
- Dropped Reviewed-by (patch changed)
- Link to v2: https://patch.msgid.link/cover.1787130560.git.misha.zavertkin@mail.ru

Changes in v2:
- Add 'required' property to dt-bindings
- Dropped the ellipsis and added Reviewed-by
- Link to v1: https://patch.msgid.link/amRpvtNAwIQak_9y@gamepc
---
Michael Zavertkin (2):
  dt-bindings: gpio: otto-gpio: Add gpio-ranges
  gpio: realtek-otto: add pinctrl support

 .../devicetree/bindings/gpio/realtek,otto-gpio.yaml          | 2 ++
 drivers/gpio/gpio-realtek-otto.c                             | 5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)

-- 
2.54.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3 1/2] dt-bindings: gpio: otto-gpio: Add gpio-ranges
  2026-08-20  7:14 [PATCH v3 0/2] gpio: realtek-otto: add pinctrl support misha.zavertkin
@ 2026-08-20  7:14 ` misha.zavertkin
  2026-08-20  7:14 ` [PATCH v3 2/2] gpio: realtek-otto: add pinctrl support misha.zavertkin
  1 sibling, 0 replies; 4+ messages in thread
From: misha.zavertkin @ 2026-08-20  7:14 UTC (permalink / raw)
  To: linux-gpio
  Cc: Linus Walleij, Bartosz Golaszewski, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Sander Vanheule,
	Bert Vermeulen, devicetree, linux-kernel, Michael Zavertkin

Add 'gpio-ranges' optional property to reflect driver changes.

Signed-off-by: Michael Zavertkin <misha.zavertkin@mail.ru>
---
 Documentation/devicetree/bindings/gpio/realtek,otto-gpio.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/gpio/realtek,otto-gpio.yaml b/Documentation/devicetree/bindings/gpio/realtek,otto-gpio.yaml
index b18f8f0ca0ae..33c25df7b815 100644
--- a/Documentation/devicetree/bindings/gpio/realtek,otto-gpio.yaml
+++ b/Documentation/devicetree/bindings/gpio/realtek,otto-gpio.yaml
@@ -40,6 +40,8 @@ properties:
 
   gpio-controller: true
 
+  gpio-ranges: true
+
   ngpios:
     minimum: 1
     maximum: 32
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v3 2/2] gpio: realtek-otto: add pinctrl support
  2026-08-20  7:14 [PATCH v3 0/2] gpio: realtek-otto: add pinctrl support misha.zavertkin
  2026-08-20  7:14 ` [PATCH v3 1/2] dt-bindings: gpio: otto-gpio: Add gpio-ranges misha.zavertkin
@ 2026-08-20  7:14 ` misha.zavertkin
  2026-08-20  7:39   ` sashiko-bot
  1 sibling, 1 reply; 4+ messages in thread
From: misha.zavertkin @ 2026-08-20  7:14 UTC (permalink / raw)
  To: linux-gpio
  Cc: Linus Walleij, Bartosz Golaszewski, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Sander Vanheule,
	Bert Vermeulen, devicetree, linux-kernel, Michael Zavertkin

RTL9607C relies on pinctrl to mux SoC pins. Use pinctrl to request pins
for GPIO.
pinctrl driver for other SoCs might be implemented later.

Signed-off-by: Michael Zavertkin <misha.zavertkin@mail.ru>
---
 drivers/gpio/gpio-realtek-otto.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-realtek-otto.c b/drivers/gpio/gpio-realtek-otto.c
index 4a606bad5848..01be8baa25c3 100644
--- a/drivers/gpio/gpio-realtek-otto.c
+++ b/drivers/gpio/gpio-realtek-otto.c
@@ -393,13 +393,14 @@ static int realtek_gpio_probe(struct platform_device *pdev)
 
 	raw_spin_lock_init(&ctrl->lock);
 
+	gen_gc_flags = GPIO_GENERIC_PINCTRL_BACKEND;
+
 	if (dev_flags & GPIO_PORTS_REVERSED) {
-		gen_gc_flags = 0;
 		ctrl->bank_read = realtek_gpio_bank_read;
 		ctrl->bank_write = realtek_gpio_bank_write;
 		ctrl->line_imr_pos = realtek_gpio_line_imr_pos;
 	} else {
-		gen_gc_flags = GPIO_GENERIC_BIG_ENDIAN_BYTE_ORDER;
+		gen_gc_flags |= GPIO_GENERIC_BIG_ENDIAN_BYTE_ORDER;
 		ctrl->bank_read = realtek_gpio_bank_read_swapped;
 		ctrl->bank_write = realtek_gpio_bank_write_swapped;
 		ctrl->line_imr_pos = realtek_gpio_line_imr_pos_swapped;
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 2/2] gpio: realtek-otto: add pinctrl support
  2026-08-20  7:14 ` [PATCH v3 2/2] gpio: realtek-otto: add pinctrl support misha.zavertkin
@ 2026-08-20  7:39   ` sashiko-bot
  0 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-08-20  7:39 UTC (permalink / raw)
  To: misha.zavertkin; +Cc: devicetree, conor+dt, robh

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [Critical] Unconditionally enabling GPIO_GENERIC_PINCTRL_BACKEND breaks GPIO direction configuration on SoCs that do not yet have a pinctrl driver.

Pre-existing issues:
- [High] Silent failure when optional IRQ probe defers.
--

--- Patch [2]: [PATCH v3 2/2] gpio: realtek-otto: add pinctrl support ---
commit c33b7f5187bd7fe916fbf0c1df13da9be88e7f72
Author: misha.zavertkin@mail.ru <misha.zavertkin@mail.ru>

gpio: realtek-otto: add pinctrl support

This patch adds pinctrl backend support to the Realtek Otto GPIO driver.
It utilizes pinctrl to request pins for GPIO on the RTL9607C SoC.

> diff --git a/drivers/gpio/gpio-realtek-otto.c b/drivers/gpio/gpio-realtek-otto.c
> index 37ef56f453187..b53c2a9a04c76 100644
> --- a/drivers/gpio/gpio-realtek-otto.c
> +++ b/drivers/gpio/gpio-realtek-otto.c
> @@ -394,13 +394,14 @@ static int realtek_gpio_probe(struct platform_device *pdev)
>  
>  	raw_spin_lock_init(&ctrl->lock);
>  
> +	gen_gc_flags = GPIO_GENERIC_PINCTRL_BACKEND;
> +

[Severity: Critical]
Does setting GPIO_GENERIC_PINCTRL_BACKEND unconditionally break GPIO
direction configuration on SoCs lacking a pinctrl driver?

Because pinctrl drivers for other SoCs are not yet implemented, setting
this flag forces gpio_mmio_dir_in() and gpio_mmio_dir_out() to route via
pinctrl_gpio_direction_*(). Since no pinctrl driver is registered for those
devices, won't this fail with -EPROBE_DEFER and completely break GPIO
output/input functionality?

>  	if (dev_flags & GPIO_PORTS_REVERSED) {
> -		gen_gc_flags = 0;

[ ... ]

[Severity: High]
This is a pre-existing issue, but does the optional irq check silently
discard probe deferrals?

drivers/gpio/gpio-realtek-otto.c:realtek_gpio_probe() {
	...
	irq = platform_get_irq_optional(pdev, 0);
	if (!(dev_flags & GPIO_INTERRUPTS_DISABLED) && irq > 0) {
		girq = &ctrl->chip.gc.irq;
	...
}

When platform_get_irq_optional() returns -EPROBE_DEFER because the parent
interrupt controller is not yet ready, the irq > 0 check silently discards
the error code. This can lead to the device permanently losing GPIO
interrupt support depending on boot timing.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1787209558.git.misha.zavertkin@mail.ru?part=2

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-20  7:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-20  7:14 [PATCH v3 0/2] gpio: realtek-otto: add pinctrl support misha.zavertkin
2026-08-20  7:14 ` [PATCH v3 1/2] dt-bindings: gpio: otto-gpio: Add gpio-ranges misha.zavertkin
2026-08-20  7:14 ` [PATCH v3 2/2] gpio: realtek-otto: add pinctrl support misha.zavertkin
2026-08-20  7:39   ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.