mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] pinctrl: at91: make it work with current gpiolib
@ 2024-07-30 23:16 Thomas Blocher
  2024-08-23 15:32 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Blocher @ 2024-07-30 23:16 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Ludovic Desroches, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, linux-arm-kernel, linux-gpio, linux-kernel

pinctrl-at91 currently does not support the gpio-groups devicetree
property and has no pin-range.
Because of this at91 gpios stopped working since patch
commit 2ab73c6d8323fa1e ("gpio: Support GPIO controllers without pin-ranges")
This was discussed in the patches
commit fc328a7d1fcce263 ("gpio: Revert regression in sysfs-gpio (gpiolib.c)")
commit 56e337f2cf132632 ("Revert "gpio: Revert regression in sysfs-gpio (gpiolib.c)"")

As a workaround manually set pin-range via gpiochip_add_pin_range() until
a) pinctrl-at91 is reworked to support devicetree gpio-groups
b) another solution as mentioned in
commit 56e337f2cf132632 ("Revert "gpio: Revert regression in sysfs-gpio (gpiolib.c)"")
is found

Signed-off-by: Thomas Blocher <thomas.blocher@ek-dev.de>
---
 drivers/pinctrl/pinctrl-at91.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index b3c3f5fb2e2e..93ab277d9943 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -1403,8 +1403,11 @@ static int at91_pinctrl_probe(struct platform_device *pdev)
 
 	/* We will handle a range of GPIO pins */
 	for (i = 0; i < gpio_banks; i++)
-		if (gpio_chips[i])
+		if (gpio_chips[i]) {
 			pinctrl_add_gpio_range(info->pctl, &gpio_chips[i]->range);
+			gpiochip_add_pin_range(&gpio_chips[i]->chip, dev_name(info->pctl->dev), 0,
+				gpio_chips[i]->range.pin_base, gpio_chips[i]->range.npins);
+		}
 
 	dev_info(dev, "initialized AT91 pinctrl driver\n");
 

base-commit: c91a7dee0555f6f9d3702d86312382e4c4729d0a
-- 
2.30.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] pinctrl: at91: make it work with current gpiolib
  2024-07-30 23:16 [PATCH] pinctrl: at91: make it work with current gpiolib Thomas Blocher
@ 2024-08-23 15:32 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2024-08-23 15:32 UTC (permalink / raw)
  To: thomas.blocher
  Cc: Ludovic Desroches, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, linux-arm-kernel, linux-gpio, linux-kernel

On Wed, Jul 31, 2024 at 1:16 AM Thomas Blocher <thomas.blocher@ek-dev.de> wrote:

> pinctrl-at91 currently does not support the gpio-groups devicetree
> property and has no pin-range.
> Because of this at91 gpios stopped working since patch
> commit 2ab73c6d8323fa1e ("gpio: Support GPIO controllers without pin-ranges")
> This was discussed in the patches
> commit fc328a7d1fcce263 ("gpio: Revert regression in sysfs-gpio (gpiolib.c)")
> commit 56e337f2cf132632 ("Revert "gpio: Revert regression in sysfs-gpio (gpiolib.c)"")
>
> As a workaround manually set pin-range via gpiochip_add_pin_range() until
> a) pinctrl-at91 is reworked to support devicetree gpio-groups
> b) another solution as mentioned in
> commit 56e337f2cf132632 ("Revert "gpio: Revert regression in sysfs-gpio (gpiolib.c)"")
> is found
>
> Signed-off-by: Thomas Blocher <thomas.blocher@ek-dev.de>

No reaction from maintainers so patch applied for fixes now.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-08-23 15:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-30 23:16 [PATCH] pinctrl: at91: make it work with current gpiolib Thomas Blocher
2024-08-23 15:32 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®