Leds
Grant Likely
grant.likely at secretlab.ca
Sat Feb 9 06:43:54 EST 2008
On Feb 8, 2008 3:20 AM, Simon Kagstrom <simon.kagstrom at ericsson.com> wrote:
> Hi Marco,
>
> On Fri, 08 Feb 2008 11:02:16 +0100
> Marco Stornelli <marco.stornelli at 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 at 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 at 1418 {
#gpio-cells = <2>;
compatible = "fsl,qe-pario-bank";
reg = <0x1418 0x18>;
gpio-controller;
};
GPIO1: gpio-controller at 1460 {
#gpio-cells = <2>;
compatible = "fsl,qe-pario-bank";
reg = <0x1460 0x18>;
gpio-controller;
};
leds at 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.
More information about the Linuxppc-embedded
mailing list