[PATCH 3/7] LED: Add gpio LED support
Sascha Hauer
s.hauer at pengutronix.de
Sat Dec 18 12:18:56 EST 2010
On Sat, Dec 18, 2010 at 05:41:48PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > +
> > +/**
> > + * led_gpio_unregister - remove a gpio controlled LED from the framework
> > + * @param led The gpio LED
> > + */
> > +void led_gpio_unregister(struct gpio_led *led)
> > +{
> > + led_unregister(&led->led);
> > +}
> > +
> how abaout make the rgb support optional?
Good point, most boards do not have this kind of stuff.
> > +static void led_gpio_rgb_set(struct led *led, unsigned int value)
> > +{
> > + struct gpio_rgb_led *rgb = container_of(led, struct gpio_rgb_led, led);
> > + int al = rgb->active_low;
> > +
> > + gpio_direction_output(rgb->gpio_r, !!(value & 4) ^ al);
> > + gpio_direction_output(rgb->gpio_g, !!(value & 2) ^ al);
> > + gpio_direction_output(rgb->gpio_b, !!(value & 1) ^ al);
> > +}
> > +
> > +/**
> > + * led_gpio_rgb_register - register three gpios as a rgb LED
> > + * @param led The gpio rg LED
> > + *
> > + * This function registers three gpios as a rgb LED. led->gpio[rgb]
> > + * should be initialized to the gpios to control.
> > + */
> > +int led_gpio_rgb_register(struct gpio_rgb_led *led)
> no safe check?
no.
> > +{
> > + led->led.set = led_gpio_rgb_set;
> > + led->led.max_value = 7;
> > +
> > + return led_register(&led->led);
> > +}
> > +
> > +/**
> > + * led_gpio_rgb_unregister - remove a gpio controlled rgb LED from the framework
> > + * @param led The gpio LED
> > + */
> > +void led_gpio_rgb_unregister(struct gpio_led *led)
> > +{
> > + led_unregister(&led->led);
> > +}
> > +
> Best Regards,
> J.
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list