Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: Jon Hunter <jonathanh@nvidia.com>
To: Kartik Rajput <kkartik@nvidia.com>,
	linus.walleij@linaro.org, brgl@bgdev.pl,
	thierry.reding@gmail.com, pshete@nvidia.com, nhartman@nvidia.com,
	linux-gpio@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] gpio: tegra186: Fix GPIO name collisions for Tegra410
Date: Fri, 14 Nov 2025 10:09:48 +0000	[thread overview]
Message-ID: <c21580ab-8da8-4a0d-a575-4248c40a58ef@nvidia.com> (raw)
In-Reply-To: <20251113163112.885900-1-kkartik@nvidia.com>


On 13/11/2025 16:31, Kartik Rajput wrote:
> On Tegra410, Compute and System GPIOs have same port names. This
> results in the same GPIO names for both Compute and System GPIOs
> during initialization in `tegra186_gpio_probe()`, which results in
> following warnings:
> 
>    kernel: gpio gpiochip1: Detected name collision for GPIO name 'PA.00'
>    kernel: gpio gpiochip1: Detected name collision for GPIO name 'PA.01'
>    kernel: gpio gpiochip1: Detected name collision for GPIO name 'PA.02'
>    kernel: gpio gpiochip1: Detected name collision for GPIO name 'PB.00'
>    kernel: gpio gpiochip1: Detected name collision for GPIO name 'PB.01'
>    ...
> 
> Add GPIO name prefix in the SoC data and use it to initialize the GPIO
> name.
> 
> Port names remain unchanged for previous SoCs. On Tegra410, Compute
> GPIOs are named COMPUTE-P<PORT>.GPIO, and System GPIOs are named
> SYSTEM-P<PORT>.GPIO.
> 
> Fixes: 9631a10083d8 ("gpio: tegra186: Add support for Tegra410")
> Signed-off-by: Kartik Rajput <kkartik@nvidia.com>
> ---
>   drivers/gpio/gpio-tegra186.c | 11 +++++++++--
>   1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-tegra186.c b/drivers/gpio/gpio-tegra186.c
> index 83ecdc876985..b1498b59a921 100644
> --- a/drivers/gpio/gpio-tegra186.c
> +++ b/drivers/gpio/gpio-tegra186.c
> @@ -109,6 +109,7 @@ struct tegra_gpio_soc {
>   	const struct tegra_gpio_port *ports;
>   	unsigned int num_ports;
>   	const char *name;
> +	const char *prefix;
>   	unsigned int instance;
>   
>   	unsigned int num_irqs_per_bank;
> @@ -940,8 +941,12 @@ static int tegra186_gpio_probe(struct platform_device *pdev)
>   		char *name;
>   
>   		for (j = 0; j < port->pins; j++) {
> -			name = devm_kasprintf(gpio->gpio.parent, GFP_KERNEL,
> -					      "P%s.%02x", port->name, j);
> +			if (gpio->soc->prefix)
> +				name = devm_kasprintf(gpio->gpio.parent, GFP_KERNEL, "%s-P%s.%02x",
> +						      gpio->soc->prefix, port->name, j);
> +			else
> +				name = devm_kasprintf(gpio->gpio.parent, GFP_KERNEL, "P%s.%02x",
> +						      port->name, j);
>   			if (!name)
>   				return -ENOMEM;
>   
> @@ -1306,6 +1311,7 @@ static const struct tegra_gpio_soc tegra410_compute_soc = {
>   	.num_ports = ARRAY_SIZE(tegra410_compute_ports),
>   	.ports = tegra410_compute_ports,
>   	.name = "tegra410-gpio-compute",
> +	.prefix = "COMPUTE",
>   	.num_irqs_per_bank = 8,
>   	.instance = 0,
>   };
> @@ -1335,6 +1341,7 @@ static const struct tegra_gpio_soc tegra410_system_soc = {
>   	.num_ports = ARRAY_SIZE(tegra410_system_ports),
>   	.ports = tegra410_system_ports,
>   	.name = "tegra410-gpio-system",
> +	.prefix = "SYSTEM",
>   	.num_irqs_per_bank = 8,
>   	.instance = 0,
>   };


Looks good to me.

Reviewed-by: Jon Hunter <jonathanh@nvidia.com>

Jon

-- 
nvpublic


  reply	other threads:[~2025-11-14 10:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-13 16:31 [PATCH] gpio: tegra186: Fix GPIO name collisions for Tegra410 Kartik Rajput
2025-11-14 10:09 ` Jon Hunter [this message]
2025-11-14 13:11 ` Thierry Reding
2025-11-17 10:04 ` Bartosz Golaszewski

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=c21580ab-8da8-4a0d-a575-4248c40a58ef@nvidia.com \
    --to=jonathanh@nvidia.com \
    --cc=brgl@bgdev.pl \
    --cc=kkartik@nvidia.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=nhartman@nvidia.com \
    --cc=pshete@nvidia.com \
    --cc=thierry.reding@gmail.com \
    /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