Explorar o código

mpc85xx: make gpio_direction_output respect value

Users of familiar with the Linux gpiolib API expect that value parameter
to gpio_direction_output reflects the initial state of the output pin.
gpio_direction_output was always driving the output low, now it drives
it high or low according to the value provided.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Cc: Kyle Moffett <Kyle.D.Moffett@boeing.com>
Cc: Andy Fleming <afleming@gmail.com>
Cc: Peter Tyser <ptyser@xes-inc.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Andy Fleming <afleming@freescale.com>
Chris Packham %!s(int64=12) %!d(string=hai) anos
pai
achega
168e5bc409
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      arch/powerpc/include/asm/mpc85xx_gpio.h

+ 4 - 1
arch/powerpc/include/asm/mpc85xx_gpio.h

@@ -98,7 +98,10 @@ static inline int gpio_direction_input(unsigned gpio)
 
 static inline int gpio_direction_output(unsigned gpio, int value)
 {
-	mpc85xx_gpio_set_low(1U << gpio);
+	if (value)
+		mpc85xx_gpio_set_high(1U << gpio);
+	else
+		mpc85xx_gpio_set_low(1U << gpio);
 	return 0;
 }