[PATCH 2/7] basic LED support

Marc Reilly marc at cpdesign.com.au
Sun Dec 19 16:31:34 EST 2010


Hi Sascha,

Thanks, this works well for my board. (tri colour led).

Was drivers/led/led-triggers.c missing from the patch set? 
I haven't been able to compile with trigger support...

> +/**
> + * led_register - Register a LED
> + * @param led	the led
> + */
> +int led_register(struct led *led)
> +{
> +	led->num = num_leds++;
> +
> +	list_add_tail(&led->list, &leds);
> +
> +	return 0;
> +}

How about being able to register a led at a specific number? This means that 
boot/init scripts that want to interact with leds don't rely on the order that 
they are registered.

I also like the suggestion of associating a name to LEDs. This may even be a 
better fit for scripting than reserved numbering.


> +
> +/**
> + * led_unregister - Unegister a LED
> + * @param led	the led
> + */
> +void led_unregister(struct led *led)
> +{
> +	list_del(&led->list);
> +}
> diff --git a/include/led.h b/include/led.h
> new file mode 100644
> index 0000000..62d0d08
> --- /dev/null
> +++ b/include/led.h
> @@ -0,0 +1,25 @@
> +#ifndef __LED_H
> +#define __LED_H
> +
> +struct led {
> +	unsigned long triger;

Spelling typo? (Should this be trigger ?)


> +	void (*set)(struct led *, unsigned int value);
> +	int max_value;
> +	int num;
> +	struct list_head list;
> +};
> +
> +struct led *led_by_number(int no);
> +


Cheers
Marc



More information about the barebox mailing list