Linux system initialization camera I2C driver

  
When reading the Linux ov2655 driver, I did not find the I2C driver initialization function i2c_add_driver, but defined the static struct v4l2_i2c_driver_data v4l2_i2c_data ={ .name = S5K4BA_DRIVER_NAME, .probe = ov2655_probe, .remove = __devexit_p( Ov2655_remove), .id_table = ov2655_id,};

In fact, the I2C initialization function in v4l2-i2c-drv.h will include the file #include <media/v4l2-i2c-drv.h> Br>

The file code is very simple, the I2C driver is initialized as follows:
static int __init v4l2_i2c_drv_init(void){ //The v4l2_i2c_data is the structure defined in the ov2655 driver mentioned earlier. v4l2_i2c_driver.driver.name = v4l2_i2c_data.name; v4l2_i2c_driver.command = v4l2_i2c_data.command; v4l2_i2c_driver.probe = v4l2_i2c_data.probe; v4l2_i2c_driver.remove = v4l2_i2c_data.remove; v4l2_i2c_driver.suspend = v4l2_i2c_data.suspend; v4l2_i2c_driver.resume = v4l2_i2c_data.resume; v4l2_i2c_driver.id_table = v4l2_i2c_data.id_table; return i2c_add_driver (& v4l2_i2c_driver);} static void __exit v4l2_i2c_drv_cleanup (void) {i2c_del_driver (& v4l2_i2c_driver);} module_init (v4l2_i2c_drv_init); module_exit (v4l2_i2c_drv_cleanup);

Copyright © Windows knowledge All Rights Reserved