diff options
author | Stefan Wahren <stefan.wahren@i2se.com> | 2015-11-18 19:32:27 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2015-12-14 05:31:20 -0500 |
commit | 4c02cba18cc9de672a554ddda4f23dec8cb4b48e (patch) | |
tree | dbaa6d40b3a8cafb9ccafadde350389596bc2691 | |
parent | 99a735b3c287b70aa67952b1ff3d85cd924d85f9 (diff) |
pinctrl: bcm2835: Fix initial value for direction_output
Currently the provided initial value for bcm2835_gpio_direction_output
has no effect. So fix this issue by changing the value before
changing the GPIO direction. As a result we need to move the function below
bcm2835_gpio_set.
Suggested-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Acked-by: Eric Anholt <eric@anholt.net>
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Fixes: e1b2dc70cd5b ("pinctrl: add bcm2835 driver")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | drivers/pinctrl/bcm/pinctrl-bcm2835.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c index a1ea565fcd46..2e6ca69635aa 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c | |||
@@ -342,12 +342,6 @@ static int bcm2835_gpio_get(struct gpio_chip *chip, unsigned offset) | |||
342 | return bcm2835_gpio_get_bit(pc, GPLEV0, offset); | 342 | return bcm2835_gpio_get_bit(pc, GPLEV0, offset); |
343 | } | 343 | } |
344 | 344 | ||
345 | static int bcm2835_gpio_direction_output(struct gpio_chip *chip, | ||
346 | unsigned offset, int value) | ||
347 | { | ||
348 | return pinctrl_gpio_direction_output(chip->base + offset); | ||
349 | } | ||
350 | |||
351 | static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | 345 | static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value) |
352 | { | 346 | { |
353 | struct bcm2835_pinctrl *pc = dev_get_drvdata(chip->dev); | 347 | struct bcm2835_pinctrl *pc = dev_get_drvdata(chip->dev); |
@@ -355,6 +349,13 @@ static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | |||
355 | bcm2835_gpio_set_bit(pc, value ? GPSET0 : GPCLR0, offset); | 349 | bcm2835_gpio_set_bit(pc, value ? GPSET0 : GPCLR0, offset); |
356 | } | 350 | } |
357 | 351 | ||
352 | static int bcm2835_gpio_direction_output(struct gpio_chip *chip, | ||
353 | unsigned offset, int value) | ||
354 | { | ||
355 | bcm2835_gpio_set(chip, offset, value); | ||
356 | return pinctrl_gpio_direction_output(chip->base + offset); | ||
357 | } | ||
358 | |||
358 | static int bcm2835_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | 359 | static int bcm2835_gpio_to_irq(struct gpio_chip *chip, unsigned offset) |
359 | { | 360 | { |
360 | struct bcm2835_pinctrl *pc = dev_get_drvdata(chip->dev); | 361 | struct bcm2835_pinctrl *pc = dev_get_drvdata(chip->dev); |