Skip to content

Commit 4c02cba

Browse files
lategoodbyelinusw
authored andcommitted
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: e1b2dc7 ("pinctrl: add bcm2835 driver") Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 99a735b commit 4c02cba

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

drivers/pinctrl/bcm/pinctrl-bcm2835.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -342,19 +342,20 @@ static int bcm2835_gpio_get(struct gpio_chip *chip, unsigned offset)
342342
return bcm2835_gpio_get_bit(pc, GPLEV0, offset);
343343
}
344344

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-
351345
static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
352346
{
353347
struct bcm2835_pinctrl *pc = dev_get_drvdata(chip->dev);
354348

355349
bcm2835_gpio_set_bit(pc, value ? GPSET0 : GPCLR0, offset);
356350
}
357351

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+
358359
static int bcm2835_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
359360
{
360361
struct bcm2835_pinctrl *pc = dev_get_drvdata(chip->dev);

0 commit comments

Comments
 (0)