Leds

Marco Stornelli marco.stornelli at coritel.it
Fri Feb 8 21:43:25 EST 2008


Simon Kagstrom ha scritto:
> 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>;
> 	};
> 
> and then just get the info in the probe function for the led driver
> we placed in drivers/leds/:
> 
> 	/* Get device info from OF tree */
> 	np = of_find_compatible_node(NULL, "leds", "reset-leds");
> 	if (!np) {
> 		dev_err(&pdev->dev, "Could not find device tree node for reset-leds\n");
> 		goto error_classdev;
> 	}
> 
> 	if (of_address_to_resource(np, 0, &res)) {
> 		dev_err(&pdev->dev, "Could not convert reset-leds device tree address\n");
> 		of_node_put(np);
> 		goto error_classdev;
> 	}
> 	...
> 
> At least this was all the information we needed from the device tree.
> 
> // Simon
> 

Thanks. In this case where have you added the device registration? In
the probe function? Have you registered the driver with
of_register_platform_driver()?


More information about the Linuxppc-embedded mailing list