diff options
author | Sonic Zhang <sonic.zhang@analog.com> | 2013-10-08 03:31:21 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-10-09 07:09:41 -0400 |
commit | d3224ed140dc440c43e1da607b7685635e8064a6 (patch) | |
tree | ce922f0205e55172c9af68843296a7dd4a93a60e /drivers/pinctrl/pinctrl-adi2.c | |
parent | 010c51e189c6a37da2908d27c93e73584f6e8fa8 (diff) |
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/pinctrl-adi2.c')
-rw-r--r-- | drivers/pinctrl/pinctrl-adi2.c | 14 |
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, | |||
766 | spin_lock_irqsave(&port->lock, flags); | 766 | spin_lock_irqsave(&port->lock, flags); |
767 | 767 | ||
768 | if (value) | 768 | if (value) |
769 | writew(1 << offset, ®s->data_set); | 769 | writew(BIT(offset), ®s->data_set); |
770 | else | 770 | else |
771 | writew(1 << offset, ®s->data_clear); | 771 | writew(BIT(offset), ®s->data_clear); |
772 | 772 | ||
773 | spin_unlock_irqrestore(&port->lock, flags); | 773 | spin_unlock_irqrestore(&port->lock, flags); |
774 | } | 774 | } |
@@ -780,12 +780,14 @@ static int adi_gpio_direction_output(struct gpio_chip *chip, unsigned offset, | |||
780 | struct gpio_port_t *regs = port->regs; | 780 | struct gpio_port_t *regs = port->regs; |
781 | unsigned long flags; | 781 | unsigned long flags; |
782 | 782 | ||
783 | adi_gpio_set_value(chip, offset, value); | ||
784 | |||
785 | spin_lock_irqsave(&port->lock, flags); | 783 | spin_lock_irqsave(&port->lock, flags); |
786 | 784 | ||
787 | writew(readw(®s->inen) & ~(1 << offset), ®s->inen); | 785 | writew(readw(®s->inen) & ~BIT(offset), ®s->inen); |
788 | writew(1 << offset, ®s->dir_set); | 786 | if (value) |
787 | writew(BIT(offset), ®s->data_set); | ||
788 | else | ||
789 | writew(BIT(offset), ®s->data_clear); | ||
790 | writew(BIT(offset), ®s->dir_set); | ||
789 | 791 | ||
790 | spin_unlock_irqrestore(&port->lock, flags); | 792 | spin_unlock_irqrestore(&port->lock, flags); |
791 | 793 | ||