From patchwork Mon Mar 1 11:18:08 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enric Balletbo Serra X-Patchwork-Id: 83403 X-Patchwork-Delegate: tony@atomide.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o23Hbo6r016992 for ; Wed, 3 Mar 2010 17:37:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755047Ab0CCRhv (ORCPT ); Wed, 3 Mar 2010 12:37:51 -0500 Received: from mail-bw0-f209.google.com ([209.85.218.209]:38453 "EHLO mail-bw0-f209.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754969Ab0CCRhu (ORCPT ); Wed, 3 Mar 2010 12:37:50 -0500 Received: by mail-bw0-f209.google.com with SMTP id 1so114868bwz.21 for ; Wed, 03 Mar 2010 09:37:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=tG/recD6cIYXYEGZLj+psvcqpw3iQvgOCkL4D1mtn7s=; b=ga/nTpZfx71S9Jo6ZiQ9kCrQ4ETWry0r1lSv1LefPGC5G1bNZpL2Aq1fg+Kn8f7UTQ K4aks/ILa+EjsG+I9/AgLh8tQwaVzohbnrVxEKL7uLBjnLn73/fSEh1PLb7VIU81x0Di y0htJgSD00DT0hTT/4uRUg2mokPv9qwwhpr1g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=lWjPKYw+sm9aR1CNs9KUIuC+3M2Me8iOUEbaVf3o90O9f/VOv0fA1YOopUD1qErVyv HTJ3Nl2erYtL1AWqiQMTz5qidJwWk0nuhHn8WODfLkr7Rre435CEKUrtaRP8TYtTR5Na Lg/XkfmphSH5W2MG1eRLgpC7YmMAaHaNpz+w8= Received: by 10.204.34.75 with SMTP id k11mr21542bkd.152.1267637869968; Wed, 03 Mar 2010 09:37:49 -0800 (PST) Received: from localhost.localdomain (248.Red-213-97-239.staticIP.rima-tde.net [213.97.239.248]) by mx.google.com with ESMTPS id a11sm2382663bkc.3.2010.03.03.09.37.47 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 03 Mar 2010 09:37:48 -0800 (PST) From: Enric Balletbo i Serra To: linux-omap@vger.kernel.org Cc: Enric Balletbo i Serra Subject: [PATCH] omap3: Fix support for the LEDs connected to GPIO outputs on IGEP v2 board. Date: Mon, 1 Mar 2010 12:18:08 +0100 Message-Id: <1267442288-3106-2-git-send-email-eballetbo@gmail.com> X-Mailer: git-send-email 1.6.0.4 In-Reply-To: <1267442288-3106-1-git-send-email-eballetbo@gmail.com> References: <1267442288-3106-1-git-send-email-eballetbo@gmail.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 03 Mar 2010 17:37:52 +0000 (UTC) diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c index 26f65ca..19aaff0 100644 --- a/arch/arm/mach-omap2/board-igep0020.c +++ b/arch/arm/mach-omap2/board-igep0020.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include @@ -39,8 +38,8 @@ #define IGEP2_SMSC911X_CS 5 #define IGEP2_SMSC911X_GPIO 176 #define IGEP2_GPIO_USBH_NRESET 24 -#define IGEP2_GPIO_LED0_RED 26 -#define IGEP2_GPIO_LED0_GREEN 27 +#define IGEP2_GPIO_LED0_GREEN 26 +#define IGEP2_GPIO_LED0_RED 27 #define IGEP2_GPIO_LED1_RED 28 #define IGEP2_GPIO_DVI_PUP 170 #define IGEP2_GPIO_WIFI_NPD 94 @@ -355,34 +354,50 @@ static void __init igep2_display_init(void) gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1)) pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n"); } -#ifdef CONFIG_LEDS_TRIGGERS -static struct gpio_led gpio_leds[] = { + +#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) +#include + +static struct gpio_led igep2_gpio_leds[] = { { - .name = "GPIO_LED1_RED", + .name = "led0:red", + .gpio = IGEP2_GPIO_LED0_RED, + }, + { + .name = "led0:green", .default_trigger = "heartbeat", + .gpio = IGEP2_GPIO_LED0_GREEN, + }, + { + .name = "led1:red", .gpio = IGEP2_GPIO_LED1_RED, }, }; -static struct gpio_led_platform_data gpio_leds_info = { - .leds = gpio_leds, - .num_leds = ARRAY_SIZE(gpio_leds), +static struct gpio_led_platform_data igep2_led_pdata = { + .leds = igep2_gpio_leds, + .num_leds = ARRAY_SIZE(igep2_gpio_leds), }; -static struct platform_device leds_gpio = { +static struct platform_device igep2_led_device = { .name = "leds-gpio", .id = -1, .dev = { - .platform_data = &gpio_leds_info, + .platform_data = &igep2_led_pdata, }, }; + +static void __init igep2_init_led(void) +{ + platform_device_register(&igep2_led_device); +} + +#else +static inline void igep2_init_led(void) {} #endif static struct platform_device *igep2_devices[] __initdata = { &igep2_dss_device, -#ifdef CONFIG_LEDS_TRIGGERS - &leds_gpio, -#endif }; static void __init igep2_init_irq(void) @@ -471,31 +486,34 @@ static void __init igep2_init(void) usb_ehci_init(&ehci_pdata); igep2_flash_init(); + igep2_init_led(); igep2_display_init(); igep2_init_smsc911x(); /* GPIO userspace leds */ - if ((gpio_request(IGEP2_GPIO_LED0_RED, "GPIO_LED0_RED") == 0) && +#if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE) + if ((gpio_request(IGEP2_GPIO_LED0_RED, "led0:red") == 0) && (gpio_direction_output(IGEP2_GPIO_LED0_RED, 1) == 0)) { gpio_export(IGEP2_GPIO_LED0_RED, 0); gpio_set_value(IGEP2_GPIO_LED0_RED, 0); } else pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_RED\n"); - if ((gpio_request(IGEP2_GPIO_LED0_GREEN, "GPIO_LED0_GREEN") == 0) && + if ((gpio_request(IGEP2_GPIO_LED0_GREEN, "led0:green") == 0) && (gpio_direction_output(IGEP2_GPIO_LED0_GREEN, 1) == 0)) { gpio_export(IGEP2_GPIO_LED0_GREEN, 0); gpio_set_value(IGEP2_GPIO_LED0_GREEN, 0); } else pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_GREEN\n"); -#ifndef CONFIG_LEDS_TRIGGERS - if ((gpio_request(IGEP2_GPIO_LED1_RED, "GPIO_LED1_RED") == 0) && + + if ((gpio_request(IGEP2_GPIO_LED1_RED, "led1:red") == 0) && (gpio_direction_output(IGEP2_GPIO_LED1_RED, 1) == 0)) { gpio_export(IGEP2_GPIO_LED1_RED, 0); gpio_set_value(IGEP2_GPIO_LED1_RED, 0); } else pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_RED\n"); #endif + /* GPIO W-LAN + Bluetooth combo module */ if ((gpio_request(IGEP2_GPIO_WIFI_NPD, "GPIO_WIFI_NPD") == 0) && (gpio_direction_output(IGEP2_GPIO_WIFI_NPD, 1) == 0)) {