Exemplo n.º 1
0
static int isp_abort(void *id, mm_job_post_t *job)
{
	int ret;
	ret = isp_reset(id);
	pr_err("isp_abort");
	return ret;
}
Exemplo n.º 2
0
int isp2_program(struct isp_device_t *isp, struct isp_job_post_t *job_post)
{
	int ret = 0;
	int i;
	ret = isp_reset(isp);
	if (ret != 0) {
		pr_err("isp_reset failed with %d", ret);
		return ret;
	}
	for (i = 0; i < job_post->num_regs; i++) {
		isp_write(job_post->isp_regs[i].offset,
			job_post->isp_regs[i].value);
	}

	return ret;
}
Exemplo n.º 3
0
/************************************************************************************************************
 *  
 *  MODULE TYPE	:	FUNCTION				MODULE ID	: 
 *  Name	:	omap_v4l2_read
 *  Parameter1	:	struct file *file
 *  Parameter2	:	INT8 *buf
 *  Parameter3	:	size_t count
 *  Parameter4	:	loff_t * ppos
 *  Returns	:	INT32	- On sucess returns 0
 *  				- On Failure a negative number be returned	
 *  Description	: 	perform read operation of camera driver
 *  Comments	:  	
 ************************************************************************************************************/
INT32 omap_v4l2_read(struct file *file, INT8 *buf, size_t count, loff_t * ppos)
{

//	struct video_device *dev = video_devdata(file);
	FNRESLT ret_val;
	cam_data *cam = NULL;
	INT32 err;
	UINT32 wait_event_ret_val	= DISABLE;
	UINT32 retry_count		= 0;
	UINT32 old_width,old_height;

	ret_val	= v4l2_base_struct(&cam,GET_ADDRESS);
	if(CHECK_IN_FAIL_LIMIT(ret_val))
	{
		printk(KERN_ERR "Failed to register the camera device\n");
		TRACE_ERR_AND_RET(FAIL);		
	}

	if(cam->task.bit.capture	== ENABLE)
	{
		TRACE_ERR_AND_RET(-EBUSY);	
	}

start_read_again:

	cam->task.bit.still	= ENABLE;

/*
 * configure the sensor
 */

	if(cam->cam_sensor.config_dim)
	{
		ret_val	= cam->cam_sensor.config_dim(cam);
		if(CHECK_IN_FAIL_LIMIT(ret_val))
		{
			goto exit;
		}
	}else
	{
		goto exit;
	}
/*
 * reset the isp 
 */

	ret_val	= isp_reset(cam);
	if(CHECK_IN_FAIL_LIMIT(ret_val))
	{
		goto exit;
	}

	ret_val	= isp_configure(cam);
	if(CHECK_IN_FAIL_LIMIT(ret_val))
	{
		goto exit;
	}

/*
 * Get the memory from the kernel
 */

	ret_val	= get_free_phy_mem(cam->capture.v2f.fmt.pix.sizeimage,&cam->still.phy_addr,&cam->still.vir_addr);
	if(CHECK_IN_FAIL_LIMIT(ret_val))
	{
		goto exit;
	}

	ret_val	= isp_prg_sdram_addr(cam);
	if(CHECK_IN_FAIL_LIMIT(ret_val))
	{
		goto exit;
	}

	cam->still.frame_count	= DISABLE;
	cam->still.wait_queue_head_t_dma_frame_complete_still	= DISABLE;

/*
 * Enable sensor strobe
 */
	if(cam->cam_sensor.sens_strobe)
	{
		cam->ctrl.id	= V4L2_SENS_FLASH_STROBE;
		cam->ctrl.value	= ENABLE;
		ret_val	= cam->cam_sensor.sens_strobe(cam);
		if(CHECK_IN_FAIL_LIMIT(ret_val))
		{
			goto exit;
		}
	}


	ret_val	= enable_ccdc(cam);
	if(CHECK_IN_FAIL_LIMIT(ret_val))
	{
		goto exit;
	}

	ret_val	= enable_isp_irq0(cam);
	if(CHECK_IN_FAIL_LIMIT(ret_val))
	{
		goto exit;
	}
/*
 * Wait for interrupt from the isp interrupt service routine
 */
	if(cam->still.wait_queue_head_t_dma_frame_complete_still	== DISABLE)
	{
		wait_event_ret_val	= wait_event_interruptible_timeout(cam->still.dma_frame_complete_still,		\
					      cam->still.frame_count >= STILL_IMAGE_CAPTURE_FRAME_NUMBER,		\
						20 * HZ);
	}
	
/*
 * Disable sensor strobe
 */
	if(cam->cam_sensor.sens_strobe)
	{
		cam->ctrl.id	= V4L2_SENS_FLASH_STROBE;
		cam->ctrl.value	= DISABLE;
		ret_val	= cam->cam_sensor.sens_strobe(cam);
		if(CHECK_IN_FAIL_LIMIT(ret_val))
		{
			goto exit;
		}

	}

	ret_val	= disable_ccdc(cam);
	if(CHECK_IN_FAIL_LIMIT(ret_val))
	{
		goto exit;
	}

	ret_val	= disable_isp_irq0(cam);
	if(CHECK_IN_FAIL_LIMIT(ret_val))
	{
		goto exit;
	}

	if(wait_event_ret_val == DISABLE)
	{
		cam->task.bit.still = DISABLE;

		printk(KERN_DEBUG "wait_event_interruptible_timeout %s %d \n",__FUNCTION__,__LINE__);	
		printk(KERN_ERR "omap_v4l_read timeout - Frame count %d\n",cam->still.frame_count);
	
		ret_val	= free_phy_mem(cam->still.phy_addr);
		if(CHECK_IN_FAIL_LIMIT(ret_val))
		{
			goto exit;
		}

		if(retry_count)
		{
			old_width	= cam->cam_sensor.fmt.fmt.pix.width;
			old_height	= cam->cam_sensor.fmt.fmt.pix.height;

			cam->cam_sensor.fmt.fmt.pix.width	= 640;
			cam->cam_sensor.fmt.fmt.pix.height	= 480;

			ret_val	= cam->cam_sensor.config_dim(cam);
			if(CHECK_IN_FAIL_LIMIT(ret_val))
			{
				goto exit;
			}

			cam->cam_sensor.fmt.fmt.pix.width	= old_width;
			cam->cam_sensor.fmt.fmt.pix.height	= old_height;

			mdelay(200);

			retry_count--;

			goto start_read_again;
		}		
		return -ETIME;
	}
	err = copy_to_user(buf,(UPINT8)cam->still.vir_addr, cam->capture.v2f.fmt.pix.sizeimage);

	ret_val	= free_phy_mem(cam->still.phy_addr);
	if(CHECK_IN_FAIL_LIMIT(ret_val))
	{
		goto exit;
	}

	cam->task.bit.still	= DISABLE;

	return cam->capture.v2f.fmt.pix.sizeimage;

	exit:
	{
		cam->task.bit.still	= DISABLE;
		return 0;
	}
}