Skip to contentSkip to conversation

mpc85xx: make gpio_direction_output respect value

PATCH New Chris Packham 1 participant 1 message Sep 7, 2012 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mpc85xx: make gpio_direction_output respect value

From: Chris Packham <[email protected]>

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.

Cc Kyle Moffett <[email protected]>
Cc Andy Fleming <[email protected]>
Cc Peter Tyser <[email protected]>
Cc Kumar Gala <[email protected]>
---
 arch/powerpc/include/asm/mpc85xx_gpio.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/mpc85xx_gpio.h +4 -1
index 5a608a5..2aed514 100644
@@ -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;
 }
 
Signature · 1 line
1.7.12.rc2.16.g034161a