* [PATCH] gpio: regmap: Use generic request/free ops
@ 2025-01-07 20:16 Sander Vanheule
2025-01-08 8:28 ` Michael Walle
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Sander Vanheule @ 2025-01-07 20:16 UTC (permalink / raw)
To: Michael Walle, Linus Walleij, Bartosz Golaszewski, linux-gpio,
linux-kernel
Cc: Álvaro Fernández Rojas, jonas.gorski, kylehendrydev,
florian.fainelli, Sander Vanheule
Set the gpiochip request and free ops to the generic implementations.
This way a user can provide a gpio-ranges property defined for a pinmux,
easing muxing of gpio functions. Provided that the pin controller
implementents the pinmux op .gpio_request_enable(), pins will
automatically be muxed to their GPIO function when requested.
Signed-off-by: Sander Vanheule <sander@svanheule.net>
---
Álvaro has submitted a similar patch today. My implementation's impact
is more limited, but I hadn't gotten around to submitting it yet.
For the original (short) discussion, see:
https://lore.kernel.org/linux-gpio/20250107102735.317446-1-noltari@gmail.com/T/#t
drivers/gpio/gpio-regmap.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
index f716eb069b25..82da0f1d78c3 100644
--- a/drivers/gpio/gpio-regmap.c
+++ b/drivers/gpio/gpio-regmap.c
@@ -270,6 +270,8 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
chip->label = config->label ?: dev_name(config->parent);
chip->can_sleep = regmap_might_sleep(config->regmap);
+ chip->request = gpiochip_generic_request;
+ chip->free = gpiochip_generic_free;
chip->get = gpio_regmap_get;
if (gpio->reg_set_base && gpio->reg_clr_base)
chip->set = gpio_regmap_set_with_clear;
--
2.47.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] gpio: regmap: Use generic request/free ops
2025-01-07 20:16 [PATCH] gpio: regmap: Use generic request/free ops Sander Vanheule
@ 2025-01-08 8:28 ` Michael Walle
2025-01-10 13:19 ` Bartosz Golaszewski
2025-01-14 12:35 ` Linus Walleij
2 siblings, 0 replies; 4+ messages in thread
From: Michael Walle @ 2025-01-08 8:28 UTC (permalink / raw)
To: Sander Vanheule, Linus Walleij, Bartosz Golaszewski, linux-gpio,
linux-kernel
Cc: Álvaro Fernández Rojas, jonas.gorski, kylehendrydev,
florian.fainelli
[-- Attachment #1: Type: text/plain, Size: 1660 bytes --]
Hi,
On Tue Jan 7, 2025 at 9:16 PM CET, Sander Vanheule wrote:
> Set the gpiochip request and free ops to the generic implementations.
> This way a user can provide a gpio-ranges property defined for a pinmux,
> easing muxing of gpio functions. Provided that the pin controller
> implementents the pinmux op .gpio_request_enable(), pins will
> automatically be muxed to their GPIO function when requested.
>
> Signed-off-by: Sander Vanheule <sander@svanheule.net>
Sounds fine, although I don't have time to test it right now. I'd
appreciate if Linus could give a short comment, too.
Acked-by: Michael Walle <mwalle@kernel.org>
-michael
> ---
> Álvaro has submitted a similar patch today. My implementation's impact
> is more limited, but I hadn't gotten around to submitting it yet.
>
> For the original (short) discussion, see:
> https://lore.kernel.org/linux-gpio/20250107102735.317446-1-noltari@gmail.com/T/#t
>
> drivers/gpio/gpio-regmap.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
> index f716eb069b25..82da0f1d78c3 100644
> --- a/drivers/gpio/gpio-regmap.c
> +++ b/drivers/gpio/gpio-regmap.c
> @@ -270,6 +270,8 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
> chip->label = config->label ?: dev_name(config->parent);
> chip->can_sleep = regmap_might_sleep(config->regmap);
>
> + chip->request = gpiochip_generic_request;
> + chip->free = gpiochip_generic_free;
> chip->get = gpio_regmap_get;
> if (gpio->reg_set_base && gpio->reg_clr_base)
> chip->set = gpio_regmap_set_with_clear;
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gpio: regmap: Use generic request/free ops
2025-01-07 20:16 [PATCH] gpio: regmap: Use generic request/free ops Sander Vanheule
2025-01-08 8:28 ` Michael Walle
@ 2025-01-10 13:19 ` Bartosz Golaszewski
2025-01-14 12:35 ` Linus Walleij
2 siblings, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2025-01-10 13:19 UTC (permalink / raw)
To: Michael Walle, Linus Walleij, Bartosz Golaszewski, linux-gpio,
linux-kernel, Sander Vanheule
Cc: Bartosz Golaszewski, Álvaro Fernández Rojas,
jonas.gorski, kylehendrydev, florian.fainelli
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
On Tue, 07 Jan 2025 21:16:20 +0100, Sander Vanheule wrote:
> Set the gpiochip request and free ops to the generic implementations.
> This way a user can provide a gpio-ranges property defined for a pinmux,
> easing muxing of gpio functions. Provided that the pin controller
> implementents the pinmux op .gpio_request_enable(), pins will
> automatically be muxed to their GPIO function when requested.
>
>
> [...]
Applied, thanks!
[1/1] gpio: regmap: Use generic request/free ops
commit: 5ab3b97ef9d4bff2513994ef9efc6d95722cb902
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gpio: regmap: Use generic request/free ops
2025-01-07 20:16 [PATCH] gpio: regmap: Use generic request/free ops Sander Vanheule
2025-01-08 8:28 ` Michael Walle
2025-01-10 13:19 ` Bartosz Golaszewski
@ 2025-01-14 12:35 ` Linus Walleij
2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2025-01-14 12:35 UTC (permalink / raw)
To: Sander Vanheule
Cc: Michael Walle, Bartosz Golaszewski, linux-gpio, linux-kernel,
Álvaro Fernández Rojas, jonas.gorski, kylehendrydev,
florian.fainelli
On Tue, Jan 7, 2025 at 9:17 PM Sander Vanheule <sander@svanheule.net> wrote:
> Set the gpiochip request and free ops to the generic implementations.
> This way a user can provide a gpio-ranges property defined for a pinmux,
> easing muxing of gpio functions. Provided that the pin controller
> implementents the pinmux op .gpio_request_enable(), pins will
> automatically be muxed to their GPIO function when requested.
>
> Signed-off-by: Sander Vanheule <sander@svanheule.net>
> ---
> Álvaro has submitted a similar patch today. My implementation's impact
> is more limited, but I hadn't gotten around to submitting it yet.
This is fine, I'll check Álvaros two patches, if his patch is equivalent
I can apply just the pinctrl patch.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-01-14 12:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-07 20:16 [PATCH] gpio: regmap: Use generic request/free ops Sander Vanheule
2025-01-08 8:28 ` Michael Walle
2025-01-10 13:19 ` Bartosz Golaszewski
2025-01-14 12:35 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).