3

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?

oxod
  • 166
  • 1
  • 7
  • You need to add your MIPI device entry in device tree (for ex: dtsi file) under the I2C channel(i2c*) to which it is linked to and port should be CSI-2. Compile dts to get dtb file and place in tftboot directory if using NFS. Probe gets called only when driver name in driver matches with the compatible name in the device tree entry. Actually in probe function, it reads device related data from device tree and update the driver specific structure accordingly. – Gautham Kantharaju Jan 13 '15 at 03:59
  • Hi! Thank you. Could you also tell me if it is possible to use sync device registering in older V4L2 kernels for SoC camera (in my case adv71820-m). I ask because there are also issues with loading newer kernels (some mismatch between kernel and u-boot I guess) and I know that V4L2 asych devices` registering was added for such compound devices. And I wonder... – oxod Jan 15 '15 at 13:31

0 Answers0