gpio: tegra186: Set fwnode of the GPIO chip
Subsystems (2)
PATCH 1/1 gpio: tegra186: Set fwnode of the GPIO chip
Any driver that depends on the GPIO match function to locate the GPIO controller, it has to use the fwnode from the gpio_chip structure. But with [1], it is GPIO providers job to set any members of the gpio_chip structure. This patch addresses that.
--- drivers/gpio/gpio-tegra186.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpio/gpio-tegra186.c +6 -0
@@ -989,6 +989,12 @@ static int tegra186_gpio_probe(struct platform_device *pdev) offset += port->pins; } +/* +* This is needed for driver using gpio device matching where it +* has to use gpio_chip fwnode to match the gpio controller. +*/ + gpio->gpio.fwnode =of_node_to_fwnode (pdev->dev.of_node); +return devm_gpiochip_add_data (&pdev->dev, &gpio->gpio, gpio); }
Signature · 1 line
2.25.1
On Mon, Oct 09, 2023 at 10:38:58AM -0700, Dipen Patel wrote:
Tbank you! My comments below.
Quoted 6 lines
Any driver that depends on the GPIO match function to locate the GPIO controller, it has to use the fwnode from the
gpio_chipstructure. But with [1], it is GPIO providers job to set any members of thegpio_chipstructure. This patch addresses that.
Use Link: tag for this?
...
drivers/gpio/gpio-tegra186.c static int tegra186_gpio_probe(struct platform_device *pdev) · line 996
Quoted 5 lines
drivers/gpio/gpio-tegra186.c +5
-0+/* +* This is needed for driver using gpio device matching where it +* has to use gpio_chip fwnode to match the gpio controller. +*/ + gpio->gpio.fwnode =of_node_to_fwnode (pdev->dev.of_node);
of_node_to_fwnode() is specific to IRQ, in other places we use generic of_fwnode_handle(). That's why better just to use dev_fwnode().
...
With the above addressed:
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 1 line · Andy Shevchenko
On Mon, Oct 09, 2023 at 10:38:58AM -0700, Dipen Patel wrote:
...
Quoted 8 lines
drivers/gpio/gpio-tegra186.c static int tegra186_gpio_probe(struct platform_device *pdev) · line 996
Quoted 5 lines
drivers/gpio/gpio-tegra186.c +5
-0+/* +* This is needed for driver using gpio device matching where it +* has to use gpio_chip fwnode to match the gpio controller. +*/ + gpio->gpio.fwnode =of_node_to_fwnode (pdev->dev.of_node);
of_node_to_fwnode()is specific to IRQ, in other places we use genericof_fwnode_handle(). That's why better just to usedev_fwnode().
On the second thought is there any parent assigned? At least I see that in tegra186_gpio_probe(). Are you saying it is not working? Or is it (matching) called _before_ we add a GPIO device?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Andy Shevchenko
On Mon, Oct 09, 2023 at 10:38:58AM -0700, Dipen Patel wrote:
...
Quoted 9 lines
Quoted 8 lines
drivers/gpio/gpio-tegra186.c static int tegra186_gpio_probe(struct platform_device *pdev) · line 996
Quoted 5 lines
drivers/gpio/gpio-tegra186.c +5
-0+/* +* This is needed for driver using gpio device matching where it +* has to use gpio_chip fwnode to match the gpio controller. +*/ + gpio->gpio.fwnode =of_node_to_fwnode (pdev->dev.of_node);
of_node_to_fwnode()is specific to IRQ, in other places we use genericof_fwnode_handle(). That's why better just to usedev_fwnode().
Quoted 4 lines
On the second thought is there any parent assigned? At least I see that in
tegra186_gpio_probe(). Are you saying it is not working? Or is it (matching) called _before_ we add a GPIO device?
Okay, I think I got it. There is a function called tegra_gpiochip_match() in drivers/hte/hte-tegra194.c which fails after my patch. Yeah, if provider doesn't set fwnode, it can't match. But, since the driver sets the parent properly it means that the matching function should be done against the device.
Seems to me that in HTE code the matching function is broken.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Andy Shevchenko
On Mon, Oct 09, 2023 at 10:38:58AM -0700, Dipen Patel wrote:
...
Quoted 14 lines
Quoted 9 lines
Quoted 8 lines
drivers/gpio/gpio-tegra186.c static int tegra186_gpio_probe(struct platform_device *pdev) · line 996
Quoted 5 lines
drivers/gpio/gpio-tegra186.c +5
-0+/* +* This is needed for driver using gpio device matching where it +* has to use gpio_chip fwnode to match the gpio controller. +*/ + gpio->gpio.fwnode =of_node_to_fwnode (pdev->dev.of_node);
of_node_to_fwnode()is specific to IRQ, in other places we use genericof_fwnode_handle(). That's why better just to usedev_fwnode().Quoted 4 lines
On the second thought is there any parent assigned? At least I see that in
tegra186_gpio_probe(). Are you saying it is not working? Or is it (matching) called _before_ we add a GPIO device?
Quoted 7 lines
Okay, I think I got it. There is a function called
tegra_gpiochip_match()indrivers/hte/hte-tegra194.cwhich fails after my patch. Yeah, if provider doesn't set fwnode, it can't match. But, since the driver sets the parent properly it means that the matching function should be done against the device.Seems to me that in HTE code the matching function is broken.
I'll send a patch soon. Please, test it.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 28 lines · Andy Shevchenko
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Andy Shevchenko
On Mon, Oct 09, 2023 at 10:38:58AM -0700, Dipen Patel wrote:
...
Quoted 20 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
drivers/gpio/gpio-tegra186.c +5
-0+/* +* This is needed for driver using gpio device matching where it +* has to use gpio_chip fwnode to match the gpio controller. +*/ + gpio->gpio.fwnode =of_node_to_fwnode (pdev->dev.of_node);Quoted 7 lines
Quoted 2 lines
of_node_to_fwnode()is specific to IRQ, in other places we use genericof_fwnode_handle(). That's why better just to usedev_fwnode().On the second thought is there any parent assigned? At least I see that in
tegra186_gpio_probe(). Are you saying it is not working? Or is it (matching) called _before_ we add a GPIO device?Okay, I think I got it. There is a function called
tegra_gpiochip_match()indrivers/hte/hte-tegra194.cwhich fails after my patch. Yeah, if provider doesn't set fwnode, it can't match. But, since the driver sets the parent properly it means that the matching function should be done against the device.
Quoted 4 lines
Quoted 1 line
Seems to me that in HTE code the matching function is broken.
I'll send a patch soon. Please, test it.
I'll have you know that if it is about to add any new "#include ../gpio/gpiolib.h", then it's a preemptive NAK from me. :)
Bart
Quoted 5 lines · Bartosz Golaszewski
Quoted 4 lines · Andy Shevchenko
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Andy Shevchenko
On Mon, Oct 09, 2023 at 10:38:58AM -0700, Dipen Patel wrote:
...
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
drivers/gpio/gpio-tegra186.c +5
-0+/* +* This is needed for driver using gpio device matching where it +* has to use gpio_chip fwnode to match the gpio controller. +*/ + gpio->gpio.fwnode =of_node_to_fwnode (pdev->dev.of_node);Quoted 7 lines
Quoted 2 lines
of_node_to_fwnode()is specific to IRQ, in other places we use genericof_fwnode_handle(). That's why better just to usedev_fwnode().On the second thought is there any parent assigned? At least I see that in
tegra186_gpio_probe(). Are you saying it is not working? Or is it (matching) called _before_ we add a GPIO device?Okay, I think I got it. There is a function called
tegra_gpiochip_match()indrivers/hte/hte-tegra194.cwhich fails after my patch. Yeah, if provider doesn't set fwnode, it can't match. But, since the driver sets the parent properly it means that the matching function should be done against the device.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Seems to me that in HTE code the matching function is broken.
I'll send a patch soon. Please, test it.
I'll have you know that if it is about to add any new "#include
../gpio/gpiolib.h", then it's a preemptive NAK from me. :)
Nope, see I just sent it.
Signature · 2 lines
With Best Regards, Andy Shevchenko