brcm2708: switch to linux 4.4 and update patches
[openwrt.git] / target / linux / brcm2708 / patches-4.1 / 0057-pinctrl-bcm2835-bcm2835_gpio_direction_output-must-s.patch
1 From fe1f360d5a84d13cecc758866356ce8ab8c6c3ef Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Wed, 4 Feb 2015 10:02:24 +0000
4 Subject: [PATCH 057/222] pinctrl-bcm2835: bcm2835_gpio_direction_output must
5  set the value
6
7 ---
8  drivers/pinctrl/bcm/pinctrl-bcm2835.c | 9 ++++++++-
9  1 file changed, 8 insertions(+), 1 deletion(-)
10
11 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
12 +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
13 @@ -355,7 +355,14 @@ static int bcm2835_gpio_get(struct gpio_
14  static int bcm2835_gpio_direction_output(struct gpio_chip *chip,
15                 unsigned offset, int value)
16  {
17 -       return pinctrl_gpio_direction_output(chip->base + offset);
18 +       struct bcm2835_pinctrl *pc = dev_get_drvdata(chip->dev);
19 +       int ret;
20 +
21 +       ret = pinctrl_gpio_direction_output(chip->base + offset);
22 +       if (ret >= 0)
23 +               bcm2835_gpio_set_bit(pc, value ? GPSET0 : GPCLR0, offset);
24 +
25 +       return ret;
26  }
27  
28  static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value)