diff options
author | Axel Lin <axel.lin@ingics.com> | 2018-12-31 17:52:56 +0800 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2019-01-11 10:34:37 +0100 |
commit | e4889362e0389e95970d28707599aa8e08c35b51 (patch) | |
tree | c52e1425e126f2fd1e0b86754acaa508ea8343fd | |
parent | 72893f0c6bd399ce84e3c1c9fc69d234fe37d098 (diff) | |
download | linux-stable-e4889362e0389e95970d28707599aa8e08c35b51.tar.gz linux-stable-e4889362e0389e95970d28707599aa8e08c35b51.tar.bz2 linux-stable-e4889362e0389e95970d28707599aa8e08c35b51.zip |
gpio: sama5d2-piobu: Set proper output level for direction_output
Set proper output level base on the argument of direction_output.
Also remove sama5d2_piobu_set_direction() as there is only one caller
now.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | drivers/gpio/gpio-sama5d2-piobu.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/gpio/gpio-sama5d2-piobu.c b/drivers/gpio/gpio-sama5d2-piobu.c index 03a000659fa1..7d718557092e 100644 --- a/drivers/gpio/gpio-sama5d2-piobu.c +++ b/drivers/gpio/gpio-sama5d2-piobu.c @@ -109,16 +109,6 @@ static int sama5d2_piobu_read_value(struct gpio_chip *chip, unsigned int pin, } /** - * sama5d2_piobu_set_direction() - mark pin as input or output - */ -static int sama5d2_piobu_set_direction(struct gpio_chip *chip, - unsigned int direction, - unsigned int pin) -{ - return sama5d2_piobu_write_value(chip, pin, PIOBU_DIRECTION, direction); -} - -/** * sama5d2_piobu_get_direction() - gpiochip get_direction */ static int sama5d2_piobu_get_direction(struct gpio_chip *chip, @@ -138,7 +128,7 @@ static int sama5d2_piobu_get_direction(struct gpio_chip *chip, static int sama5d2_piobu_direction_input(struct gpio_chip *chip, unsigned int pin) { - return sama5d2_piobu_set_direction(chip, PIOBU_IN, pin); + return sama5d2_piobu_write_value(chip, pin, PIOBU_DIRECTION, PIOBU_IN); } /** @@ -147,7 +137,13 @@ static int sama5d2_piobu_direction_input(struct gpio_chip *chip, static int sama5d2_piobu_direction_output(struct gpio_chip *chip, unsigned int pin, int value) { - return sama5d2_piobu_set_direction(chip, PIOBU_OUT, pin); + unsigned int val = PIOBU_OUT; + + if (value) + val |= PIOBU_HIGH; + + return sama5d2_piobu_write_value(chip, pin, PIOBU_DIRECTION | PIOBU_SOD, + val); } /** |