Message ID | 20250107102735.317446-1-noltari@gmail.com |
---|---|
Headers | show |
Series | pinctrl: bcm63xx: properly request gpios | expand |
El mar, 7 ene 2025 a las 11:43, Jonas Gorski (<jonas.gorski@gmail.com>) escribió: > > Hi, > > On Tue, Jan 7, 2025 at 11:27 AM Álvaro Fernández Rojas > <noltari@gmail.com> wrote: > > > > Allow configuring gpio_chip request/free functions when creating a gpio-regmap. > > > > Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> > > --- > > drivers/gpio/gpio-regmap.c | 2 ++ > > include/linux/gpio/regmap.h | 4 ++++ > > 2 files changed, 6 insertions(+) > > > > diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c > > index 71684dee2ca5..32ec85b41653 100644 > > --- a/drivers/gpio/gpio-regmap.c > > +++ b/drivers/gpio/gpio-regmap.c > > @@ -261,6 +261,8 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config > > chip->names = config->names; > > chip->label = config->label ?: dev_name(config->parent); > > chip->can_sleep = regmap_might_sleep(config->regmap); > > + chip->request = config->request; > > + chip->free = config->free; > > I wonder if you couldn't just use gpiochip_generic_request() / > gpiochip_generic_free() unconditionally here. AFAIU, these don't do > anything when there are no GPIO ranges defined (so should not > interfere with non-pinctrl linked devices), as well as nothing when > CONFIG_PINCTRL isn't enabled, so they should be NOPs if there is no > pinctrl link, and do the right thing if there is one. > > Best Regards, > Jonas @Jonas Your proposal is now used in OpenWrt for realtek https://github.com/openwrt/openwrt/blob/6ef6014887c393dc07f0349028d93e4fa82e0733/target/linux/realtek/patches-6.6/801-gpio-regmap-Use-generic-request-free-ops.patch, so I guess that we could send that patch to linux-gpio instead. @Sander can you send that patch to linux-gpio? We need it for bmips too: https://github.com/openwrt/openwrt/pull/17487 Best regards, Álvaro.
On Tue, Jan 7, 2025 at 11:27 AM Álvaro Fernández Rojas <noltari@gmail.com> wrote: > Add gpio_chip request/free functions to gpio-regmap and use them on bcm63xx in > order to properly call gpio_request_enable when requesting a gpio. It's a bit hacky, Sander found the silver bullet patch and Bartosz has merged it! But thanks for looking after this issue. Yours, Linus Walleij