Skip to content

Commit

Permalink
ARM: 6147/1: nomadik-gpio: set val in ->direction_output()
Browse files Browse the repository at this point in the history
The ->direction_output() callback needs to set the value it was passed,
in addition to setting the direction as output.  On this peripheral, we
can't set the value before setting the direction, so set it after.

Acked-by: Alessandro Rubini <rubini@unipv.it>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Rabin Vincent authored and Russell King committed Jun 16, 2010
1 parent 5c0c1f0 commit 6647c6c
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions arch/arm/plat-nomadik/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,6 @@ static int nmk_gpio_make_input(struct gpio_chip *chip, unsigned offset)
return 0;
}

static int nmk_gpio_make_output(struct gpio_chip *chip, unsigned offset,
int val)
{
struct nmk_gpio_chip *nmk_chip =
container_of(chip, struct nmk_gpio_chip, chip);

writel(1 << offset, nmk_chip->addr + NMK_GPIO_DIRS);
return 0;
}

static int nmk_gpio_get_input(struct gpio_chip *chip, unsigned offset)
{
struct nmk_gpio_chip *nmk_chip =
Expand All @@ -298,6 +288,18 @@ static void nmk_gpio_set_output(struct gpio_chip *chip, unsigned offset,
writel(bit, nmk_chip->addr + NMK_GPIO_DATC);
}

static int nmk_gpio_make_output(struct gpio_chip *chip, unsigned offset,
int val)
{
struct nmk_gpio_chip *nmk_chip =
container_of(chip, struct nmk_gpio_chip, chip);

writel(1 << offset, nmk_chip->addr + NMK_GPIO_DIRS);
nmk_gpio_set_output(chip, offset, val);

return 0;
}

/* This structure is replicated for each GPIO block allocated at probe time */
static struct gpio_chip nmk_gpio_template = {
.direction_input = nmk_gpio_make_input,
Expand Down

0 comments on commit 6647c6c

Please sign in to comment.