Message ID | 1392656247-3351-7-git-send-email-richard.genoud@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, Feb 17, 2014 at 5:57 PM, Richard Genoud <richard.genoud@gmail.com> wrote: > This is needed for gpiod_get_direction(). > Otherwise, it returns -EINVAL. > > Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Can I apply this directly to the pinctrl tree or do you want it to go through AT91 ARM SoC with the rest of these patches or something? Yours, Linus Walleij
2014-02-24 15:44 GMT+01:00 Linus Walleij <linus.walleij@linaro.org>: > On Mon, Feb 17, 2014 at 5:57 PM, Richard Genoud > <richard.genoud@gmail.com> wrote: > >> This is needed for gpiod_get_direction(). >> Otherwise, it returns -EINVAL. >> >> Signed-off-by: Richard Genoud <richard.genoud@gmail.com> > > Acked-by: Linus Walleij <linus.walleij@linaro.org> > > Can I apply this directly to the pinctrl tree or do you want it to > go through AT91 ARM SoC with the rest of these patches > or something? Well, I guess you can apply it on pinctrl tree. I'll comme with an updated version of patches 1,4,7 soon, and I'll write clearly in the cover letter the needed patches, and the tree they're in to prevent breaking the compilation. thanks !
On Mon, Feb 24, 2014 at 3:56 PM, Richard Genoud <richard.genoud@gmail.com> wrote: > 2014-02-24 15:44 GMT+01:00 Linus Walleij <linus.walleij@linaro.org>: >> On Mon, Feb 17, 2014 at 5:57 PM, Richard Genoud >> <richard.genoud@gmail.com> wrote: >> >>> This is needed for gpiod_get_direction(). >>> Otherwise, it returns -EINVAL. >>> >>> Signed-off-by: Richard Genoud <richard.genoud@gmail.com> >> >> Acked-by: Linus Walleij <linus.walleij@linaro.org> >> >> Can I apply this directly to the pinctrl tree or do you want it to >> go through AT91 ARM SoC with the rest of these patches >> or something? > > Well, I guess you can apply it on pinctrl tree. OK patch applied tentatively unless Nicolas or Jean-Christophe has objections. Yours, Linus Walleij
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index d990e33d8aa7..9bd18fdc604a 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c @@ -1137,6 +1137,17 @@ static void at91_gpio_free(struct gpio_chip *chip, unsigned offset) pinctrl_free_gpio(gpio); } +static int at91_gpio_get_direction(struct gpio_chip *chip, unsigned offset) +{ + struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip); + void __iomem *pio = at91_gpio->regbase; + unsigned mask = 1 << offset; + u32 osr; + + osr = readl_relaxed(pio + PIO_OSR); + return !(osr & mask); +} + static int at91_gpio_direction_input(struct gpio_chip *chip, unsigned offset) { struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip); @@ -1543,6 +1554,7 @@ static int at91_gpio_of_irq_setup(struct device_node *node, static struct gpio_chip at91_gpio_template = { .request = at91_gpio_request, .free = at91_gpio_free, + .get_direction = at91_gpio_get_direction, .direction_input = at91_gpio_direction_input, .get = at91_gpio_get, .direction_output = at91_gpio_direction_output,
This is needed for gpiod_get_direction(). Otherwise, it returns -EINVAL. Signed-off-by: Richard Genoud <richard.genoud@gmail.com> --- drivers/pinctrl/pinctrl-at91.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)