Exemplo n.º 1
0
static int fimc_remove(struct platform_device *pdev)
{
	fimc_unregister_controller(pdev);

	device_remove_file(&(pdev->dev), &dev_attr_log_level);

	if (fimc_dev) {
		kfree(fimc_dev);
		fimc_dev = NULL;
	}

	return 0;
}
Exemplo n.º 2
0
static int fimc_remove(struct platform_device *pdev)
{
	fimc_unregister_controller(pdev);
#ifdef VIEW_FUNCTION_CALL
	printk("[FIMC_DEV] %s(%d)\n", __func__, __LINE__);
#endif

	if (fimc_dev) {
		kfree(fimc_dev);
		fimc_dev = NULL;
	}

	return 0;
}
Exemplo n.º 3
0
static int __devinit fimc_probe(struct platform_device *pdev)
{
	struct s3c_platform_fimc *pdata;
	struct fimc_control *ctrl;
	int ret;

	if (!fimc_dev) {
		fimc_dev = kzalloc(sizeof(*fimc_dev), GFP_KERNEL);
		if (!fimc_dev) {
			dev_err(&pdev->dev, "%s: not enough memory\n",
				__func__);
			goto err_fimc;
		}
	}

	ctrl = fimc_register_controller(pdev);
	if (!ctrl) {
		printk(KERN_ERR "%s: cannot register fimc\n", __func__);
		goto err_fimc;
	}

	pdata = to_fimc_plat(&pdev->dev);
	if (pdata->cfg_gpio)
		pdata->cfg_gpio(pdev);

	/* V4L2 device-subdev registration */
	ret = v4l2_device_register(&pdev->dev, &ctrl->v4l2_dev);
	if (ret) {
		fimc_err("%s: v4l2 device register failed\n", __func__);
		goto err_v4l2;
	}

	/* things to initialize once */
	if (!fimc_dev->initialized) {
		ret = fimc_init_global(pdev);
		if (ret)
			goto err_global;
	}

	/* v4l2 subdev configuration */
	ret = fimc_configure_subdev(pdev, ctrl->id);
	if (ret) {
		fimc_err("%s: subdev[%d] registering failed\n",
							__func__, ctrl->id);
	}

	/* video device register */
	ret = video_register_device(ctrl->vd, VFL_TYPE_GRABBER, ctrl->id);
	if (ret) {
		fimc_err("%s: cannot register video driver\n", __func__);
		goto err_global;
	}

	video_set_drvdata(ctrl->vd, ctrl);

	ret = device_create_file(&(pdev->dev), &dev_attr_log_level);
	if (ret < 0)
		fimc_err("failed to add sysfs entries\n");

	fimc_info1("controller %d registered successfully\n", ctrl->id);

	return 0;

err_global:
	clk_disable(ctrl->clk);
	clk_put(ctrl->clk);

err_v4l2:
	fimc_unregister_controller(pdev);

err_fimc:
	return -EINVAL;

}
Exemplo n.º 4
0
static int __devinit fimc_probe(struct platform_device *pdev)
{
	struct s3c_platform_fimc *pdata;
	struct fimc_control *ctrl;
	int ret;
#ifdef VIEW_FUNCTION_CALL
	printk("[FIMC_DEV] %s(%d)\n", __func__, __LINE__);
#endif

	if (!fimc_dev) {
		fimc_dev = kzalloc(sizeof(*fimc_dev), GFP_KERNEL);
		if (!fimc_dev) {
			dev_err(&pdev->dev, "%s: not enough memory\n",
				__func__);
			goto err_fimc;
		}
	}

	ctrl = fimc_register_controller(pdev);
	if (!ctrl) {
		dev_err(&pdev->dev, "%s: cannot register fimc controller\n",
			__func__);
		goto err_fimc;
	}

	pdata = to_fimc_plat(&pdev->dev);
	if (pdata->cfg_gpio)
		pdata->cfg_gpio(pdev);

	/* V4L2 device-subdev registration */
	ret = v4l2_device_register(&pdev->dev, &ctrl->v4l2_dev);
	if (ret) {
		dev_err(&pdev->dev, "%s: v4l2 device register failed\n",
			__func__);
		goto err_v4l2;
	}

#ifdef S5P6442_POWER_GATING_CAM
//      fimc0 controller for Camera
	if(ctrl->id == CAM_ID){
          s5p6442_idle_pm_gpiocfg(S5P6442_CAM_ID, S5P6442_ACTIVE_MODE);
        gFIMC_CNT[ctrl->id]++;
	  
        }
        s5p6442_pwrgate_config(S5P6442_CAM_ID, S5P6442_ACTIVE_MODE);
        //gFIMC_CNT[ctrl->id]++;
#endif

	/* things to initialize once */
	if (!fimc_dev->initialized) {
		ret = fimc_init_global(pdev);
		if (ret)
			goto err_global;
	}

	/* v4l2 subdev configuration */
	ret = fimc_configure_subdev(pdev, ctrl->id);
	if (ret) {
		dev_err(&pdev->dev, "%s: subdev[%d] registering failed\n",
			__func__, ctrl->id);
	}

	/* video device register */
	ret = video_register_device(ctrl->vd, VFL_TYPE_GRABBER, ctrl->id);
	if (ret) {
		dev_err(&pdev->dev, "%s: cannot register video driver\n",
			__func__);
		goto err_global;
	}

	video_set_drvdata(ctrl->vd, ctrl);
    
    if (ctrl->id == 1)
			pdata->hw_ver = 0x50;
		else
			pdata->hw_ver = 0x45;
 
	dev_info(&pdev->dev, "controller %d registered successfully\n",
		ctrl->id);



#ifdef S5P6442_POWER_GATING_CAM
	if(!fimc_timer_init_flag){
                fimc_timer_init_flag = 1;
        	init_timer(&g_fimc_domain_timer);
        	g_fimc_domain_timer.function = s5p_fimc_domain_timer;
	}
        if(ctrl->id == CAM_ID){
                gFIMC_CNT[ctrl->id]--;
                s5p6442_idle_pm_gpiocfg(S5P6442_CAM_ID, S5P6442_LP_MODE);
        }
        if((gFIMC_CNT[0] <= 0) && (gFIMC_CNT[1] <= 0) && (gFIMC_CNT[2] <= 0)){
            s5p6442_pwrgate_config(S5P6442_CAM_ID, S5P6442_LP_MODE);
        }
#endif


	return 0;

err_global:
	clk_disable(ctrl->clk);
	clk_put(ctrl->clk);

err_v4l2:
	fimc_unregister_controller(pdev);


#ifdef S5P6442_POWER_GATING_CAM
	if(!fimc_timer_init_flag){	
		fimc_timer_init_flag = 1;
		init_timer(&g_fimc_domain_timer);
       		g_fimc_domain_timer.function = s5p_fimc_domain_timer;		
	}
        if(ctrl->id == CAM_ID){
		gFIMC_CNT[ctrl->id]--;
                s5p6442_idle_pm_gpiocfg(S5P6442_CAM_ID, S5P6442_LP_MODE);
        }
        if((gFIMC_CNT[0] <= 0) && (gFIMC_CNT[1] <= 0) && (gFIMC_CNT[2] <= 0)){
            s5p6442_pwrgate_config(S5P6442_CAM_ID, S5P6442_LP_MODE);
        }
#endif

err_fimc:
	return -EINVAL;

}