From patchwork Mon Aug 8 08:49:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jochen Friedrich X-Patchwork-Id: 1043362 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p788rVcl005257 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 8 Aug 2011 08:53:51 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QqLaJ-0008By-7y; Mon, 08 Aug 2011 08:53:19 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QqLaI-00037T-ID; Mon, 08 Aug 2011 08:53:18 +0000 Received: from mail0.scram.de ([2a01:4f8:130:2201::3] helo=mail.scram.de) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QqLXs-0002KO-Tb for linux-arm-kernel@lists.infradead.org; Mon, 08 Aug 2011 08:50:51 +0000 Received: from localhost (mail0.scram.de [78.47.204.202]) by localhost (Postfix) with ESMTP id CE84054084; Mon, 8 Aug 2011 10:50:45 +0200 (CEST) Authentication-Results: localhost; dkim=pass (1024-bit key) header.i=@scram.de; dkim-asp=signed X-Virus-Scanned: Debian amavisd-new at colab.de X-Spam-Flag: NO X-Spam-Score: -4.38 X-Spam-Level: X-Spam-Status: No, score=-4.38 required=5 tests=[ALL_TRUSTED=-1.8, AWL=0.129, BAYES_00=-2.599, DKIM_SIGNED=-0.01, DKIM_VERIFIED=-0.1] Authentication-Results: amavis.colab.de (amavisd-new); dkim=pass header.i=@scram.de Received: from mail.scram.de ([78.47.204.202]) by localhost (amavis.colab.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id x9TtTMJ0g0rU; Mon, 8 Aug 2011 10:50:32 +0200 (CEST) Received: from vfrsxgvnjfr-dev1.vr-netze.vrnet (prx.genotel.de [83.136.72.5]) (Authenticated sender: scram287) by mail.scram.de (Postfix) with ESMTPA id 5EE53544AA; Mon, 8 Aug 2011 10:50:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=scram.de; s=mail201002; t=1312793421; bh=ZbyABYrgXQvbcxPrvKeoVE8B3wM3FbJpxvRR kctrp9c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To: References; b=anHihnFxmubrGz5k2iDAjmXrPEJJKyQOQiL1j3i0lQwnNPBttzEQ VfN3QXZu1ArtMHA4vt5rS22jVnxXBN2JoMbLpHUsTh7+/LIaEt6eOpaYN32KBSu5bT9 /+Ov/bV4W70KQvVHvUcuTt+hdVLY7n+0xvbT7n46KfQAP9Uz+3jI= From: Jochen Friedrich To: linux-arm-kernel@lists.infradead.org, linux@arm.linux.org.uk, bryan.wu@canonical.com, kristoffer.ericson@gmail.com Subject: [PATCH 3.2 4/4] ARM: simpad: replace ARM specific LED code Date: Mon, 8 Aug 2011 10:49:39 +0200 Message-Id: <1312793379-6020-5-git-send-email-jochen@scram.de> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1312793379-6020-1-git-send-email-jochen@scram.de> References: <1312793379-6020-1-git-send-email-jochen@scram.de> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110808_045049_472934_3ECC003C X-CRM114-Status: GOOD ( 15.60 ) X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.8 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: linux-kernel@vger.kernel.org, Jochen Friedrich X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 08 Aug 2011 08:53:51 +0000 (UTC) Remove the legacy ARM LED code for simpad devices and register a stadard LED platform device using GPIO line instead. Signed-off-by: Jochen Friedrich --- arch/arm/mach-sa1100/Makefile | 1 - arch/arm/mach-sa1100/leds-simpad.c | 97 ------------------------------------ arch/arm/mach-sa1100/leds.c | 2 - arch/arm/mach-sa1100/leds.h | 1 - arch/arm/mach-sa1100/simpad.c | 28 ++++++++++ 5 files changed, 28 insertions(+), 101 deletions(-) delete mode 100644 arch/arm/mach-sa1100/leds-simpad.c diff --git a/arch/arm/mach-sa1100/Makefile b/arch/arm/mach-sa1100/Makefile index 41252d2..0063178 100644 --- a/arch/arm/mach-sa1100/Makefile +++ b/arch/arm/mach-sa1100/Makefile @@ -45,7 +45,6 @@ obj-$(CONFIG_SA1100_PLEB) += pleb.o obj-$(CONFIG_SA1100_SHANNON) += shannon.o obj-$(CONFIG_SA1100_SIMPAD) += simpad.o -led-$(CONFIG_SA1100_SIMPAD) += leds-simpad.o # LEDs support obj-$(CONFIG_LEDS) += $(led-y) diff --git a/arch/arm/mach-sa1100/leds-simpad.c b/arch/arm/mach-sa1100/leds-simpad.c deleted file mode 100644 index d25784c..0000000 --- a/arch/arm/mach-sa1100/leds-simpad.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * linux/arch/arm/mach-sa1100/leds-simpad.c - * - * Author: Juergen Messerer - */ -#include - -#include -#include -#include -#include - -#include "leds.h" - - -#define LED_STATE_ENABLED 1 -#define LED_STATE_CLAIMED 2 - -static unsigned int led_state; -static unsigned int hw_led_state; - -#define LED_GREEN (1) -#define LED_MASK (1) - -void simpad_leds_event(led_event_t evt) -{ - switch (evt) - { - case led_start: - hw_led_state = LED_GREEN; - led_state = LED_STATE_ENABLED; - break; - - case led_stop: - led_state &= ~LED_STATE_ENABLED; - break; - - case led_claim: - led_state |= LED_STATE_CLAIMED; - hw_led_state = LED_GREEN; - break; - - case led_release: - led_state &= ~LED_STATE_CLAIMED; - hw_led_state = LED_GREEN; - break; - -#ifdef CONFIG_LEDS_TIMER - case led_timer: - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state ^= LED_GREEN; - break; -#endif - -#ifdef CONFIG_LEDS_CPU - case led_idle_start: - break; - - case led_idle_end: - break; -#endif - - case led_halted: - break; - - case led_green_on: - if (led_state & LED_STATE_CLAIMED) - hw_led_state |= LED_GREEN; - break; - - case led_green_off: - if (led_state & LED_STATE_CLAIMED) - hw_led_state &= ~LED_GREEN; - break; - - case led_amber_on: - break; - - case led_amber_off: - break; - - case led_red_on: - break; - - case led_red_off: - break; - - default: - break; - } - - if (led_state & LED_STATE_ENABLED) - simpad_set_cs3_bit(LED2_ON); - else - simpad_clear_cs3_bit(LED2_ON); -} - diff --git a/arch/arm/mach-sa1100/leds.c b/arch/arm/mach-sa1100/leds.c index bbfe197..5fe71a0 100644 --- a/arch/arm/mach-sa1100/leds.c +++ b/arch/arm/mach-sa1100/leds.c @@ -42,8 +42,6 @@ sa1100_leds_init(void) leds_event = adsbitsy_leds_event; if (machine_is_pt_system3()) leds_event = system3_leds_event; - if (machine_is_simpad()) - leds_event = simpad_leds_event; /* what about machine registry? including led, apm... -zecke */ leds_event(led_start); return 0; diff --git a/arch/arm/mach-sa1100/leds.h b/arch/arm/mach-sa1100/leds.h index 68cc9f7..776b602 100644 --- a/arch/arm/mach-sa1100/leds.h +++ b/arch/arm/mach-sa1100/leds.h @@ -11,4 +11,3 @@ extern void pfs168_leds_event(led_event_t evt); extern void graphicsmaster_leds_event(led_event_t evt); extern void adsbitsy_leds_event(led_event_t evt); extern void system3_leds_event(led_event_t evt); -extern void simpad_leds_event(led_event_t evt); diff --git a/arch/arm/mach-sa1100/simpad.c b/arch/arm/mach-sa1100/simpad.c index 9f0eefd..34659f3 100644 --- a/arch/arm/mach-sa1100/simpad.c +++ b/arch/arm/mach-sa1100/simpad.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include "generic.h" @@ -295,6 +296,32 @@ static struct platform_device simpad_polled_keys = { }; /* + * GPIO LEDs + */ + +static struct gpio_led simpad_leds[] = { + { + .name = "simpad:power", + .gpio = SIMPAD_CS3_LED2_ON, + .active_low = 0, + .default_trigger = "default-on", + }, +}; + +static struct gpio_led_platform_data simpad_led_data = { + .num_leds = ARRAY_SIZE(simpad_leds), + .leds = simpad_leds, +}; + +static struct platform_device simpad_gpio_leds = { + .name = "leds-gpio", + .id = 0, + .dev = { + .platform_data = &simpad_led_data, + }, +}; + +/* * i2c */ static struct i2c_gpio_platform_data simpad_i2c_data = { @@ -324,6 +351,7 @@ static struct platform_device *devices[] __initdata = { &simpad_keys, &simpad_polled_keys, &simpad_mq200fb, + &simpad_gpio_leds, &simpad_i2c, };