Skip to contentSkip to conversation

gpio: regmap: Use generic request/free ops

PATCH Applied Sander Vanheule 4 participants 4 messages Jan 7, 2025 – Jan 14, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: regmap: Use generic request/free ops

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.

---
Á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/[email protected]/T/#t

 drivers/gpio/gpio-regmap.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpio/gpio-regmap.c +2 -0
index f716eb069b25..82da0f1d78c3 100644
@@ -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;
Signature · 1 line
2.47.1
maintainer Acked-by on v1 1/1
#1 lore raw

Hi,

Quoted 7 lines · 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.

Sounds fine, although I don't have time to test it right now. I'd appreciate if Linus could give a short comment, too.

-michael

Quoted 23 lines

---
Á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/[email protected]/T/#t

 drivers/gpio/gpio-regmap.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpio/gpio-regmap.c +2 -0
index f716eb069b25..82da0f1d78c3 100644
@@ -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 lore raw
In reply to Sander Vanheule

From: Bartosz Golaszewski <[email protected]>

Quoted 8 lines · 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.

[...]

Applied, thanks!

[1/1] gpio: regmap: Use generic request/free ops

      commit: 5ab3b97ef9d4bff2513994ef9efc6d95722cb902

Best regards,

Signature · 1 line
Bartosz Golaszewski <[email protected]>
#3 lore raw
In reply to Sander Vanheule
Quoted 10 lines · 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.

---
Á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