From e476e77fe0fc82ba0c240ca5d7e9f81a742fc62e Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 13 Dec 2013 21:35:55 +0800 Subject: 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 Signed-off-by: Linus Walleij --- drivers/pinctrl/pinctrl-msm.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'drivers/pinctrl') 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 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); @@ -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); -- cgit v1.2.3