[U-Boot] [PATCH 5/7] gpio-led: Fix __led_toggle support to first set GPIO as input

Otavio Salvador otavio at ossystems.com.br
Sat Sep 28 05:24:16 CEST 2013


The GPIO need to be set as input before reading its current value and
set back to output for setting it; this fixes the non-working
'led <id> toggle' for GPIO based LEDs.

Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>
---
 drivers/misc/gpio_led.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/gpio_led.c b/drivers/misc/gpio_led.c
index 6afb986..1882751 100644
--- a/drivers/misc/gpio_led.c
+++ b/drivers/misc/gpio_led.c
@@ -22,5 +22,6 @@ void __led_set(led_id_t mask, int state)
 
 void __led_toggle(led_id_t mask)
 {
-	gpio_set_value(mask, !gpio_get_value(mask));
+	gpio_direction_input(mask);
+	__led_set(mask, !gpio_get_value(mask));
 }
-- 
1.8.4.rc3



More information about the U-Boot mailing list