From patchwork Sat Sep 28 03:24:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Otavio Salvador X-Patchwork-Id: 278708 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id F1E242C032D for ; Sat, 28 Sep 2013 13:33:22 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B86B44A080; Sat, 28 Sep 2013 05:33:21 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0gAl0S14xHTH; Sat, 28 Sep 2013 05:33:21 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3BF514A090; Sat, 28 Sep 2013 05:33:06 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2ED494A08B for ; Sat, 28 Sep 2013 05:32:50 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5ggEmUieOeV8 for ; Sat, 28 Sep 2013 05:32:45 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-yh0-f41.google.com (mail-yh0-f41.google.com [209.85.213.41]) by theia.denx.de (Postfix) with ESMTPS id 085FD4A080 for ; Sat, 28 Sep 2013 05:32:23 +0200 (CEST) Received: by mail-yh0-f41.google.com with SMTP id f73so1302336yha.14 for ; Fri, 27 Sep 2013 20:32:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :organization; bh=tJmXTHzfsU7Xh9l92oyvP4ZukKRlWx+9hSqQdksSG54=; b=ImfsNCY+0OkKG9g+P1MI07rh9PAaq8BOrBwz5LLz8masz9HAtjvRbYHqJtJ7Vieoao vECzRq7jRrJTi4g83OO5bAhHTJnT6vLAV3ff9Xd95E/9jolaCER7J+QVPo8pM6d3aL4/ k9UFQvkLCuNE7KzxG2j7z239Ujd5+MwMHfGO9y4Xu227JeepxtMhLmwlZ2Z902uZuu0p d4i2/+dOlF9lj1fc3y2jszfOe3awEgqvhqxDfNCj8nIgMbW/s1dOkpvuquKmeypWngmr eOw2VRo5ftPi38TH8CF6+xwRhRr5bc+xg9cc0/j4U35jAa98Jjorxa6S7Utv1q/fdrO3 aRlg== X-Received: by 10.236.32.3 with SMTP id n3mr10270823yha.25.1380338684462; Fri, 27 Sep 2013 20:24:44 -0700 (PDT) Received: from nano.lab.ossystems.com.br ([177.194.209.11]) by mx.google.com with ESMTPSA id v45sm15980678yha.2.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 27 Sep 2013 20:24:44 -0700 (PDT) From: Otavio Salvador To: U-Boot Mailing List Date: Sat, 28 Sep 2013 00:24:16 -0300 Message-Id: <1380338659-7896-5-git-send-email-otavio@ossystems.com.br> X-Mailer: git-send-email 1.8.4.rc3 In-Reply-To: <1380338659-7896-1-git-send-email-otavio@ossystems.com.br> References: <1380338659-7896-1-git-send-email-otavio@ossystems.com.br> Organization: O.S. Systems Software LTDA. Cc: Otavio Salvador Subject: [U-Boot] [PATCH 5/7] gpio-led: Fix __led_toggle support to first set GPIO as input X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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 toggle' for GPIO based LEDs. Signed-off-by: Otavio Salvador --- 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)); }