From patchwork Wed Mar 9 20:20:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Sakoman X-Patchwork-Id: 622431 X-Patchwork-Delegate: tomi.valkeinen@nokia.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p29KLam6011347 for ; Wed, 9 Mar 2011 20:21:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751403Ab1CIUVf (ORCPT ); Wed, 9 Mar 2011 15:21:35 -0500 Received: from mail-fx0-f46.google.com ([209.85.161.46]:45276 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750818Ab1CIUVf (ORCPT ); Wed, 9 Mar 2011 15:21:35 -0500 Received: by mail-fx0-f46.google.com with SMTP id 17so872047fxm.19 for ; Wed, 09 Mar 2011 12:21:34 -0800 (PST) Received: by 10.223.160.80 with SMTP id m16mr3183892fax.72.1299702068749; Wed, 09 Mar 2011 12:21:08 -0800 (PST) Received: from localhost.localdomain (static-74-41-60-154.dsl1.pco.ca.frontiernet.net [74.41.60.154]) by mx.google.com with ESMTPS id n15sm1131692fam.12.2011.03.09.12.21.06 (version=SSLv3 cipher=OTHER); Wed, 09 Mar 2011 12:21:08 -0800 (PST) From: Steve Sakoman To: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: tomi.valkeinen@ti.com, Steve Sakoman Subject: [PATCH 1/2] OMAP: Add gpio-leds support for Overo Date: Wed, 9 Mar 2011 12:20:54 -0800 Message-Id: <1299702055-12480-2-git-send-email-steve@sakoman.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1299702055-12480-1-git-send-email-steve@sakoman.com> References: <1299702055-12480-1-git-send-email-steve@sakoman.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.6 (demeter1.kernel.org [140.211.167.41]); Wed, 09 Mar 2011 20:21:36 +0000 (UTC) diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c index 4278ecb..adc204b 100644 --- a/arch/arm/mach-omap2/board-overo.c +++ b/arch/arm/mach-omap2/board-overo.c @@ -473,6 +473,52 @@ static struct regulator_consumer_supply overo_vmmc1_supply = { .supply = "vmmc", }; +#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) +#include + +static struct gpio_led gpio_leds[] = { + { + .name = "overo:red:gpio21", + .default_trigger = "heartbeat", + .gpio = 21, + .active_low = true, + }, + { + .name = "overo:blue:gpio22", + .default_trigger = "none", + .gpio = 22, + .active_low = true, + }, + { + .name = "overo:blue:COM", + .default_trigger = "mmc0", + .gpio = -EINVAL, /* gets replaced */ + .active_low = true, + }, +}; + +static struct gpio_led_platform_data gpio_leds_pdata = { + .leds = gpio_leds, + .num_leds = ARRAY_SIZE(gpio_leds), +}; + +static struct platform_device gpio_leds_device = { + .name = "leds-gpio", + .id = -1, + .dev = { + .platform_data = &gpio_leds_pdata, + }, +}; + +static void __init overo_init_led(void) +{ + platform_device_register(&gpio_leds_device); +} + +#else +static inline void __init overo_init_led(void) { return; } +#endif + static int overo_twl_gpio_setup(struct device *dev, unsigned gpio, unsigned ngpio) { @@ -480,6 +526,9 @@ static int overo_twl_gpio_setup(struct device *dev, overo_vmmc1_supply.dev = mmc[0].dev; + /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ + gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; + return 0; } @@ -487,6 +536,7 @@ static struct twl4030_gpio_platform_data overo_gpio_data = { .gpio_base = OMAP_MAX_GPIO_LINES, .irq_base = TWL4030_GPIO_IRQ_BASE, .irq_end = TWL4030_GPIO_IRQ_END, + .use_leds = true, .setup = overo_twl_gpio_setup, }; @@ -648,6 +698,7 @@ static void __init overo_init(void) overo_spi_init(); overo_init_smsc911x(); overo_display_init(); + overo_init_led(); /* Ensure SDRC pins are mux'd for self-refresh */ omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);