diff options
author | Axel Lin <axel.lin@ingics.com> | 2013-12-13 08:35:55 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-12-20 04:13:23 -0500 |
commit | e476e77fe0fc82ba0c240ca5d7e9f81a742fc62e (patch) | |
tree | 8fbf277ff56cc65b6dfc0571b82942e93af09538 /drivers/pinctrl | |
parent | 37ef1d9243759ca69032be2a68d5d1a87a295fd4 (diff) |
pinctrl: msm: Fix set gpio setting
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>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/pinctrl-msm.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/pinctrl/pinctrl-msm.c b/drivers/pinctrl/pinctrl-msm.c index 011e26334077..ef2bf3126da6 100644 --- a/drivers/pinctrl/pinctrl-msm.c +++ b/drivers/pinctrl/pinctrl-msm.c | |||
@@ -429,7 +429,12 @@ static int msm_gpio_direction_output(struct gpio_chip *chip, unsigned offset, in | |||
429 | 429 | ||
430 | spin_lock_irqsave(&pctrl->lock, flags); | 430 | spin_lock_irqsave(&pctrl->lock, flags); |
431 | 431 | ||
432 | writel(value ? BIT(g->out_bit) : 0, pctrl->regs + g->io_reg); | 432 | val = readl(pctrl->regs + g->io_reg); |
433 | if (value) | ||
434 | val |= BIT(g->out_bit); | ||
435 | else | ||
436 | val &= ~BIT(g->out_bit); | ||
437 | writel(val, pctrl->regs + g->io_reg); | ||
433 | 438 | ||
434 | val = readl(pctrl->regs + g->ctl_reg); | 439 | val = readl(pctrl->regs + g->ctl_reg); |
435 | val |= BIT(g->oe_bit); | 440 | val |= BIT(g->oe_bit); |
@@ -468,7 +473,10 @@ static void msm_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | |||
468 | spin_lock_irqsave(&pctrl->lock, flags); | 473 | spin_lock_irqsave(&pctrl->lock, flags); |
469 | 474 | ||
470 | val = readl(pctrl->regs + g->io_reg); | 475 | val = readl(pctrl->regs + g->io_reg); |
471 | val |= BIT(g->out_bit); | 476 | if (value) |
477 | val |= BIT(g->out_bit); | ||
478 | else | ||
479 | val &= ~BIT(g->out_bit); | ||
472 | writel(val, pctrl->regs + g->io_reg); | 480 | writel(val, pctrl->regs + g->io_reg); |
473 | 481 | ||
474 | spin_unlock_irqrestore(&pctrl->lock, flags); | 482 | spin_unlock_irqrestore(&pctrl->lock, flags); |