[v2,3/3] gpio: mxc: add generic gpio request/free callbacks to pinctrl
diff mbox

Message ID 1473299296-22458-4-git-send-email-vladimir_zapolskiy@mentor.com
State New
Headers show

Commit Message

Vladimir Zapolskiy Sept. 8, 2016, 1:48 a.m. UTC
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>
---
Changes from v1 to v2:
* none

 drivers/gpio/gpio-mxc.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Linus Walleij Sept. 12, 2016, 12:29 p.m. UTC | #1
On Thu, Sep 8, 2016 at 3:48 AM, Vladimir Zapolskiy
<vladimir_zapolskiy@mentor.com> wrote:

> 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>
> ---
> Changes from v1 to v2:
> * none

Patch applied with Shawn's ACK.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index 1fdd5d804b5b..e38989a4fa0c 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -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;