Devicetree
 help / color / mirror / Atom feed
* [PATCH v2 0/2] gpio: realtek-otto: add pinctrl support
@ 2026-08-19 15:51 misha.zavertkin
  2026-08-19 15:51 ` [PATCH v2 1/2] dt-bindings: gpio: otto-gpio: Add gpio-ranges misha.zavertkin
  2026-08-19 15:51 ` [PATCH v2 2/2] gpio: realtek-otto: add pinctrl support misha.zavertkin
  0 siblings, 2 replies; 4+ messages in thread
From: misha.zavertkin @ 2026-08-19 15:51 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 marks it as required
in documentation.
---
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

 .../bindings/gpio/realtek,otto-gpio.yaml           | 14 ++++++++++++++
 drivers/gpio/gpio-realtek-otto.c                   | 10 +++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

-- 
2.54.0


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

* [PATCH v2 1/2] dt-bindings: gpio: otto-gpio: Add gpio-ranges
  2026-08-19 15:51 [PATCH v2 0/2] gpio: realtek-otto: add pinctrl support misha.zavertkin
@ 2026-08-19 15:51 ` misha.zavertkin
  2026-08-19 16:12   ` sashiko-bot
  2026-08-19 15:51 ` [PATCH v2 2/2] gpio: realtek-otto: add pinctrl support misha.zavertkin
  1 sibling, 1 reply; 4+ messages in thread
From: misha.zavertkin @ 2026-08-19 15:51 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

Pinctrl is required for RTL9607C GPIOs to work, otherwise controller
won't be routed to SoC pins. Add corresponding requirement to
Documentation for realtek,rtl9607-gpio.

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

diff --git a/Documentation/devicetree/bindings/gpio/realtek,otto-gpio.yaml b/Documentation/devicetree/bindings/gpio/realtek,otto-gpio.yaml
index b18f8f0ca0ae..96396f968e78 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: false
+
   ngpios:
     minimum: 1
     maximum: 32
@@ -75,6 +77,18 @@ required:
   - "#gpio-cells"
   - gpio-controller
 
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: realtek,rtl9607-gpio
+    then:
+      properties:
+        gpio-ranges: true
+      required:
+        - gpio-ranges
+
 additionalProperties: false
 
 dependencies:
-- 
2.54.0


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

* [PATCH v2 2/2] gpio: realtek-otto: add pinctrl support
  2026-08-19 15:51 [PATCH v2 0/2] gpio: realtek-otto: add pinctrl support misha.zavertkin
  2026-08-19 15:51 ` [PATCH v2 1/2] dt-bindings: gpio: otto-gpio: Add gpio-ranges misha.zavertkin
@ 2026-08-19 15:51 ` misha.zavertkin
  1 sibling, 0 replies; 4+ messages in thread
From: misha.zavertkin @ 2026-08-19 15:51 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

Signed-off-by: Michael Zavertkin <misha.zavertkin@mail.ru>
Reviewed-by: Linus Walleij <linusw@kernel.org>
---
 drivers/gpio/gpio-realtek-otto.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-realtek-otto.c b/drivers/gpio/gpio-realtek-otto.c
index 4a606bad5848..86948da8adec 100644
--- a/drivers/gpio/gpio-realtek-otto.c
+++ b/drivers/gpio/gpio-realtek-otto.c
@@ -97,6 +97,11 @@ enum realtek_gpio_flags {
 	 * range, where the per-cpu enable masks are located.
 	 */
 	GPIO_INTERRUPTS_PER_CPU = BIT(2),
+	/*
+	 * Request GPIOs from pinctrl using gpiochip_generic_request()
+	 * and gpiochip_generic_free().
+	 */
+	GPIO_PINCTRL = BIT(3),
 };
 
 static struct realtek_gpio_ctrl *irq_data_to_ctrl(struct irq_data *data)
@@ -354,7 +359,7 @@ static const struct of_device_id realtek_gpio_of_match[] = {
 	},
 	{
 		.compatible = "realtek,rtl9607-gpio",
-		.data = (void *)GPIO_PORTS_REVERSED,
+		.data = (void *)(GPIO_PORTS_REVERSED | GPIO_PINCTRL),
 	},
 	{}
 };
@@ -405,6 +410,9 @@ static int realtek_gpio_probe(struct platform_device *pdev)
 		ctrl->line_imr_pos = realtek_gpio_line_imr_pos_swapped;
 	}
 
+	if (dev_flags & GPIO_PINCTRL)
+		gen_gc_flags |= GPIO_GENERIC_PINCTRL_BACKEND;
+
 	config = (struct gpio_generic_chip_config) {
 		.dev = dev,
 		.sz = 4,
-- 
2.54.0


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

* Re: [PATCH v2 1/2] dt-bindings: gpio: otto-gpio: Add gpio-ranges
  2026-08-19 15:51 ` [PATCH v2 1/2] dt-bindings: gpio: otto-gpio: Add gpio-ranges misha.zavertkin
@ 2026-08-19 16:12   ` sashiko-bot
  0 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-08-19 16:12 UTC (permalink / raw)
  To: misha.zavertkin; +Cc: robh, conor+dt, devicetree

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Logical contradiction in JSON schema makes the `realtek,rtl9607-gpio` binding un-satisfiable.
--

--- Patch [1]: [PATCH v2 1/2] dt-bindings: gpio: otto-gpio: Add gpio-ranges ---
commit dc172e5a62e85037c013247864994cd4ea3bc026
Author: misha.zavertkin@mail.ru <misha.zavertkin@mail.ru>

dt-bindings: gpio: otto-gpio: Add gpio-ranges

This commit updates the realtek,otto-gpio binding documentation to add
support for the gpio-ranges property. It specifically requires this
property to be present when the realtek,rtl9607-gpio compatible string is
used to ensure proper pinctrl routing.

> diff --git a/Documentation/devicetree/bindings/gpio/realtek,otto-gpio.yaml b/Documentation/devicetree/bindings/gpio/realtek,otto-gpio.yaml
> index b18f8f0ca0ae4..96396f968e788 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: false
> +

[ ... ]

> @@ -75,6 +77,18 @@ required:
>    - "#gpio-cells"
>    - gpio-controller
>  
> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: realtek,rtl9607-gpio
> +    then:
> +      properties:
> +        gpio-ranges: true
> +      required:
> +        - gpio-ranges

[Severity: Medium]
Does this create a logical contradiction that makes the schema unsatisfiable
for the realtek,rtl9607-gpio compatible string?

Because gpio-ranges is defined as false in the top-level properties list,
it unconditionally forbids the property. However, the new allOf conditional
block requires the exact same gpio-ranges property to be present.

Will this cause device tree validation to fail every time? If the property
is present, it would fail the top-level false constraint, and if it is
omitted, it would fail the required constraint in the conditional block.

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

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

end of thread, other threads:[~2026-08-19 16:12 UTC | newest]

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox