summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorSonic Zhang <sonic.zhang@analog.com>2013-10-08 15:31:21 +0800
committerLinus Walleij <linus.walleij@linaro.org>2013-10-09 13:09:41 +0200
commitd3224ed140dc440c43e1da607b7685635e8064a6 (patch)
treece922f0205e55172c9af68843296a7dd4a93a60e /drivers/pinctrl
parent010c51e189c6a37da2908d27c93e73584f6e8fa8 (diff)
downloadblackbird-op-linux-d3224ed140dc440c43e1da607b7685635e8064a6.tar.gz
blackbird-op-linux-d3224ed140dc440c43e1da607b7685635e8064a6.zip
pinctrl: pinctrl-adi2: disable IRQ when setting value
GPIO output value should be set after the GPIO interrupt is disabled. Use BIT macro as well. Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> [Edited commit message] Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/pinctrl-adi2.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/pinctrl/pinctrl-adi2.c b/drivers/pinctrl/pinctrl-adi2.c
index a74e6f4ffbd7..7a39562c3e42 100644
--- a/drivers/pinctrl/pinctrl-adi2.c
+++ b/drivers/pinctrl/pinctrl-adi2.c
@@ -766,9 +766,9 @@ static void adi_gpio_set_value(struct gpio_chip *chip, unsigned offset,
spin_lock_irqsave(&port->lock, flags);
if (value)
- writew(1 << offset, &regs->data_set);
+ writew(BIT(offset), &regs->data_set);
else
- writew(1 << offset, &regs->data_clear);
+ writew(BIT(offset), &regs->data_clear);
spin_unlock_irqrestore(&port->lock, flags);
}
@@ -780,12 +780,14 @@ static int adi_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
struct gpio_port_t *regs = port->regs;
unsigned long flags;
- adi_gpio_set_value(chip, offset, value);
-
spin_lock_irqsave(&port->lock, flags);
- writew(readw(&regs->inen) & ~(1 << offset), &regs->inen);
- writew(1 << offset, &regs->dir_set);
+ writew(readw(&regs->inen) & ~BIT(offset), &regs->inen);
+ if (value)
+ writew(BIT(offset), &regs->data_set);
+ else
+ writew(BIT(offset), &regs->data_clear);
+ writew(BIT(offset), &regs->dir_set);
spin_unlock_irqrestore(&port->lock, flags);
OpenPOWER on IntegriCloud