linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Grant Likely" <grant.likely@secretlab.ca>
To: "Simon Kagstrom" <simon.kagstrom@ericsson.com>
Cc: Marco Stornelli <marco.stornelli@coritel.it>,
	LinuxPPC-Embedded <linuxppc-embedded@ozlabs.org>
Subject: Re: Leds
Date: Fri, 8 Feb 2008 12:43:54 -0700	[thread overview]
Message-ID: <fa686aa40802081143s1dd8fd46u97e3e11da5049380@mail.gmail.com> (raw)
In-Reply-To: <20080208112002.42a15c0d@seasc0532.dyn.rnd.as.sw.ericsson.se>

On Feb 8, 2008 3:20 AM, Simon Kagstrom <simon.kagstrom@ericsson.com> wrote:
> Hi Marco,
>
> On Fri, 08 Feb 2008 11:02:16 +0100
> Marco Stornelli <marco.stornelli@coritel.it> wrote:
>
> > how can specify a led device in a dts file? These leds are connected
> > with gpio to the microprocessor. I can't find anything like a led node
> > in the dts files of the other boards. Have you got any suggestions?
>
> Although I'm not sure if it's the "standard" way, we just added a
> "home-made" node like this:
>
>         resetLED@c0018000 {
>                 device_type = "leds";
>                 compatible = "reset-leds";
>                 reg = <c0018000 00008000>;
>         };

I've been thinking about this a bit over the last couple of months,
and I think that there is a better way.  Since many LEDs are simply
hooked up to GPIO blocks and we're moving towards a common GPIO api
(and device tree binding), I think it would be better to use two
nodes; a node for the gpio block and a node for all the LEDs in the
system.  For example (the GPIO dt bindings may differ from my example
here, but you get the gist):

GPIO0: gpio-controller@1418 {
        #gpio-cells = <2>;
        compatible = "fsl,qe-pario-bank";
        reg = <0x1418 0x18>;
        gpio-controller;
};
GPIO1: gpio-controller@1460 {
        #gpio-cells = <2>;
        compatible = "fsl,qe-pario-bank";
        reg = <0x1460 0x18>;
        gpio-controller;
};

leds@0 {
        compatible = "gpio-leds";
        led-labels = "led1", "led2", "led3", "led4";
        gpios = <&GPIO0  2 0 /* LED1 */
                 &GPIO0  3 0 /* LED2 */
                 &GPIO1  8 0 /* LED3 */
                 &GPIO1  9 0 /* LED4 */
                 >;
        /* More properties are probably needed here to correctly setup
the output levels */
};

Doing it this way means the GPIO block will be usable for more than
just LEDs.  Plus once the 'gpio-leds' driver is written leds can be
hooked up almost trivially on new boards.

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

      parent reply	other threads:[~2008-02-08 19:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-08 10:02 Leds Marco Stornelli
2008-02-08 10:20 ` Leds Simon Kagstrom
2008-02-08 10:43   ` Leds Marco Stornelli
2008-02-08 11:26     ` Leds Simon Kagstrom
2008-02-08 19:43   ` Grant Likely [this message]

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=fa686aa40802081143s1dd8fd46u97e3e11da5049380@mail.gmail.com \
    --to=grant.likely@secretlab.ca \
    --cc=linuxppc-embedded@ozlabs.org \
    --cc=marco.stornelli@coritel.it \
    --cc=simon.kagstrom@ericsson.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;
as well as URLs for NNTP newsgroup(s).