内核里面的ov9650驱动是不开源的 ,看了下有ov9640 于是就拷贝了一份修改了一下,发现跟ov9650完全不一样,ov9650的操作总共涉及到了:Sn9C20x.c Stk_sensor.c Mach_min210.c Vc032x.c M5602_ov9650.c M5602_core.c
这几个文件 其中Sn9C20x.c是USB接口的ov9650 对我就没用。
M5602_ov9650.c 包含了ov9650各种结构体 以及probe 的定义 。
M5602_core.c定义了M5602的probe以及其它的 我一直没搞明白这个M5602是什么东西。
Vc032x.c 文件里定义了一个结构体 貌似选择设备用的 给了一堆数据不知道干嘛用的:
/* probe values */
static const struct sensor_info vc0321_probe_data[]
static const struct sensor_info vc0323_probe_data[]
/* 12 OV9650 */
{-1, 0x80 | 0x30, 0x0a, 0x0000, 0x25, 0x24, 0x05},
在文件 Stk_sensor.c里面 有这么一段诡异的注释: (“我们只认识0v9650” 把我给吓住了)
*Address of the slave. Seems like the binary driver look for the
* sensor in multiple places, attempting a reset sequence.
* We only know about the ov9650
Mach_min210.c文件 应该是最主要的 感觉和M5602_ov9650.c有点类似 但是没看到模块的入口函数 应该是在哪里调用的
按道理流程应该是从fimc---->ov9650 可是找了半天 没找到入口
#ifdef CONFIG_VIDEO_OV9650
#include <media/ov9650_platform.h>
#define CAM_ITU_CH_A 1
#define CAMA_PWR_EN S5PV210_GPJ2(4)
static int ov9650_power_en(int onoff) {
int ret;
ret = gpio_request(CAMA_PWR_EN, "GPJ2_4");
if (ret) {
printk("request GPJ2_4 failed for camera power, %d\n", ret);
}
gpio_direction_output(CAMA_PWR_EN, onoff);
gpio_free(CAMA_PWR_EN);
printk("ov9650: power %s\n", onoff ? "ON" : "Off");
return 0;
}
static struct ov9650_platform_data ov9650_plat = {
.default_width = 1280,
.default_height = 1024,
.pixelformat = V4L2_PIX_FMT_YUYV,
.freq = 40000000,
.is_mipi = 0,
};
static struct i2c_board_info ov9650_i2c_info = {
I2C_BOARD_INFO("ov9650", 0x30),
.platform_data = &ov9650_plat,
};
static struct s3c_platform_camera ov9650 = {
#ifdef CAM_ITU_CH_A
.id = CAMERA_PAR_A,
#else
.id = CAMERA_PAR_B,
#endif
.type = CAM_TYPE_ITU,
.fmt = ITU_601_YCBCR422_8BIT,
.order422 = CAM_ORDER422_8BIT_YCBYCR,
.i2c_busnum = 0,
.info = &ov9650_i2c_info,
.pixelformat = V4L2_PIX_FMT_YUYV,
.srclk_name = "mout_mpll",
/* .srclk_name = "xusbxti", */
.clk_name = "sclk_cam1",
.clk_rate = 40000000,
.line_length = 1920,
.width = 1280,
.height = 1024,
.window = {
.left = 0,
.top = 0,
.width = 1280,
.height = 1024,
},
/* Polarity */
.inv_pclk = 1,
.inv_vsync = 1,
.inv_href = 0,
.inv_hsync = 0,
.initialized = 0,
.cam_power = ov9650_power_en,
};
#endif
就找到了一个连接关系:
/* Interface setting */
static struct s3c_platform_fimc fimc_plat_lsi = {
.srclk_name = "mout_mpll",
.clk_name = "sclk_fimc",
.lclk_name = "fimc",
.clk_rate = 166750000,
#if defined(CONFIG_VIDEO_S5K4EA)
.default_cam = CAMERA_CSI_C,
#else
#ifdef CAM_ITU_CH_A
.default_cam = CAMERA_PAR_A,
#else
.default_cam = CAMERA_PAR_B,
#endif
#endif
.camera = {
#ifdef CONFIG_VIDEO_S5K4ECGX
&s5k4ecgx,
#endif
#ifdef CONFIG_VIDEO_S5KA3DFX
&s5ka3dfx,
#endif
#ifdef CONFIG_VIDEO_S5K4BA
&s5k4ba,
#endif
#ifdef CONFIG_VIDEO_S5K4EA
&s5k4ea,
#endif
#ifdef CONFIG_VIDEO_TVP5150
&tvp5150,
#endif
#ifdef CONFIG_VIDEO_OV9650
&ov9650,
#endif
},
.hw_ver = 0x43,
};
在这里把ov9650的结构体与fimc联系起来了 。。。。。唉!但是看了linux3.0.8里面给的ov9640.c 之类的文件 感觉完全不一样 只可惜友善只给了ov9650.ko文件 没有源码
接下来就只好研究了ov9640.c文件 感觉什么都配置好了 在make menuconfig里面发现居然和ov9650不是在一个类别下的。不管了 添加到内核 编译通过 下载运行
调试信息出来了:
fimc_streamoff_capture: No capture info
才知道我的ov9640压根就没有和fimc建立起联系
于是乎,直接将0v9640拷贝成ov9650 修修改改 再改makefile 痛苦啊 让它直接生成ov9650.o 和ov9650.ko文件 加到内核 编译 运行 结果一打开相机程序就reboot 晕死 难道友善编写ov9650的方法和ov9640的不一样吗? 我泪奔了 。。。