Skip to content

Commit fcfde1e

Browse files
Kartik Rajputnirmoy
authored andcommitted
gpio: tegra186: Fix GPIO name collisions for Tegra410
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: 9631a10 ("gpio: tegra186: Add support for Tegra410") Signed-off-by: Kartik Rajput <kkartik@nvidia.com> Acked-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20251113163112.885900-1-kkartik@nvidia.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> (cherry picked from commit 67f9b82) Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
1 parent 569a04e commit fcfde1e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/gpio/gpio-tegra186.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ struct tegra_gpio_soc {
109109
const struct tegra_gpio_port *ports;
110110
unsigned int num_ports;
111111
const char *name;
112+
const char *prefix;
112113
unsigned int instance;
113114

114115
unsigned int num_irqs_per_bank;
@@ -940,8 +941,12 @@ static int tegra186_gpio_probe(struct platform_device *pdev)
940941
char *name;
941942

942943
for (j = 0; j < port->pins; j++) {
943-
name = devm_kasprintf(gpio->gpio.parent, GFP_KERNEL,
944-
"P%s.%02x", port->name, j);
944+
if (gpio->soc->prefix)
945+
name = devm_kasprintf(gpio->gpio.parent, GFP_KERNEL, "%s-P%s.%02x",
946+
gpio->soc->prefix, port->name, j);
947+
else
948+
name = devm_kasprintf(gpio->gpio.parent, GFP_KERNEL, "P%s.%02x",
949+
port->name, j);
945950
if (!name)
946951
return -ENOMEM;
947952

@@ -1306,6 +1311,7 @@ static const struct tegra_gpio_soc tegra410_compute_soc = {
13061311
.num_ports = ARRAY_SIZE(tegra410_compute_ports),
13071312
.ports = tegra410_compute_ports,
13081313
.name = "tegra410-gpio-compute",
1314+
.prefix = "COMPUTE",
13091315
.num_irqs_per_bank = 8,
13101316
.instance = 0,
13111317
};
@@ -1335,6 +1341,7 @@ static const struct tegra_gpio_soc tegra410_system_soc = {
13351341
.num_ports = ARRAY_SIZE(tegra410_system_ports),
13361342
.ports = tegra410_system_ports,
13371343
.name = "tegra410-gpio-system",
1344+
.prefix = "SYSTEM",
13381345
.num_irqs_per_bank = 8,
13391346
.instance = 0,
13401347
};

0 commit comments

Comments
 (0)