[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdbHV+HCfTw__2u_EF1SbmG_0Ce-6VMs7wbAe+HtJXYM_A@mail.gmail.com>
Date: Tue, 2 Mar 2021 23:39:09 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Álvaro Fernández Rojas <noltari@...il.com>
Cc: Michael Walle <michael@...le.cc>,
Bartosz Golaszewski <bgolaszewski@...libre.com>,
Andy Shevchenko <andy.shevchenko@...il.com>,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] gpio: regmap: move struct gpio_regmap definition
On Tue, Mar 2, 2021 at 7:14 PM Álvaro Fernández Rojas <noltari@...il.com> wrote:
> I'm trying to add support for bcm63xx pin controllers, and Linus
> suggested that I could use gpio regmap instead of adding duplicated code.
> However, I need to access gpio_chip inside gpio_regmap to call
> pinctrl_add_gpio_range() with gpio_chip.base.
Can't you just put the ranges in the device tree using the standard
property gpio-ranges?
These will be added automatically after the chip is added.
It is documented in
Documentation/devicetree/bindings/gpio/gpio.txt
a bit down the file.
The code is in of_gpiochip_add_pin_range() in gpiolib-of.c
called from of_gpiochip_add() which is always called
when gpiochip_add_data_with_key(), the main gpiochip
registering function is called.
This would just do the work for you with no effort in the driver.
It is a bit counterintuitive that this can be done in the device
tree but the hierarchical IRQs cannot do the same clever
manouver to map IRQs, sorry.
Yours,
Linus Walleij
Powered by blists - more mailing lists