]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
gpio: mxc: add generic gpio request/free callbacks to pinctrl
authorVladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Thu, 8 Sep 2016 01:48:16 +0000 (04:48 +0300)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 12 Sep 2016 12:28:59 +0000 (14:28 +0200)
If a GPIO controller description in board DTB contains information
about mappings between GPIOs and pads under IOMUX control use it to
request and free GPIOs with respect to pinctrl/pinmux subsystems.

One of immediate positive functional changes is inability to
request non-existing GPIOs, i.e. if there is no pad such. Also
pinctrl/pinmux may now properly account pads occupied by requested
GPIOs.

The change has no effect, if "gpio-ranges" property is not found
including the case if a board has no DTB firmware.

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Acked-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-mxc.c

index 1fdd5d804b5b6377aa2acc436c61ba74ec3b4f74..e38989a4fa0c6b7ce0384722a07f65154aea178b 100644 (file)
@@ -458,6 +458,11 @@ static int mxc_gpio_probe(struct platform_device *pdev)
        if (err)
                goto out_bgio;
 
+       if (of_property_read_bool(np, "gpio-ranges")) {
+               port->gc.request = gpiochip_generic_request;
+               port->gc.free = gpiochip_generic_free;
+       }
+
        port->gc.to_irq = mxc_gpio_to_irq;
        port->gc.base = (pdev->id < 0) ? of_alias_get_id(np, "gpio") * 32 :
                                             pdev->id * 32;