Beispiel #1
0
void s3c_fimc_register_camera(struct s3c_fimc_camera *cam)
{
	int i;
	static int once=0;	
	printk("[CAM]s3c_fimc_register_camera,cam->id=%d\n",cam->id);	
	s3c_fimc.camera[cam->id] = cam;


	for (i = 0; i < S3C_FIMC_MAX_CTRLS; i++) {
		s3c_fimc.ctrl[i].in_cam = s3c_fimc.camera[cam->id];
	}
 	//----------end of add -------------------------//
printk("s3c_fimc.cam_clock = %x\n",s3c_fimc.cam_clock);
	clk_disable(s3c_fimc.cam_clock);
	clk_set_rate(s3c_fimc.cam_clock, cam->clockrate);
	clk_enable(s3c_fimc.cam_clock);

	s3c_fimc_reset_camera();
	

	printk("[CAM]Reset and init reg!1cam->client=%x\n",cam->client);
	printk("[CAM]Reset and init reg!1\n");		
	if((once==0)&&(cam->client!=0))
	{
	printk("[CAM]Reset and init reg!2\n");	
	//s3c_fimc_reset_camera();	
	for (i = 0; i < S3C_FIMC_MAX_CTRLS; i++) {
		s3c_fimc_init_camera(&s3c_fimc.ctrl[i]);
	}
	once = 1;
	}
	printk("[CAM]Reset and init reg!3\n");	
}
static int s3c_fimc_v4l2_streamon(struct file *filp, void *fh,
                                  enum v4l2_buf_type i)
{
    struct s3c_fimc_control *ctrl = (struct s3c_fimc_control *) fh;

    if (i != V4L2_BUF_TYPE_VIDEO_CAPTURE)
        return -EINVAL;

    if (ctrl->in_type != PATH_IN_DMA)
        s3c_fimc_init_camera(ctrl);

    ctrl->out_frame.skip_frames = 0;
    FSET_CAPTURE(ctrl);
    FSET_IRQ_X(ctrl);
    s3c_fimc_start_dma(ctrl);

    return 0;
}
static int s3c_fimc_v4l2_overlay(struct file *filp, void *fh, unsigned int i)
{
    struct s3c_fimc_control *ctrl = (struct s3c_fimc_control *) fh;

    if (i) {
        if (ctrl->in_type != PATH_IN_DMA)
            s3c_fimc_init_camera(ctrl);

        FSET_PREVIEW(ctrl);
        s3c_fimc_start_dma(ctrl);
    } else {
        s3c_fimc_stop_dma(ctrl);

        if (ctrl->out_type != PATH_OUT_LCDFIFO) {
            s3c_fimc_free_output_memory(&ctrl->out_frame);
            s3c_fimc_set_output_address(ctrl);
        }
    }

    return 0;
}