[PATCH 01/17] leds: create a trigger for CPU activity
From: Nicolas Pitre <hidden>
Date: 2011-07-06 14:11:21
On Wed, 6 Jul 2011, Russell King - ARM Linux wrote:
On Wed, Jul 06, 2011 at 09:16:47PM +0800, Eric Miao wrote:quoted
On Wed, Jul 6, 2011 at 8:34 PM, Bryan Wu [off-list ref] wrote:quoted
+ ? ? ? switch (ledevt) { + ? ? ? case CPU_LED_START: + ? ? ? case CPU_LED_IDLE_START: + ? ? ? ? ? ? ? /* Will turn the LED on, max brightness */ + ? ? ? ? ? ? ? if (trigdata->led) + ? ? ? ? ? ? ? ? ? ? ? led_set_brightness(trigdata->led, + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?trigdata->led->max_brightness); + ? ? ? ? ? ? ? break; + + ? ? ? case CPU_LED_STOP: + ? ? ? case CPU_LED_IDLE_END: + ? ? ? case CPU_LED_HALTED: + ? ? ? ? ? ? ? /* Will turn the LED off */ + ? ? ? ? ? ? ? if (trigdata->led) + ? ? ? ? ? ? ? ? ? ? ? led_set_brightness(trigdata->led, LED_OFF); + ? ? ? ? ? ? ? break; + + ? ? ? default: + ? ? ? ? ? ? ? /* Will leave the LED as it is */ + ? ? ? ? ? ? ? break; + ? ? ? } +}I'm a bit worrying about the LED brightness hardcoded here, what if a platform requires different behavior, e.g. LED_OFF when IDLE_START.Indeed - there are platforms (Netwinder, Assabet etc) which use LED=ON to mean that the system is not idle - and also turn the LED on when halted.
What about simply setting active_low to 1 in the struct gpio_led instance for those particular LEDs (or invert it if it is already set)? Nicolas