I am trying to connect Analog Devices` ADV7182 video encoder chip which has I2C communication to config the chip and control MIPI video data over CSI-2.
The issue is that the probe function of the driver is not called unless I create a new I2C device manually in __init function. Like this:
static struct i2c_board_info i2c_board_info_adv[] = {
{
I2C_BOARD_INFO("adv7281-m", 0x21)
}};
static int __init adv7180_initialize (void) {
struct i2c_client *client;
struct i2c_adapter *adapter;
int i2c_bus_number = 3;
int ret = i2c_register_board_info(i2c_bus_number, i2c_board_info_adv, ARRAY_SIZE(i2c_board_info_adv));
if (ret) {
printk("ADV7180 i2c_register_board_info failed. Result %d\n", ret);
return -EINVAL;
}
ret = i2c_add_driver(&adv7180_driver);
if (ret) {
printk("ADV7180 i2c_add_driver failed. Result %d\n", ret);
return -EINVAL;
}
adapter = i2c_get_adapter(i2c_bus_number);
if (!adapter) {
printk("ADV7180 i2c_get_adapter failed. Result %d\n", ret);
return -EINVAL;
}
client = i2c_new_device(adapter, &i2c_board_info_adv[0]);
if (!client) {
printk("ADV7180 i2c_new_device failed. Result %d\n", ret);
return -EINVAL;
}
return 0; }
In the original driver for ADV7xxx devices there is only call of i2c_add_driver in init function. https://github.com/analogdevicesinc/linux/tree/adv7280 Unfortunately, I cannot use that driver directly because of different kernels versions (since it uses backward incompatible versions of video for linux) and kernel upgrade does not seem to work either for the device I use (NanoPC).
I am quite new to linux drivers so I think I do not understand something about the platform. Any help?