Devicetree
 help / color / mirror / Atom feed
From: Sander Vanheule <sander@svanheule.net>
To: misha.zavertkin@mail.ru, linux-gpio@vger.kernel.org
Cc: Linus Walleij <linusw@kernel.org>,
	Bartosz Golaszewski <brgl@kernel.org>,
	 Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	 Bert Vermeulen	 <bert@biot.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] gpio: realtek-otto: add pinctrl support
Date: Wed, 19 Aug 2026 21:58:32 +0200	[thread overview]
Message-ID: <d7b4bebc172d94c3760211608963ceafb72d3c0c.camel@svanheule.net> (raw)
In-Reply-To: <060486bd7671ce058b96378c7b02316ebbe6d92c.1787130560.git.misha.zavertkin@mail.ru>

Hi,

On Wed, 2026-08-19 at 22:51 +0700, misha.zavertkin@mail.ru wrote:
> 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,

Any reason to not just always add GPI_GENERIC_PINCTRL_BACKEND, regardless of the
compatible? If there are no gpio_ranges, gpio_generic_request() is a no-op, so
there's no harm in enabling this without having that property defined.

The other SoCs use explicit pinctrl properties on the GPIO consumers in their
devicetrees for now. If you enable this feature for all instances of this GPIO
driver, then only the devicetree needs to be updated later to enable gpio_ranges
for them.

Best,
Sander

      reply	other threads:[~2026-08-19 20:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 20:06   ` Sander Vanheule
2026-08-19 15:51 ` [PATCH v2 2/2] gpio: realtek-otto: add pinctrl support misha.zavertkin
2026-08-19 19:58   ` Sander Vanheule [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d7b4bebc172d94c3760211608963ceafb72d3c0c.camel@svanheule.net \
    --to=sander@svanheule.net \
    --cc=bert@biot.com \
    --cc=brgl@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=misha.zavertkin@mail.ru \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox