On Fri, 08 Feb 2008 11:43:25 +0100
Marco Stornelli <[EMAIL PROTECTED]> wrote:

> > Although I'm not sure if it's the "standard" way, we just added a
> > "home-made" node like this:
> > 
> >     [EMAIL PROTECTED] {
> >             device_type = "leds";
> >             compatible = "reset-leds";
> >             reg = <c0018000 00008000>;
> >     };
> > 
> 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()?

We put it in the module init function and registered it as a platform
device:

static int __init led_init(void)
{
        int ret;

        ret = platform_driver_register(&led_driver);

        if (ret < 0)
                return -ENODEV;

        pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0);
        if (IS_ERR(pdev)) {
                ret = PTR_ERR(pdev);
                platform_driver_unregister(&led_driver);
        }

        return ret;
}

And just use the device tree stuff to read out the device address. The
driver itself is quite similar to other led drivers found in the same
directory, so you can probably base your work on those.

This was for kernel 2.6.21, I'm not sure if these things have changed
for newer kernels (although I would guess most of it is the same).

// Simon
_______________________________________________
Linuxppc-embedded mailing list
Linuxppc-embedded@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-embedded

Reply via email to