Skip to content

Commit

Permalink
pinctrl: msm: Fix set gpio setting
Browse files Browse the repository at this point in the history
Set g->out_bit bit for gpio output high, clear g->out_bit bit for gpio output
low.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Axel Lin authored and Linus Walleij committed Dec 20, 2013
1 parent 37ef1d9 commit e476e77
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions drivers/pinctrl/pinctrl-msm.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,12 @@ static int msm_gpio_direction_output(struct gpio_chip *chip, unsigned offset, in

spin_lock_irqsave(&pctrl->lock, flags);

writel(value ? BIT(g->out_bit) : 0, pctrl->regs + g->io_reg);
val = readl(pctrl->regs + g->io_reg);
if (value)
val |= BIT(g->out_bit);
else
val &= ~BIT(g->out_bit);
writel(val, pctrl->regs + g->io_reg);

val = readl(pctrl->regs + g->ctl_reg);
val |= BIT(g->oe_bit);
Expand Down Expand Up @@ -468,7 +473,10 @@ static void msm_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
spin_lock_irqsave(&pctrl->lock, flags);

val = readl(pctrl->regs + g->io_reg);
val |= BIT(g->out_bit);
if (value)
val |= BIT(g->out_bit);
else
val &= ~BIT(g->out_bit);
writel(val, pctrl->regs + g->io_reg);

spin_unlock_irqrestore(&pctrl->lock, flags);
Expand Down

0 comments on commit e476e77

Please sign in to comment.