# v4l2 drier framework code review ## 术语解释 | 术语 | 解释 | | ---- | ------------------------ | | vfe | video front end driver | | cci | camera control interface | | csi | camera serial interface | ## 启动流程 ```bash $dmesg -T |egrep -i 'vfe|ov5640|v4l|csi|cci' ``` ![v4l2 driver lod sequecnce](http://www.leconiot.com/md_res//jaysnote/v4l2_driver_framework_code_review/images/vfe_reivew.png) 如上启动顺序 * csi、cci、mipi 等外设初始化; * vfe控制 v4l2 启动; vfe在初始化 v4l2-device启动的时候已经同sub-device ov5640 通信,但是此时ov5640 启动还没有加载,这部分需要详细走读下代码; * sub-device camera sensor ov5640 加载; ## 驱动框架 ![v4l2 驱动框架](http://www.leconiot.com/md_res//jaysnote/v4l2_driver_framework_code_review/images/v4l2_driver_framework.png) ### kernel space 1. vfe模块加载,加载csi、mipi、isp、cci模块,同时从sys_config读出sensor的配置; 2. 创建v4l2-device; 3. ov5640 通过cci/i2c 向上注册sub-device(先前行为),此时vfe通过已经注册接口测试sensor是否激活。 4. 创建video 设备节点 ; ### userspace * libv4l2 源码可以通过`sudo apt-get source libv4l2rds0` 下载。 ```bash $ cat /etc/apt/sources.list deb http://mirrors.tuna.tsinghua.edu.cn/debian/ jessie main non-free contrib deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ jessie main non-free contrib ``` > **注意**:如上,确定已经添加source 源。