[PATCH 01/17] leds: create a trigger for CPU activity

Michał Mirosław mirqus at gmail.com
Wed Aug 3 06:23:12 EDT 2011


2011/8/3 Bryan Wu <bryan.wu at canonical.com>:
> Attempting to consolidate the ARM LED code, this removes the
> custom RealView LED trigger code to turn LEDs on and off in
> response to CPU activity and replace it with a standard trigger.
[...]
> +void ledtrig_cpu(enum cpu_led_event ledevt)
> +{
> +       struct ledtrig_cpu_data *trigdata = __get_cpu_var(ledtrig_cpu_triggers);
> +
> +       if (!trigdata)
> +               return;
> +
> +       /* Locate the correct CPU LED */
> +
> +       switch (ledevt) {
> +       case CPU_LED_IDLE_START:
> +       case CPU_LED_START:
> +               /* Will turn the LED on, max brightness */
> +               if (trigdata->led)
> +                       led_set_brightness(trigdata->led,
> +                                          trigdata->led->max_brightness);
> +               break;
> +
> +       case CPU_LED_IDLE_END:
> +       case CPU_LED_STOP:
> +       case CPU_LED_HALTED:
> +               /* Will turn the LED off */
> +               if (trigdata->led)
> +                       led_set_brightness(trigdata->led, LED_OFF);
> +               break;

Might be better to swap CPU_LED_IDLE_START with CPU_LED_IDLE_END here
so that when entering idle state the leds turn off.

Best Regards,
Michał Mirosław



More information about the linux-arm-kernel mailing list