camera

参考程序: kernel/drivers/media/vedio/xx5640.c

初始化: _init xx5640_mod_init(void)中添加I2C设备:i2c_add_driver(&ov5640_driver);参数ov5640_driver为I2C设备,定义为:

i2c_driver  ov5640_driver  = { driver,id_table,command,probe,remove}

probe函数比较重要,其流程为:

client->addr = 0x3c;

pdata->power_on(1,1)//set up inffo structure

info = kzalloc(sizeof(struct ov5640_info))申请内存地址

info->fmt = &ov5640_formats[1];

vo5640_format_struct 中应该是接收信号的数据格式;YUV为RGB三原色经内插法所得,数据量较小;ov5640_formats[]中包含了

desc = “YUYV 4:2:2”

pixelformat = v4L2_pix_fmt_yuyv

regs = ov5640_fmt_yuv422_vga,

bpp = 16/12 

设置平台数据: i2c_set_clientdata(client)

读camera的id ov5640_detect(client)  该函数调用函数 ov5640_read(client,aREG_PIDH,&v),和函数ov5640_read(client,aREG_PIDL,&v),这两个个函数

又最终调用了i2c_smbus_write_byte_data(c,address[2],address【1】)表示要读哪个寄存器,用函数i2c_smbus_read_byte(c)来读取寄存器中的值;每次

读取16位,分两次读完,先读高位寄存器在读低位;

   ccic_sensor_attach(client)该函数主要的流程是:

1、ccic_find_dev[0],// only support  one camera controller该函数中利用了互斥体,

\mutex_lock(&my_mutex)

````临界资源····

mutex_unlock(&my_mutex)

2、__ccic_cam_reset 重置

3、set sensor

 

你可能感兴趣的:(camera)