linking device tree and simple driver

Hello all.

I have simple kernel driver that measures the pulse width of the pwm signal. Driver works, but I’d like to link it with the device tree, so that it can be configured (gpio’s etc).

static int __init rcpwm_init(void)
{

}
static void __exit rcpwm_cleanup(void)
{

}
module_init(rcpwm_init);
module_exit(rcpwm_cleanup);

I’d like to link it with the device tree entry

rcpwm:rcpwm_0@0 {
compatible = “my,driver”;
};

Is this doable with the driver that’s initialized this way, or do I have to use probe?

Thanks,

Miro

Hello all.

I have simple kernel driver that measures the pulse width of the pwm signal. Driver works, but I’d like to link it with the device tree, so that it can be configured (gpio’s etc).

static int __init rcpwm_init(void)
{

}
static void __exit rcpwm_cleanup(void)
{

}
module_init(rcpwm_init);
module_exit(rcpwm_cleanup);

I’d like to link it with the device tree entry

rcpwm:rcpwm_0@0 {
compatible = “my,driver”;
};

Is this doable with the driver that’s initialized this way, or do I have to use probe?

All you need to know about DT is here:

https://github.com/jadonk/validation-scripts/tree/master/test-capemgr

Look at reference number 5 which shows you exactly how to do what you want.

Regards,
John

Thanks, that told me what I suspected. I changed the driver to probe and all is well.

Miro