diff options
author | Gregory CLEMENT <gregory.clement@free-electrons.com> | 2017-11-14 11:51:50 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2017-11-29 08:09:23 -0500 |
commit | 6702abb3bf2394f250af0ee04070227bb5dda788 (patch) | |
tree | 7f1a0ac42f4d849fc086eed04c20bcbf74f25397 /drivers/pinctrl | |
parent | 4bd6683da2e64590bdc27ecf7e61ad8376861768 (diff) |
pinctrl: armada-37xx: Fix direction_output() callback behavior
The direction_output callback of the gpio_chip structure is supposed to
set the output direction but also to set the value of the gpio. For the
armada-37xx driver this callback acted as the gpio_set_direction callback
for the pinctrl.
This patch fixes the behavior of the direction_output callback by also
applying the value received as parameter.
Cc: stable@vger.kernel.org
Fixes: 5715092a458c ("pinctrl: armada-37xx: Add gpio support")
Reported-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c index d45af31b86b4..bdb8d174efef 100644 --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | |||
@@ -408,12 +408,21 @@ static int armada_37xx_gpio_direction_output(struct gpio_chip *chip, | |||
408 | { | 408 | { |
409 | struct armada_37xx_pinctrl *info = gpiochip_get_data(chip); | 409 | struct armada_37xx_pinctrl *info = gpiochip_get_data(chip); |
410 | unsigned int reg = OUTPUT_EN; | 410 | unsigned int reg = OUTPUT_EN; |
411 | unsigned int mask; | 411 | unsigned int mask, val, ret; |
412 | 412 | ||
413 | armada_37xx_update_reg(®, offset); | 413 | armada_37xx_update_reg(®, offset); |
414 | mask = BIT(offset); | 414 | mask = BIT(offset); |
415 | 415 | ||
416 | return regmap_update_bits(info->regmap, reg, mask, mask); | 416 | ret = regmap_update_bits(info->regmap, reg, mask, mask); |
417 | |||
418 | if (ret) | ||
419 | return ret; | ||
420 | |||
421 | reg = OUTPUT_VAL; | ||
422 | val = value ? mask : 0; | ||
423 | regmap_update_bits(info->regmap, reg, mask, val); | ||
424 | |||
425 | return 0; | ||
417 | } | 426 | } |
418 | 427 | ||
419 | static int armada_37xx_gpio_get(struct gpio_chip *chip, unsigned int offset) | 428 | static int armada_37xx_gpio_get(struct gpio_chip *chip, unsigned int offset) |