From patchwork Wed Jul 6 12:34:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan Wu X-Patchwork-Id: 949562 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p66CbGCM026630 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 6 Jul 2011 12:37:37 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QeRLj-00059i-Jq; Wed, 06 Jul 2011 12:37:04 +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 1QeRLj-0002W8-6m; Wed, 06 Jul 2011 12:37:03 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QeRLg-0002VT-4P for linux-arm-kernel@canuck.infradead.org; Wed, 06 Jul 2011 12:37:00 +0000 Received: from adelie.canonical.com ([91.189.90.139]) by casper.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QeRLd-00011V-43 for linux-arm-kernel@lists.infradead.org; Wed, 06 Jul 2011 12:36:58 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by adelie.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1QeRLb-00040p-Dl; Wed, 06 Jul 2011 12:36:55 +0000 Received: from [116.227.244.46] (helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1QeRLM-0007Pl-D0; Wed, 06 Jul 2011 12:36:55 +0000 From: Bryan Wu To: linus.walleij@linaro.org, linux-arm-kernel@lists.infradead.org, rpurdie@rpsys.net, linux@arm.linux.org.uk, nicolas.pitre@linaro.org, arnd@arndb.de, eric.y.miao@gmail.com, tony@atomide.com Subject: [PATCH 03/17] mach-realview: retire custom LED code Date: Wed, 6 Jul 2011 20:34:33 +0800 Message-Id: <1309955687-19365-4-git-send-email-bryan.wu@canonical.com> X-Mailer: git-send-email 1.7.5 In-Reply-To: <1309955687-19365-1-git-send-email-bryan.wu@canonical.com> References: <1309955687-19365-1-git-send-email-bryan.wu@canonical.com> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110706_133657_268667_120DFEF0 X-CRM114-Status: GOOD ( 18.66 ) X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2-r929478 on casper.infradead.org summary: Content analysis details: (-4.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [91.189.90.139 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 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 (demeter2.kernel.org [140.211.167.43]); Wed, 06 Jul 2011 12:37:37 +0000 (UTC) From: Linus Walleij This replaces the custom LED trigger code in mach-realview with some overarching platform code for the plat-versatile family that will lock down LEDs 2 thru 5 for CPU activity indication. The day we have 8 core ARM systems the plat-versatile code will have to become more elaborate. Tested on RealView PB11MPCore by invoking four different CPU hogs (yes > /dev/null&) and see the LEDs go on one at a time. They all go off as the hogs are killed. Tested on the PB1176 as well - just one activity led (led 2) goes on and off with CPU activity. (bryan.wu@canonical.com: use ledtrig-cpu instead of ledtrig-arm-cpu) Cc: Richard Purdie Signed-off-by: Linus Walleij Signed-off-by: Bryan Wu Acked-by: Pawel Moll --- arch/arm/mach-realview/core.c | 39 ------------------------------ arch/arm/mach-realview/core.h | 2 - arch/arm/mach-realview/realview_eb.c | 4 --- arch/arm/mach-realview/realview_pb1176.c | 4 --- arch/arm/mach-realview/realview_pb11mp.c | 4 --- arch/arm/mach-realview/realview_pba8.c | 4 --- arch/arm/mach-realview/realview_pbx.c | 4 --- arch/arm/plat-versatile/Kconfig | 6 ++++- arch/arm/plat-versatile/leds.c | 13 +++++++--- 9 files changed, 14 insertions(+), 66 deletions(-) diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c index 5c23450..3a12b6b 100644 --- a/arch/arm/mach-realview/core.c +++ b/arch/arm/mach-realview/core.c @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include @@ -437,44 +436,6 @@ struct clcd_board clcd_plat_data = { .remove = versatile_clcd_remove_dma, }; -#ifdef CONFIG_LEDS -#define VA_LEDS_BASE (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LED_OFFSET) - -void realview_leds_event(led_event_t ledevt) -{ - unsigned long flags; - u32 val; - u32 led = 1 << smp_processor_id(); - - local_irq_save(flags); - val = readl(VA_LEDS_BASE); - - switch (ledevt) { - case led_idle_start: - val = val & ~led; - break; - - case led_idle_end: - val = val | led; - break; - - case led_timer: - val = val ^ REALVIEW_SYS_LED7; - break; - - case led_halted: - val = 0; - break; - - default: - break; - } - - writel(val, VA_LEDS_BASE); - local_irq_restore(flags); -} -#endif /* CONFIG_LEDS */ - /* * Where is the timer (VA)? */ diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h index 5c83d1e..47ee3bc 100644 --- a/arch/arm/mach-realview/core.h +++ b/arch/arm/mach-realview/core.h @@ -26,7 +26,6 @@ #include #include -#include #define AMBA_DEVICE(name,busid,base,plat) \ static struct amba_device name##_device = { \ @@ -57,7 +56,6 @@ extern void __iomem *timer1_va_base; extern void __iomem *timer2_va_base; extern void __iomem *timer3_va_base; -extern void realview_leds_event(led_event_t ledevt); extern void realview_timer_init(unsigned int timer_irq); extern int realview_flash_register(struct resource *res, u32 num); extern int realview_eth_register(const char *name, struct resource *res); diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c index 10e75fa..2fb438a 100644 --- a/arch/arm/mach-realview/realview_eb.c +++ b/arch/arm/mach-realview/realview_eb.c @@ -30,7 +30,6 @@ #include #include -#include #include #include #include @@ -455,9 +454,6 @@ static void __init realview_eb_init(void) amba_device_register(d, &iomem_resource); } -#ifdef CONFIG_LEDS - leds_event = realview_leds_event; -#endif realview_reset = realview_eb_reset; } diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c index eab6070..2e0350a 100644 --- a/arch/arm/mach-realview/realview_pb1176.c +++ b/arch/arm/mach-realview/realview_pb1176.c @@ -30,7 +30,6 @@ #include #include -#include #include #include #include @@ -350,9 +349,6 @@ static void __init realview_pb1176_init(void) amba_device_register(d, &iomem_resource); } -#ifdef CONFIG_LEDS - leds_event = realview_leds_event; -#endif realview_reset = realview_pb1176_reset; } diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c index b2985fc..9dd929a 100644 --- a/arch/arm/mach-realview/realview_pb11mp.c +++ b/arch/arm/mach-realview/realview_pb11mp.c @@ -30,7 +30,6 @@ #include #include -#include #include #include #include @@ -352,9 +351,6 @@ static void __init realview_pb11mp_init(void) amba_device_register(d, &iomem_resource); } -#ifdef CONFIG_LEDS - leds_event = realview_leds_event; -#endif realview_reset = realview_pb11mp_reset; } diff --git a/arch/arm/mach-realview/realview_pba8.c b/arch/arm/mach-realview/realview_pba8.c index fb68665..d1bcd5f 100644 --- a/arch/arm/mach-realview/realview_pba8.c +++ b/arch/arm/mach-realview/realview_pba8.c @@ -29,7 +29,6 @@ #include #include -#include #include #include #include @@ -302,9 +301,6 @@ static void __init realview_pba8_init(void) amba_device_register(d, &iomem_resource); } -#ifdef CONFIG_LEDS - leds_event = realview_leds_event; -#endif realview_reset = realview_pba8_reset; } diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c index 92ace2c..797a509 100644 --- a/arch/arm/mach-realview/realview_pbx.c +++ b/arch/arm/mach-realview/realview_pbx.c @@ -28,7 +28,6 @@ #include #include -#include #include #include #include @@ -385,9 +384,6 @@ static void __init realview_pbx_init(void) amba_device_register(d, &iomem_resource); } -#ifdef CONFIG_LEDS - leds_event = realview_leds_event; -#endif realview_reset = realview_pbx_reset; } diff --git a/arch/arm/plat-versatile/Kconfig b/arch/arm/plat-versatile/Kconfig index 52353be..c600420 100644 --- a/arch/arm/plat-versatile/Kconfig +++ b/arch/arm/plat-versatile/Kconfig @@ -7,8 +7,12 @@ config PLAT_VERSATILE_FPGA_IRQ bool config PLAT_VERSATILE_LEDS - def_bool y if LEDS_CLASS + def_bool y depends on ARCH_REALVIEW || ARCH_VERSATILE + select NEW_LEDS + select LEDS_CLASS + select LEDS_TRIGGERS + select LEDS_TRIGGER_CPU config PLAT_VERSATILE_SCHED_CLOCK def_bool y if !ARCH_INTEGRATOR_AP diff --git a/arch/arm/plat-versatile/leds.c b/arch/arm/plat-versatile/leds.c index 3169fa5..a617a8f 100644 --- a/arch/arm/plat-versatile/leds.c +++ b/arch/arm/plat-versatile/leds.c @@ -37,10 +37,10 @@ static const struct { } versatile_leds[] = { { "versatile:0", "heartbeat", }, { "versatile:1", "mmc0", }, - { "versatile:2", }, - { "versatile:3", }, - { "versatile:4", }, - { "versatile:5", }, + { "versatile:2", "cpu" }, + { "versatile:3", "cpu" }, + { "versatile:4", "cpu" }, + { "versatile:5", "cpu" }, { "versatile:6", }, { "versatile:7", }, }; @@ -85,6 +85,11 @@ static int __init versatile_leds_init(void) led->cdev.brightness_set = versatile_led_set; led->cdev.brightness_get = versatile_led_get; led->cdev.default_trigger = versatile_leds[i].trigger; + /* Some trigger data for CPU LEDs */ + if (i >= 2 && i <= 5) { + /* This is the CPU number actually */ + led->cdev.trigger_data = (void *) i - 2; + } led->mask = BIT(i); if (led_classdev_register(NULL, &led->cdev) < 0) {