Hello support :)
I use am5749(custom board) ti-processor-sdk-linux-rt-am57xx-evm-06.03.00.106. I would like to create some self made driver for i2c device(kernel module).
I know maybe it is topic not for this place but I can't find how to resolve this problem on another resources. I try to make self made driver because I have a couple of drivers which work with non rt linux and doesn't work with rt. I would like to understand how does it works and what is the problem.
The problem is: probe function is not called.
I add couple of printk for debug then compile it and try to do insmode after that I see : Module some is loaded but I didn't see message from probe.
What I do wrong?
I have example code:
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/of_device.h>
static const struct of_device_id Some_i2c_dt_id[] = {
{ .compatible = "ti,Some_i2c"},
{ },
};
static int Some_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
printk("Module is probed\n");
}
static int Some_i2c_remove(struct i2c_client *client)
{
}
static const struct i2c_device_id Some_i2c_id[] = {
{ "Some_i2c", 0 },
{ },
};
MODULE_DEVICE_TABLE(i2c, Some_i2c_id);
static struct i2c_driver Some_i2c_driver = {
.driver = {
.name = "Some_i2c",
.owner = THIS_MODULE,
.of_match_table = Some_i2c_dt_id,
},
.id_table = Some_i2c_id,
.probe = Some_i2c_probe,
.remove = Some_i2c_remove,
};
static int __init Some_i2c_init( void ) {
printk("Module is started\n");
return i2c_add_driver(&Some_i2c_driver);
}
static void __exit Some_i2c_exit( void ) {
i2c_del_driver(&Some_i2c_driver);
printk("Module is stoped\n");
}
module_init( Some_i2c_init );
module_exit( Some_i2c_exit );
MODULE_AUTHOR("Someone");
MODULE_DESCRIPTION("Some_i2c_Driver");
MODULE_LICENSE("GPL v2");
BR,
Oleg