mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 3/7] LED: Add gpio LED support
Date: Sat, 18 Dec 2010 18:18:56 +0100	[thread overview]
Message-ID: <20101218171856.GK6017@pengutronix.de> (raw)
In-Reply-To: <20101218164148.GB15695@game.jcrosoft.org>

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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2010-12-18 17:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-18 15:15 LED framework Sascha Hauer
2010-12-18 15:15 ` [PATCH 1/7] Add generic poll infrastructure Sascha Hauer
2010-12-18 15:28   ` Sascha Hauer
2010-12-18 15:15 ` [PATCH 2/7] basic LED support Sascha Hauer
2010-12-18 16:38   ` Jean-Christophe PLAGNIOL-VILLARD
2010-12-18 17:18     ` Sascha Hauer
2010-12-18 16:48   ` Jean-Christophe PLAGNIOL-VILLARD
2010-12-18 19:06   ` Belisko Marek
2010-12-19 21:31   ` Marc Reilly
2010-12-20  8:27     ` Sascha Hauer
2010-12-18 15:15 ` [PATCH 3/7] LED: Add gpio " Sascha Hauer
2010-12-18 16:41   ` Jean-Christophe PLAGNIOL-VILLARD
2010-12-18 17:18     ` Sascha Hauer [this message]
2010-12-18 15:15 ` [PATCH 4/7] LED: Add LED trigger support Sascha Hauer
2010-12-18 16:51   ` Belisko Marek
2010-12-18 17:21     ` Sascha Hauer
2010-12-18 15:15 ` [PATCH 5/7] LED: Add led command Sascha Hauer
2010-12-18 16:45   ` Jean-Christophe PLAGNIOL-VILLARD
2010-12-18 17:24     ` Sascha Hauer
2010-12-18 15:15 ` [PATCH 6/7] LED: Add trigger command Sascha Hauer
2010-12-18 15:15 ` [PATCH 7/7] pcm038: led testing. Not to be committed Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101218171856.GK6017@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=plagnioj@jcrosoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox