小弟最近想在tiny210上移植ov7740的摄像头(韦东山老师的那款), 所以参照s5k4aba.c 做移植(ov9650不提供源代码)
主要改了下面两个文件: mach-mini210s 和 s5k4ab.c
mach-mini210s 中参考了CONFIG_VIDEO_OV9650的代码,我直接在CONFIG_VIDEO_S5K4BA基础上做的修改: 修改如下
static struct s5k4ba_platform_data s5k4ba_plat = {
.default_width = 640,
.default_height = 480,
.pixelformat = V4L2_PIX_FMT_YUYV,
.freq = 24000000,
.is_mipi = 0,
};
static struct i2c_board_info s5k4ba_i2c_info = {
I2C_BOARD_INFO("S5K4BA", 0x21),
.platform_data = &s5k4ba_plat,
};
static struct s3c_platform_camera s5k4ba = {
#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_CBYCRY,
.i2c_busnum = 0,
.info = &s5k4ba_i2c_info,
.pixelformat = V4L2_PIX_FMT_YUYV,
.srclk_name = "mout_mpll",
/* .srclk_name = "xusbxti", */
.clk_name = "sclk_cam0",
.clk_rate = 24000000,
.line_length = 1920,
.width = 640,
.height = 480,
.window = {
.left = 0,
.top = 0,
.width = 640,
.height = 480,
},
/* Polarity */
.inv_pclk = 0,
.inv_vsync = 0,
.inv_href = 0,
.inv_hsync = 0,
.initialized = 0,
.cam_power = s5k5ba_power_en,
};
另外我在s5k4ab.c 的probe中加了如下语句(为了复位摄像头sensor和读取id)
/*2 reset camera sensor*/
ret = gpio_request(CAMA_RESET_EN, "GPJ3_1");
if (ret) {
printk("request GPJ2_4 failed for camera power, %d\n", ret);
}
gpio_direction_output(CAMA_RESET_EN, 1);
mdelay(30);
gpio_direction_output(CAMA_RESET_EN, 0);
mdelay(30);
gpio_direction_output(CAMA_RESET_EN, 1);
mdelay(30);
printk("s5k4ba: reset \n");
gpio_free(CAMA_RESET_EN);
/* 3.read id*/
mid = i2c_smbus_read_byte_data(client, 0x0a)<<8;
mid |= i2c_smbus_read_byte_data(client, 0x0b);
printk("manufacture ID = 0x%4x\n", mid);
现在问题是读取id有误具有log如下,求各位大神能够分析下,非常感谢!
<6>[ 150.585870] s3c-fimc-0 : (0) Clock sclk_fimc(0) enabled.
<6>[ 150.586947] s3c-fimc-0 : fimc_open: fd.lcd_hres=800 fd.lcd_vres=480
<6>[ 150.587000] s3c-fimc-0 : s3c-fimc0 opened.
<6>[ 150.587184] s3c-fimc-0 : fimc_querycap: called
<7>[ 150.587248] s3c-fimc-0 : fimc_enum_input: index 0
<7>[ 150.587261] s3c-fimc-0 : fimc_s_input: index 0
<4>[ 150.587276] neo: i2c_busnum = 0
<4>[ 150.587303] neo: addr = 33
<4>[ 150.589436] neo: type = S5K4BA
<6>[ 150.617282] S5K4BA 0-0021: s5k4ba has been probed
<4>[ 150.713913] s5k4ba: reset
<4>[ 168.710184] manufacture ID = 0xc0c0 // 这里id读错,求建议
<7>[ 168.710363] s3c-fimc-0 : fimc_s_fmt_vid_capture
<7>[ 168.710376] s3c-fimc-0 : 16bpp
<7>[ 168.710397] s3c-fimc-0 : fimc_g_parm
<7>[ 168.710411] s3c-fimc-0 : fimc_reqbufs_capture: requested 4 buffers
<7>[ 168.710432] s3c-fimc-0 : fimc_querybuf_capture: 614400 bytes at index: 0
<7>[ 168.710547] s3c-fimc-0 : fimc_querybuf_capture: 614400 bytes at index: 1
<7>[ 168.710620] s3c-fimc-0 : fimc_querybuf_capture: 614400 bytes at index: 2
<7>[ 168.710682] s3c-fimc-0 : fimc_querybuf_capture: 614400 bytes at index: 3
<7>[ 168.713799] s3c-fimc-0 : fimc_streamon_capture
<7>[ 168.713812] s3c-fimc-0 : fimc_camera_init
<4>[ 168.713825] s5k4ba: power ON
<6>[ 168.713856] S5K4BA 0-0021: s5k4ba_init: camera initialization start
<4>[ 168.713908] client->addr = 33
<6>[ 177.710188] S5K4BA 0-0021: s5k4ba_init: register set failed
