Custom Platform driver don't call probe function. iMX8DXL

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Custom Platform driver don't call probe function. iMX8DXL

Jump to solution
2,528 Views
Juanma1
Contributor II

Hello!

 

I'm working with iMX8DXL, kernel 5.10.72 (BSP).

I wrote a custom platform driver and I can't get the function probe to be called.

I tried to compile within kernel and also as a module and load it using insmod.

In my dts file I added a new node in root node:

/{

    ...

   my_gpio {
       compatible = "juanma,my-gpio-ctrl";
   };

};

Also I tried to add: status = "okay";

In my_gpio.c I tried to register it from init function with "platform_driver_register" and directly using "module_platform_driver". None of them works.

 

static int my_gpio_probe(struct platform_device *pdev)
{
    pr_info( "%s called!\n",__func__);

    return 0;

}

static const struct of_device_id my_gpio_of_ids[] = {
     { .compatible = "juanma,my-gpio-ctrl", 0, },
     {}
};
MODULE_DEVICE_TABLE(of, my_gpio_of_ids);

static struct platform_driver my_gpio_ctrl = {
    .probe = my_gpio_probe,
    .remove = my_gpio_remove,
    .driver = {
        .name = "my-gpio-ctrl",
        .of_match_table = of_match_ptr(my_gpio_of_ids),
        .owner = THIS_MODULE,
    }
};

module_platform_driver(my_gpio_ctrl);

 

 

If I use init function instead of 'module_platform_driver()'

static int __init my_gpio_init(void)
{
    pr_info( "%s: init\n", __func__);
    platform_driver_register(&my_gpio_ctrl);
    pr_info( "%s: driver registered.\n", __func__);
    return 0;
}

static void __exit my_gpio_exit(void)
{
    platform_driver_unregister(&my_gpio_ctrl);
    pr_info( "%s exit\n", __func__);
}

module_init(my_gpio_init);
module_exit(my_gpio_exit);

 

I got the print of my init function, but probe is not called either.

 

What am I missing?

0 Kudos
Reply
1 Solution
2,506 Views
Juanma1
Contributor II

Solved!

A badly closed comment '/* .... */' hid the driver node in the root node.

View solution in original post

0 Kudos
Reply
1 Reply
2,507 Views
Juanma1
Contributor II

Solved!

A badly closed comment '/* .... */' hid the driver node in the root node.

0 Kudos
Reply