gpio: tegra186: Fix GPIO name collisions for Tegra410
Subsystems (2)
PATCH 1/1 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.
--- drivers/gpio/gpio-tegra186.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpio/gpio-tegra186.c +9 -2
@@ -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, };
Signature · 1 line
2.43.0
Quoted 61 lines · Kartik Rajput
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 <[email protected]>--- drivers/gpio/gpio-tegra186.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)drivers/gpio/gpio-tegra186.c +8
-2@@ -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, };
drivers/gpio/gpio-tegra186.c static const struct tegra_gpio_soc tegra410_system_soc = { · line 1347
Quoted 7 lines
drivers/gpio/gpio-tegra186.c +1
-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.
Jon
Signature · 1 line
nvpublic
Quoted 19 lines · Kartik Rajput
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.
Quoted 5 lines
Fixes 9631a10083d8 ("gpio: tegra186: Add support for Tegra410")Signed-off-by Kartik Rajput <[email protected]>--- drivers/gpio/gpio-tegra186.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
Bartosz Golaszewski
AppliedFrom: Bartosz Golaszewski <[email protected]>
Quoted 5 lines · Kartik Rajput
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:
Quoted 8 lines
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'
...[...]
Applied, thanks!
[1/1] gpio: tegra186: Fix GPIO name collisions for Tegra410
https://git.kernel.org/brgl/linux/c/67f9b828d4e5e47caf3472a399c25c3c0ddc824a
Best regards,
Signature · 1 line
Bartosz Golaszewski <[email protected]>