Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 9631a10083d8 ("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>

authored by

Kartik Rajput and committed by
Bartosz Golaszewski
67f9b828 ade570c1

+9 -2
+9 -2
drivers/gpio/gpio-tegra186.c
··· 109 109 const struct tegra_gpio_port *ports; 110 110 unsigned int num_ports; 111 111 const char *name; 112 + const char *prefix; 112 113 unsigned int instance; 113 114 114 115 unsigned int num_irqs_per_bank; ··· 941 940 char *name; 942 941 943 942 for (j = 0; j < port->pins; j++) { 944 - name = devm_kasprintf(gpio->gpio.parent, GFP_KERNEL, 945 - "P%s.%02x", port->name, j); 943 + if (gpio->soc->prefix) 944 + name = devm_kasprintf(gpio->gpio.parent, GFP_KERNEL, "%s-P%s.%02x", 945 + gpio->soc->prefix, port->name, j); 946 + else 947 + name = devm_kasprintf(gpio->gpio.parent, GFP_KERNEL, "P%s.%02x", 948 + port->name, j); 946 949 if (!name) 947 950 return -ENOMEM; 948 951 ··· 1311 1306 .num_ports = ARRAY_SIZE(tegra410_compute_ports), 1312 1307 .ports = tegra410_compute_ports, 1313 1308 .name = "tegra410-gpio-compute", 1309 + .prefix = "COMPUTE", 1314 1310 .num_irqs_per_bank = 8, 1315 1311 .instance = 0, 1316 1312 }; ··· 1341 1335 .num_ports = ARRAY_SIZE(tegra410_system_ports), 1342 1336 .ports = tegra410_system_ports, 1343 1337 .name = "tegra410-gpio-system", 1338 + .prefix = "SYSTEM", 1344 1339 .num_irqs_per_bank = 8, 1345 1340 .instance = 0, 1346 1341 };