Example #1
0
FNRESLT isp_probe_late_init(cam_data *cam)
{
	FNRESLT ret_val;
	INT32 ret;

/*
 * initialize the camera structre
 */

	ret_val	= init_v4l2_base_struct(cam);
	if(CHECK_IN_FAIL_LIMIT(ret_val))
	{
		printk(KERN_ERR "Failed to initialize camera device\n");
		TRACE_ERR_AND_RET(FAIL);
	}
/*
 * Get the platform resource
 */
#if (CONFIG_USE_TI_RESIZER == DISABLE)
	ret_val	= init_plat_res(cam);
	if(CHECK_IN_FAIL_LIMIT(ret_val))
	{
		TRACE_ERR_AND_RET(ret_val);
	}
#endif
	ret_val	= init_plat_irq(cam);
	if(CHECK_IN_FAIL_LIMIT(ret_val))
	{
		TRACE_ERR_AND_RET(ret_val);
	}
/*
 * TODO: initialize the hardware 
 *
 */
/*
 * initialize the camera structure
 */
	ret_val	= init_cam_struct(cam);
	if(CHECK_IN_FAIL_LIMIT(ret_val))
	{
		TRACE_ERR_AND_RET(ret_val);
	}
/*
 * Configure the camera interface lines
 */

	ret_val	= init_hwr_clock(cam);
	if(CHECK_IN_FAIL_LIMIT(ret_val))
	{
		TRACE_ERR_AND_RET(ret_val);
	}

	ret_val	= all_clk_enable(cam);
	if(CHECK_IN_FAIL_LIMIT(ret_val))
	{
		TRACE_ERR_AND_RET(ret_val);
	}

	ret_val	= init_omap_hwr(cam);
	if(CHECK_IN_FAIL_LIMIT(ret_val))
	{
		printk(KERN_ERR "Failed to initialize omap hardware device\n");
		TRACE_ERR_AND_RET(ret_val);
	}
/*
 * 	initialize the sensor 
 */

	ret_val	= register_sensor_bus(cam);
	if(CHECK_IN_FAIL_LIMIT(ret_val))
	{
		TRACE_ERR_AND_RET(ret_val);
	}

	if(cam->cam_sensor.init)
	{
		ret_val	= cam->cam_sensor.init(cam);
		if(CHECK_IN_FAIL_LIMIT(ret_val))
		{
			return ret_val;
		}
	}

/*
 * register the flash driver
 */
	ret_val	= register_flash_driver(cam);
	if(CHECK_IN_FAIL_LIMIT(ret_val))
	{
		return ret_val;
	}

	if(cam->cam_flash.init)
	{
		ret_val	= cam->cam_flash.init(cam);
		if(CHECK_IN_FAIL_LIMIT(ret_val))
		{
			return ret_val;
		}
	}
/*
 * register the video device
 */
	ret	= video_register_device(cam->video_dev, VFL_TYPE_GRABBER, video_nr);
	if (ret	== FAIL)
	{
		video_device_release(cam->video_dev);
		cam->video_dev	= NULL;

		v4l2_base_struct(&cam,MAKE_ADDRESS_INVALID);
		printk(KERN_ERR "video_register_device failed\n");
		TRACE_ERR_AND_RET(ret_val);
	}
	return SUCCESS;
}
static int isp_probe_late_init(cam_data *cam)
{
	int ret_val;
	int ret;

	ret_val	= init_v4l2_base_struct(cam);
	if(CHECK_IN_FAIL_LIMIT(ret_val))
	{
		printk(KERN_ERR "Failed to initialize camera device\n");
		return -1;
	}

	if (!cam)
		return -1;

	if (init_plat_res(cam))
		return -1;

	if (init_plat_irq(cam))
		return -1;

	init_cam_struct(cam);

	if (init_hwr_clock(cam))
		return -1;

	if (all_clk_enable(cam))
		return -1;


	if (init_omap_hwr(cam)) {
		printk(KERN_ERR "Failed to initialize omap hardware device\n");
		return -1;
	}

	ret_val	= register_sensor_bus(cam);
	if(CHECK_IN_FAIL_LIMIT(ret_val))
	{
		TRACE_ERR_AND_RET(ret_val);
	}

	if(cam->cam_sensor.init)
	{
		ret_val	= cam->cam_sensor.init(cam);
		if(CHECK_IN_FAIL_LIMIT(ret_val))
		{
			return ret_val;
		}
	}

#if defined(CONFIG_HAVE_LED_FLASH)
	ret_val	= register_flash_driver(cam);
	if(CHECK_IN_FAIL_LIMIT(ret_val))
	{
		return ret_val;
	}
#endif
	if(cam->cam_flash.init)
	{
		ret_val	= cam->cam_flash.init(cam);
		if(CHECK_IN_FAIL_LIMIT(ret_val))
		{
			return ret_val;
		}
	}

	ret = video_register_device(cam->video_dev, VFL_TYPE_GRABBER, video_nr);
	if (ret	== FAIL)
	{
		video_device_release(cam->video_dev);
		cam->video_dev	= NULL;

		v4l2_base_struct(&cam, MAKE_ADDRESS_INVALID);
		printk(KERN_ERR "video_register_device failed\n");
		TRACE_ERR_AND_RET(ret_val);
	}
	return SUCCESS;
}