分析linux-3.0-fs4412_v7的fimc是如何调用ov3640的:
cp arch/arm/boot/uImage /tftpboot/uImage_3.14.29
系统启动时的信息:
[ 4.137178] FIMC0 registered successfully
[ 4.141076] FIMC1 registered successfully
[ 4.145056] FIMC2 registered successfully
[ 4.149059] FIMC3 registered successfully
\linux-3.0-fs4412_v7\drivers\media\video\samsung\fimc\Fimc_dev.c 1768
platform_driver_register(&fimc_driver);
static int __devinit fimc_probe(struct platform_device *pdev)
{
/* V4L2 device-subdev registration */
ret = v4l2_device_register(&pdev->dev, &ctrl->v4l2_dev);//初始化v4l2_device结构
/* things to initialize once */
ret = fimc_init_global(pdev);
这里面会完成摄像头的分配以及时钟的获取
这个platform_device是内核从平台代码那里传递过来的,
里面包含的就是和具体平台相关的信息,其中就应该包含摄像头信息。
/* video device register */
ret = video_register_device(ctrl->vd, VFL_TYPE_GRABBER, ctrl->id);
video_set_drvdata(ctrl->vd, ctrl);
ret = device_create_file(&(pdev->dev), &dev_attr_log_level);
ret = device_create_file(&(pdev->dev), &dev_attr_range_mode);
printk(KERN_INFO "FIMC%d registered successfully\n", ctrl->id);//是在这里打印.
}
相机启动拍照信息(1):
<4>[ 145.909856] s3c-fimc0: FIMC0 1 opened.
//ov3640驱动开始:
<6>[ 145.910423] OV3640 7-003c: fetching platform data
<6>[ 145.910444] OV3640 7-003c: parallel mode
<6>[ 145.910462] OV3640 7-003c: ov3640 has been probed
<6>[ 145.910884] OV3640 7-003c: ov3640_init: camera initialization start
<4>[ 145.910901] leesheen : sensor is power on
||
\/
=============================================================
\linux-3.0-fs4412_v7\drivers\media\video\samsung\fimc\Fimc_dev.c
static int fimc_open(struct file *filp)
{
if (in_use >= max_use) {
ret = -EBUSY;
goto resource_busy;
} else {
atomic_inc(&ctrl->in_use);
fimc_warn("FIMC%d %d opened.\n", ctrl->id, atomic_read(&ctrl->in_use));//打印第一条信息
}
}
=================//ov3640.c
static int ov3640_s_config(struct v4l2_subdev *sd, int irq, void *platform_data)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct ov3640_state *state = to_state(sd);
struct ov3640_platform_data *pdata;
dev_info(&client->dev, "fetching platform data\n");//打印第二条信息
pdata = client->dev.platform_data;
if (!pdata->is_mipi)
{
state->is_mipi = 0;
dev_info(&client->dev, "parallel mode\n");//打印第三条信息
}
}
static int ov3640_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct ov3640_state *state;
struct v4l2_subdev *sd;
int ret = 0;
state = kzalloc(sizeof(struct ov3640_state), GFP_KERNEL);
if (state == NULL)
return -ENOMEM;
sd = &state->sd;
strcpy(sd->name, OV3640_DRIVER_NAME);
fs4412开发板学习笔记(九)
最新推荐文章于 2024-06-24 00:15:00 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)