A20csi接口的摄像头模块的移植

android系统源码里配置的是ov4560双摄像头,主要涉及到的文件有,sys_config.fex文件、camera.cfg文件、media_profiles.xml文件,其中sys_config.fex文件为摄像头驱动提供配置信息;camera.cfg和media_profile.xml文件为hal层提供配置信息。

另外相关的文件还有很多,下面一一说明:

首先要说的是android4.2.2/device/softwinner/wing-xxx\init.sun7i.rc文件,在该文件需要添加相应的驱动模块,

insmod  /system/vendor/modules/gc0308.ko

然后,驱动层进行配置,在lichee\tools\pack\chips\sun7i\configs\android\wing-xxx的sys_config.fex中添加camera模组的自动检测列表

(摄像头驱动代码所在目录为/lichee/linux3.3/drivers/media/video/sunxi_csi/device/)

【camera_list_para】

camera_list_para_used  =  1

gc0308                                 =  1

至于这个地方和摄像头的/dev/video0文件有什么联系,没搞清楚,只是知道当camera_list_para_used  =  1时,ls   /dev/目录下的文件没有生成摄像头的设备文件,打印的调试信息如下:

[camera_print][detect][L665]camera detect driver init
<4>[   19.935008] [camera_print][detect][L176]fetch script data camera_list_para.camera_list_para_used fail
<4>[   19.951067] [camera_print][detect][L672][camera_list_para] not exist in sys_config1.fex !! 
<4>[   19.966895] [camera_print][detect][L679]camera detector exit, it will do nothing ...... 
<6>[   19.975730] init: command 'insmod' r=0
<4>[   20.006715] init_sensor:init_sensor start
<6>[   20.011685] init: command 'insmod' r=0
<6>[   20.098594] [CSI]Welcome to CSI driver

<6>[   20.102372] [CSI]csi_init
<6>[   20.164610] [CSI]registered sub device,input_num = 0
<4>[   20.170892] create_regulator: axp20_ldo3: Failed to create debugfs directory
<4>[   20.178131] create_regulator: axp20_ldo4: Failed to create debugfs directory
<6>[   20.186302] [CSI]power on and standy on camera 0!
<6>[   20.341966] [CSI]V4L2 device registered as video0
当camera_list_para_used  =  0时,可以看到/dev/目录下生成了摄像头的设备文件video0,调试打印信息如下:

<4>[   16.473644] [camera_print][detect][L665]camera detect driver init
<4>[   16.487590] [camera_print][detect][L171]csi0_para.csi_dev_qty=1
<4>[   16.493560] [camera_print][detect][L171]csi0_para.csi_twi_id=1
<4>[   16.522183] [camera_print][detect][L171]csi0_para.csi_facing=1
<4>[   16.537087] [camera_print][detect][L193]csi0_para.csi_reset gpio=180,mul_sel=1,data:0
<4>[   16.552586] [camera_print][detect][L198]fetch script data csi0_para.csi_power_en fail
<4>[   16.564971] [camera_print][detect][L193]csi0_para.csi_stby gpio=183,mul_sel=1,data:1
<4>[   16.572742] [camera_print][detect][L198]fetch script data csi0_para.csi_af_en fail
<4>[   16.604853] [camera_print][detect][L207]csi0_para.csi_iovdd=axp20_pll
<4>[   16.611519] [camera_print][detect][L207]csi0_para.csi_avdd=
<4>[   16.627648] [camera_print][detect][L207]csi0_para.csi_dvdd=
<4>[   16.633311] create_regulator: axp20_ldo3: Failed to create debugfs directory
<4>[   16.655004] [camera_print][detect][L418]camera_list_size: 20 
<4>[   16.660811] [camera_print][detect][L423]modules: gc0308 need detect!!
<4>[   16.675036] [camera_print][detect][L108]camera_mclk_open !!
<4>[   16.680720] [camera_print][detect][L438]camera_diff_i2c_id_detect!!
<4>[   16.695589] [camera_print][list][L28]OSAL_GPIO_Request ok, gpio_name=csi_stby, gpio=183,mul_sel=1
<4>[   16.711500] [camera_print][list][L28]OSAL_GPIO_Request ok, gpio_name=csi_reset, gpio=180,mul_sel=1
<4>[   16.758797] [camera_print][list][L28]OSAL_GPIO_Request ok, gpio_name=csi_stby, gpio=183,mul_sel=1
<4>[   16.806177] [camera_print][list][L28]OSAL_GPIO_Request ok, gpio_name=csi_reset, gpio=180,mul_sel=1
<4>[   16.865776] [camera_print][list][L28]OSAL_GPIO_Request ok, gpio_name=csi_reset, gpio=180,mul_sel=1
<4>[   16.886280] [camera_print][list][L445]try to detect gc0308 ... 
<4>[   16.892248] [camera_print][list][L137]reg[0]:254->data[0]:254
<4>[   16.903653] [camera_print][list][L141]value[0]:0->data[1]:0
<4>[   16.909450] [i2c1] START can't sendout!
<4>[   16.913291] [i2c1] Retrying transmission 2
<4>[   16.923127] [i2c1] START can't sendout!
<4>[   16.927062] [i2c1] Retrying transmission 1
<4>[   16.931431] [i2c1] START can't sendout!
<4>[   16.940253] [i2c1] Retrying transmission 0
<4>[   16.944518] [camera_print][ERR][L155]sensor_write error!, error number: -121 
<4>[   16.951796] [camera_print][ERR][L457]detect camera fail in func: camera_diff_i2c_id_detect !!
<4>[   16.964989] [camera_print][detect][L133]camera_mclk_close !!
<6>[   16.971096] init: command 'insmod' r=0
<4>[   16.993154] init_sensor:init_sensor start
<6>[   16.999455] init: command 'insmod' r=0
<5>[   17.003921] init: starting 'bootanim'
<6>[   17.085795] [CSI]Welcome to CSI driver
<6>[   17.089570] [CSI]csi_init
<3>[   17.097474] i2c i2c-1: Invalid 7-bit I2C address 0x00
<6>[   17.102551] [CSI_ERR]Error registering v4l2 subdevice,input_num = 0
<6>[   17.115128] [CSI_ERR]failed to install
<6>[   17.119379] init: command 'insmod' r=0

而且当点击android界面上的相机时,打印如下调试信息:
A20csi接口的摄像头模块的移植_第1张图片


可以查找到i2c的调试信息,是由i2c_sun7i.c文件打印,摄像头的调试信息为gc0308.c文件打印,只不过虽然找到了错误的地方,知道I2C通讯失败,地址也不对,但是在sys_config.fex文件里明明配置地址为0x42了,但是让然不知道究竟错在哪里,如有大神看到还请不吝赐教,在此表示深深感谢,,,





你可能感兴趣的:(Android系统移植)