* [PATCH/RFC 02/12] gpio-rcar: Add pinctrl support
@ 2013-03-10 18:58 Laurent Pinchart
2013-03-13 17:21 ` Linus Walleij
2013-03-13 17:30 ` Laurent Pinchart
0 siblings, 2 replies; 3+ messages in thread
From: Laurent Pinchart @ 2013-03-10 18:58 UTC (permalink / raw)
To: linux-sh
Register the GPIO pin range, and request and free GPIO pins using the
pinctrl API.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
drivers/gpio/gpio-rcar.c | 23 +++++++++++++++++++++++
include/linux/platform_data/gpio-rcar.h | 1 +
2 files changed, 24 insertions(+)
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 68569cf..c402440 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -30,6 +30,7 @@
#include <linux/gpio.h>
#include <linux/slab.h>
#include <linux/module.h>
+#include <linux/pinctrl/consumer.h>
#include <linux/platform_data/gpio-rcar.h>
struct gpio_rcar_priv {
@@ -205,6 +206,21 @@ static void gpio_rcar_config_general_input_output_mode(struct gpio_chip *chip,
spin_unlock_irqrestore(&p->lock, flags);
}
+static int gpio_rcar_request(struct gpio_chip *chip, unsigned offset)
+{
+ return pinctrl_request_gpio(chip->base + offset);
+}
+
+static void gpio_rcar_free(struct gpio_chip *chip, unsigned offset)
+{
+ pinctrl_free_gpio(chip->base + offset);
+
+ /* Set the GPIO as an input to ensure that the next GPIO request won't
+ * drive the GPIO pin as an output.
+ */
+ gpio_rcar_config_general_input_output_mode(chip, offset, false);
+}
+
static int gpio_rcar_direction_input(struct gpio_chip *chip, unsigned offset)
{
gpio_rcar_config_general_input_output_mode(chip, offset, false);
@@ -307,6 +323,8 @@ static int gpio_rcar_probe(struct platform_device *pdev)
}
gpio_chip = &p->gpio_chip;
+ gpio_chip->request = gpio_rcar_request;
+ gpio_chip->free = gpio_rcar_free;
gpio_chip->direction_input = gpio_rcar_direction_input;
gpio_chip->get = gpio_rcar_get;
gpio_chip->direction_output = gpio_rcar_direction_output;
@@ -358,6 +376,11 @@ static int gpio_rcar_probe(struct platform_device *pdev)
p->config.irq_base, ret);
}
+ ret = gpiochip_add_pin_range(gpio_chip, p->config.pctl_name, 0,
+ gpio_chip->base, gpio_chip->ngpio);
+ if (ret < 0)
+ dev_warn(&pdev->dev, "failed to add pin range\n");
+
return 0;
err4:
diff --git a/include/linux/platform_data/gpio-rcar.h b/include/linux/platform_data/gpio-rcar.h
index f457562..f3257ec 100644
--- a/include/linux/platform_data/gpio-rcar.h
+++ b/include/linux/platform_data/gpio-rcar.h
@@ -24,6 +24,7 @@ struct gpio_rcar_config {
unsigned int gpio_base;
unsigned int irq_base;
unsigned int number_of_pins;
+ const char *pctl_name;
};
#endif /* __GPIO_RCAR_H__ */
--
1.8.1.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH/RFC 02/12] gpio-rcar: Add pinctrl support
2013-03-10 18:58 [PATCH/RFC 02/12] gpio-rcar: Add pinctrl support Laurent Pinchart
@ 2013-03-13 17:21 ` Linus Walleij
2013-03-13 17:30 ` Laurent Pinchart
1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2013-03-13 17:21 UTC (permalink / raw)
To: linux-sh
On Sun, Mar 10, 2013 at 7:58 PM, Laurent Pinchart
<laurent.pinchart+renesas@ideasonboard.com> wrote:
> Register the GPIO pin range, and request and free GPIO pins using the
> pinctrl API.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Looks good.
Acked-by: Linus Walleij <linus.walleij@linaro.org>
This requires that the Rcar driver is finalized first tho I guess.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH/RFC 02/12] gpio-rcar: Add pinctrl support
2013-03-10 18:58 [PATCH/RFC 02/12] gpio-rcar: Add pinctrl support Laurent Pinchart
2013-03-13 17:21 ` Linus Walleij
@ 2013-03-13 17:30 ` Laurent Pinchart
1 sibling, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2013-03-13 17:30 UTC (permalink / raw)
To: linux-sh
Hi Linus,
On Wednesday 13 March 2013 18:21:59 Linus Walleij wrote:
> On Sun, Mar 10, 2013 at 7:58 PM, Laurent Pinchart wrote:
> > Register the GPIO pin range, and request and free GPIO pins using the
> > pinctrl API.
> >
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
>
> Looks good.
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
>
> This requires that the Rcar driver is finalized first tho I guess.
I'm working on that with Magnus. This patch will likely be squashed into the
gpio-rcar driver for mainline submission.
The PFC pinconf implementation is nearly ready, I'll post new patch sets soon
and will appreciate if you could review the core patches :-) (I'll point them
out in the cover letter).
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-03-13 17:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-10 18:58 [PATCH/RFC 02/12] gpio-rcar: Add pinctrl support Laurent Pinchart
2013-03-13 17:21 ` Linus Walleij
2013-03-13 17:30 ` Laurent Pinchart
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.