soccamera 1

分host,sensor层次的驱动,soc-camera为枢纽,同时也是和用户交互的接口;soc_camera_probe这个函数什么调用的呢?

先利用

ret = driver_register(&ic_drv);//这里现在soc_camera_bus_type总线下注册一个驱动device_driver。

而在soc_camera_host_register--->scan_add_host-->device_register(&icd->dev);//这里开始在soc_camera_bus_type 总线上注册设备,

                                                                                                                           // 这个时候soc_camera_probe 函数会调用

static struct bus_type soc_camera_bus_type = {//这个总线没有match函数,bus_for_each_drv(dev->bus, NULL, dev, __device_attach);     

                                                                            //      __device_attach这个函数一定会执行
 .name  = "soc-camera",
 .probe  = soc_camera_probe,
 .remove  = soc_camera_remove,
 .suspend = soc_camera_suspend,
 .resume  = soc_camera_resume,
};

static struct device_driver ic_drv = {//这个驱动没有probe函数,所以会执行总线的probe函数

                                                        //if (dev->bus->probe) { ret = dev->bus->probe (dev);  ..........
 .name = "camera",
 .bus = &soc_camera_bus_type,
 .owner = THIS_MODULE,
};

只有soc_camera_probe函数被调用了,才能创建senesor侧驱动的i2c_client的I2c设备

原文地址:https://www.cnblogs.com/wangxianzhen/p/3016493.html