Camera Driver analysis in the platform of MTK
Preliminary Information
六、 MTK 平台 Camera 驱动架构:
上图的架构相信大家都有了一定的了解,android 将系统大致分为应用层、库文件和硬
件抽象层、Linux 内核三层。在底层的内核空间,Camera 的 driver 将其驱动起来以后,将硬 件驱动的接口交给硬件抽象层,android 上层的 Camera 应用程序在 android 实时系统中的虚 拟机中,加载 android 留给 Camera 公用的一些库文件,调用硬件抽象层的接口来控制 Camera
硬件来实现功能。当然,如果是 Raw 模式的 Camera,还需要在硬件抽象层调用一些参数来
控制 Camera 的效果。
Ghong Confidential
Revision 0.1-Feb.14 2012
?2012 Ghong inc.
- 8 -
Camera Driver analysis in the platform of MTK
Preliminary Information
七、 MTK 平台 Camera 相关代码文件(以下代码均为 MTK6575 平台):
1、 CameraSensor 驱动相关文件
2、 Sensor ID 和一些枚举类型的定义
3、 Sensor 供电
4、 Kernel Space 的 SensorList,imgsensor 模块注册
Ghong Confidential
Revision 0.1-Feb.14 2012
?2012 Ghong inc.
- 9 -
Camera Driver analysis in the platform of MTK
5、 User Space 的 SensorList,向用户空间提供支持的 SensorList
Preliminary Information
Ghong Confidential
6、 Sensor 效果调整的接口
Revision 0.1-Feb.14 2012
?2012 Ghong inc.
- 10 -
Camera Driver analysis in the platform of MTK
Preliminary Information
八、 Camera 模块驱动、设备与总线结构:
在(\\custom\\common\\kernel\\imgsensor\\src\\Kd_sensorlist.c)CAMERA_HW_i2C_init 这个 函数里通过 Platform_driver_register(&g_stCAMERA_HW_Driver)把 Camera 模块驱动注册 到 Platform 总线上。而 g_stCAMERA_HW_Driver 是对结构体 Platform_driver 这个结构体的
一般在 Linux 设备驱动模型中,我们只需要关心总线、设备、驱动这三个实体。总线会 充当红娘对加载于其上的设备与驱动进行配对,对于 Camera 模块也不例外,下面从总线、
设备、驱动的角度来分析 Camera 模块驱动的注册、匹配与加载过程。
a) 驱动的注册:
填充。
(Kernel\\include\\linux\\Platform_device.h)
Platform_driver 这个结构体包含 Probe()、Remove()等函数来完成驱动的填充。
b) 设备的注册:
对 platform_device 的定义通常在 BSP 的板级文件:
(kernel\\arch\\sh\\boards\\mach-ap325rxa\\Setup.c)中实现,在板级文件中,将 platform_device 归纳为一个数组,最终通过 platform_add_device()函数统一注册:
Ghong Confidential
Revision 0.1-Feb.14 2012
?2012 Ghong inc.
- 11 -
Camera Driver analysis in the platform of MTK
Preliminary Information
c) 总线的匹配:
既 然 是 驱 动 Platform_device 那 对 应 的 设 备 必 然 是 挂 载 Platform 总 线 上 的
Platform_device,Platform 总线是 Linux 系统提供的一种机制,不同于 I2C、I2S 等总线,它 是一种虚拟的总线。
Linux 系统为 Platform 总线定义了一个 bus_type 的实例 Platform_bus_type:
(Kernel\\drivers\\base\\platform.c)
Platform 总线通过 platform_match 这个成员函数来确定 platform_device 与 platform_driver 如 何进行匹配:
Ghong Confidential
Revision 0.1-Feb.14 2012
?2012 Ghong inc.
- 12 -
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库MTK平台camera(摄像头)调试教程 - 图文(2)在线全文阅读。
相关推荐: