[PATCH 01/17] leds: create a trigger for CPU activity
Nicolas Pitre
nicolas.pitre at linaro.org
Wed Jul 6 10:11:21 EDT 2011
On Wed, 6 Jul 2011, Russell King - ARM Linux wrote:
> On Wed, Jul 06, 2011 at 09:16:47PM +0800, Eric Miao wrote:
> > On Wed, Jul 6, 2011 at 8:34 PM, Bryan Wu <bryan.wu at canonical.com> wrote:
> > > + 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
More information about the linux-arm-kernel
mailing list