Esempio n. 1
0
static int s5p_tv_v4l2_s_fmt_vid_out_overlay(struct file *file, void *fh,
	struct v4l2_format *f)
{
	struct v4l2_format *vid_out_fmt = f;

	V4L2PRINTK("(0x%08x)++\n", f->type);

	if (vid_out_fmt->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY) {
		struct v4l2_window_s5p_tvout vparam;
		memcpy(&vparam, vid_out_fmt->fmt.raw_data,
			sizeof(struct v4l2_window_s5p_tvout));

		g_s5ptv_status.vl_basic_param.win_blending =
			(vparam.flags & V4L2_FBUF_FLAG_CHROMAKEY) ? 1 : 0;
		g_s5ptv_status.vl_basic_param.alpha =
			(vparam.flags & V4L2_FBUF_FLAG_LOCAL_ALPHA) ? 1 : 0;
		g_s5ptv_status.vl_basic_param.priority =
			vparam.priority;
		g_s5ptv_status.vl_basic_param.src_offset_x =
			vparam.win.w.left;
		g_s5ptv_status.vl_basic_param.src_offset_y =
			vparam.win.w.top;
		g_s5ptv_status.vl_basic_param.src_width =
			vparam.win.w.width;
		g_s5ptv_status.vl_basic_param.src_height =
			vparam.win.w.height;

		V4L2PRINTK("[type 0x%08x] : left: [%d], top [%d],\
			width[%d], height[%d]\n",
			   f->type,
			   g_s5ptv_status.vl_basic_param.src_offset_x ,
			   g_s5ptv_status.vl_basic_param.src_offset_y ,
			   g_s5ptv_status.vl_basic_param.src_width,
			   g_s5ptv_status.vl_basic_param.src_height);

		if ((g_s5ptv_status.hpd_status) && g_s5ptv_status.vp_layer_enable) {
			struct s5p_img_offset	img_offset;
			struct s5p_img_size	img_size;

			img_offset.offset_x = vparam.win.w.left;
			img_offset.offset_y = vparam.win.w.top;
			img_size.img_width = vparam.win.w.width;
			img_size.img_height = vparam.win.w.height;

			s5p_vlayer_set_blending(
				g_s5ptv_status.vl_basic_param.win_blending);
			s5p_vlayer_set_alpha(
				g_s5ptv_status.vl_basic_param.alpha);
			s5p_vlayer_set_priority(vparam.priority);
			s5p_vlayer_set_src_position((unsigned long)
				&img_offset);
			s5p_vlayer_set_src_size((unsigned long)
				&img_size);
		}
	}

	V4L2PRINTK("()--\n");

	return 0;
}
Esempio n. 2
0
/* Stream on/off */
static int s5p_tv_v4l2_streamon(struct file *file, void *fh,
	enum v4l2_buf_type i)
{
	struct s5p_tv_vo *layer = (struct s5p_tv_vo *)fh;

	V4L2PRINTK("(0x%08x)++\n", i);

    // tv dirver is on suspend mode or hdmi cable is not inserted
    // Just set the status variable on this function
    // overlay will be enabled or disabled on resume or handle_cable function according to this status variable
    if(s5ptv_status.suspend_status == true || !(s5ptv_status.hpd_status))
    {
	switch (i) {
		/* Vlayer */

	case V4L2_BUF_TYPE_VIDEO_OUTPUT:
		_s5p_vlayer_init_param(0);
                s5ptv_status.vp_layer_enable = true;
                break;
                // GRP0/1

            case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY :
                s5ptv_status.grp_layer_enable[layer->index] = true;
                break;

            default :
                break;
        }
	    V4L2PRINTK("()it's on suspend mode or hdmi cable is not inserted --\n");
        return 0;
    }

	switch (i) {
		// Vlayer
        case V4L2_BUF_TYPE_VIDEO_OUTPUT :
            if(!(s5ptv_status.vp_layer_enable))
            {
                _s5p_vlayer_init_param(0);
		_s5p_vlayer_start();
		s5ptv_status.vp_layer_enable = true;

            }
            else
                return -EBUSY;

	    break;
		/* GRP0/1 */

	case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
		_s5p_grp_start(layer->index);
		break;

	default:
		break;
	}

	V4L2PRINTK("()--\n");

	return 0;
}
Esempio n. 3
0
/* start overlay * */
static int s5p_tv_v4l2_overlay(struct file *file, void *fh, unsigned int i)
{
	struct s5p_tv_vo *layer = (struct s5p_tv_vo *)fh;
	int	start = i;
	V4L2PRINTK("(0x%08x)++\n", i);

	/* tv dirver is on suspend mode
	   Just set the status variable on this function
	   overlay will be enabled or disabled on resume or
	   handle_cable function according to this status variable*/
	if (s5ptv_status.suspend_status == true || !(s5ptv_status.hpd_status)) {
		if (start)
			s5ptv_status.grp_layer_enable[layer->index] = true;
		else
			s5ptv_status.grp_layer_enable[layer->index] = false;

	    V4L2PRINTK("()it's on suspend mode or hdmi cable is not inserted--\n");
		return 0;
            
    }   
    else
    {
		if (start)
			_s5p_grp_start(layer->index);
		else
			_s5p_grp_stop(layer->index);
	}


	V4L2PRINTK("()--\n");
	return 0;
}
Esempio n. 4
0
static int s5p_tv_v4l2_g_fmt_vid_out_overlay(struct file *file,
	void *fh, struct v4l2_format *f)
{

	struct v4l2_format *vid_out_fmt = f;

	V4L2PRINTK("(0x%08x)++\n", f->type);

	switch (vid_out_fmt->type) {

	case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: {

		struct v4l2_window_s5p_tvout vparam;
		memset(&vparam, 0, sizeof(struct v4l2_window_s5p_tvout));

		if (s5ptv_status.vl_basic_param.win_blending) {
			vparam.flags		= V4L2_FBUF_FLAG_CHROMAKEY;
			vparam.capability	= V4L2_FBUF_CAP_CHROMAKEY;
		}

		if (s5ptv_status.vl_basic_param.alpha) {
			vparam.flags		= V4L2_FBUF_FLAG_LOCAL_ALPHA;
			vparam.capability	= V4L2_FBUF_CAP_LOCAL_ALPHA;
		}

		vparam.priority	=
			s5ptv_status.vl_basic_param.priority;

		vparam.win.w.left =
			s5ptv_status.vl_basic_param.src_offset_x;
		vparam.win.w.top =
			s5ptv_status.vl_basic_param.src_offset_y;
		vparam.win.w.width =
			s5ptv_status.vl_basic_param.src_width;
		vparam.win.w.height =
			s5ptv_status.vl_basic_param.src_height;
		V4L2PRINTK("[type 0x%08x] : left: [%d], top [%d],\
			width[%d], height[%d]\n",
			   f->type,
			   s5ptv_status.vl_basic_param.src_offset_x,
			   s5ptv_status.vl_basic_param.src_offset_y,
			   s5ptv_status.vl_basic_param.src_width,
			   s5ptv_status.vl_basic_param.src_height);
		memcpy(vid_out_fmt->fmt.raw_data, &vparam,
			sizeof(struct v4l2_window_s5p_tvout));
		break;
	}

	default:
		break;
	}

	V4L2PRINTK("()--\n");

	return 0;
}
Esempio n. 5
0
/* Standard handling ENUMSTD is handled by videodev.c */
static int s5p_tv_v4l2_g_std(struct file *file, void *fh, v4l2_std_id *norm)
{
	V4L2PRINTK("()++\n");

	*norm = s5ptv_status.v4l2.std->id;

	V4L2PRINTK("(%d)++\n", (int)(*norm));

	return 0;
}
long s5p_tv_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
	switch (cmd) {
	case VIDIOC_HDCP_ENABLE:
//		s5ptv_status.hdmi.hdcp_en = (unsigned int) arg; //. d: sichoi
		V4L2PRINTK("HDCP status is %s\n",
		       s5ptv_status.hdcp_en ? "enabled" : "disabled");

		return 0;

	case VIDIOC_HDCP_STATUS: {

		unsigned int *status = (unsigned int *)&arg;

		*status = 1;

		V4L2PRINTK("HPD status is %s\n",
		       s5ptv_status.hpd_status ? "plugged" : "unplugged");

		return 0;
	}

	case VIDIOC_HDCP_PROT_STATUS: {

		unsigned int *prot = (unsigned int *)&arg;

		*prot = 1;

//		V4L2PRINTK("hdcp prot status is %d\n", hdcp_protocol_status);

		return 0;
	}

	case VIDIOC_ENUMSTD: {

		struct v4l2_standard *p = (struct v4l2_standard *)arg;

		if (p->index >= S5P_TVOUT_MAX_STANDARDS) {
			V4L2PRINTK("exceeded S5P_TVOUT_MAX_STANDARDS\n");

			return -EINVAL;
		}

		memcpy(p, &s5p_tv_standards[p->index],
			sizeof(struct v4l2_standard));

		return 0;
	}

	default:
		break;
	}

	return video_ioctl2(file, cmd, arg);
}
Esempio n. 7
0
static int s5p_tv_v4l2_streamoff(struct file *file, void *fh,
	enum v4l2_buf_type i)
{
	struct s5p_tv_vo *layer = (struct s5p_tv_vo *)fh;

	V4L2PRINTK("(0x%08x)++\n", i);

	/* tv driver is on suspend mode or hdmi cable is not inserted
	   Each layer was disabled on suspend function already.
	   Just set the status variable on this function
	   Each layer will be enabled or disabled on resume or
	   handle_cable function according to this status variable*/
	if (s5ptv_status.suspend_status == true || !(s5ptv_status.hpd_status)) {
		switch (i) {
			/* Vlayer*/
		case V4L2_BUF_TYPE_VIDEO_OUTPUT:
			s5ptv_status.vp_layer_enable = false;
			break;
			/* GRP0/1*/
		case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
			s5ptv_status.grp_layer_enable[layer->index] = false;
			break;

		default:
			break;
		}
	    V4L2PRINTK("()it's on suspend mode or hdmi cable is not inserted--\n");
		return 0;
	}

	switch (i) {
		/* Vlayer */
	case V4L2_BUF_TYPE_VIDEO_OUTPUT:
		_s5p_vlayer_stop();
		break;
		/* GRP0/1 */
	case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
		_s5p_grp_stop(layer->index);
		break;

	default:
		break;
	}

	V4L2PRINTK("()--\n");

	return 0;
}
Esempio n. 8
0
/* VIDIOC_ENUM_FMT handlers */
static int s5p_tv_v4l2_enum_fmt_vid_out(struct file *file, void *fh,
	struct v4l2_fmtdesc *f)
{
	int index = f->index;

	V4L2PRINTK("(%d)++\n", f->index);

	if (index >= S5P_TVOUT_MAX_O_FMT_DESC) {
		V4L2PRINTK("exceeded S5P_TVOUT_MAX_O_FMT_DESC\n");
		return -EINVAL;
	}

	memcpy(f, &s5p_tv_o_fmt_desc[index], sizeof(struct v4l2_fmtdesc));

	V4L2PRINTK("()--\n");
	return 0;

}
Esempio n. 9
0
static int s5p_tv_v4l2_enum_fmt_vid_out_overlay(struct file *file,
	void *fh, struct v4l2_fmtdesc *f)
{
	int index = f->index;

	V4L2PRINTK("(%d)++\n", f->index);

	if (index >= S5P_TVOUT_MAX_O_OVERLAY_FMT_DESC) {
		pr_err("%s::index(%d) exceeded S5P_TVOUT_MAX_O_OVERLAY_FMT_DESC\n",
			__func__, index);
		return -EINVAL;
	}

	memcpy(f, &s5p_tv_o_overlay_fmt_desc[index],
		sizeof(struct v4l2_fmtdesc));

	V4L2PRINTK("()--\n");

	return 0;
}
static int s5p_tv_v4l2_enum_output(struct file *file, void *fh,
	struct v4l2_output *a)
{
	unsigned int index = a->index;

	if (index >= S5P_TVOUT_MAX_O_TYPES) {
		V4L2PRINTK("exceeded supported output!!\n");

		return -EINVAL;
	}

	memcpy(a, &s5p_tv_outputs[index], sizeof(struct v4l2_output));

	return 0;
}
static int s5p_tv_v4l2_enum_fmt_vid_out_overlay(struct file *file,
					void *fh, struct v4l2_fmtdesc *f)
{
	int index = f->index;

	if (index >= S5P_TVOUT_MAX_O_OVERLAY_FMT_DESC) {
		V4L2PRINTK("exceeded S5P_TVOUT_MAX_O_OVERLAY_FMT_DESC\n");

		return -EINVAL;
	}

	memcpy(f, &s5p_tv_o_overlay_fmt_desc[index],
			sizeof(struct v4l2_fmtdesc));

	return 0;
}
Esempio n. 12
0
/* VIDIOC_G_FMT handlers */
static int s5p_tv_v4l2_g_fmt_vid_out(struct file *file, void *fh,
	struct v4l2_format *f)
{

	struct v4l2_format *vid_out_fmt = f;

	V4L2PRINTK("(0x%08x)++\n", f->type);

	switch (vid_out_fmt->type) {

	case V4L2_BUF_TYPE_VIDEO_OUTPUT: {

		struct v4l2_pix_format_s5p_tvout vparam;
		memset(&vparam, 0, sizeof(struct v4l2_pix_format_s5p_tvout));

		vparam.base_y =
			(void *)s5ptv_status.vl_basic_param.top_y_address;
		vparam.base_c =
			(void *)s5ptv_status.vl_basic_param.top_c_address;
		vparam.pix_fmt.pixelformat =
			s5ptv_status.src_color;
		vparam.pix_fmt.width =
			s5ptv_status.vl_basic_param.src_width;
		vparam.pix_fmt.height =
			s5ptv_status.vl_basic_param.src_height;
		V4L2PRINTK("[type 0x%08x] : addr_y: [0x%08x],\
			addr_c [0x%08x], width[%d], height[%d]\n",
			   f->type,
			   s5ptv_status.vl_basic_param.top_y_address,
			   s5ptv_status.vl_basic_param.top_c_address,
			   s5ptv_status.vl_basic_param.src_width,
			   s5ptv_status.vl_basic_param.src_height);
		memcpy(vid_out_fmt->fmt.raw_data, &vparam,
			sizeof(struct v4l2_pix_format_s5p_tvout));
		break;
	}

	default:
		break;
	}

	return 0;
}
Esempio n. 13
0
static int s5p_tv_v4l2_s_std(struct file *file, void *fh, v4l2_std_id *norm)
{
	unsigned int i = 0;
	v4l2_std_id std_id = *norm;

	V4L2PRINTK("(0x%08Lx)++\n", std_id);

	s5ptv_status.v4l2.std = NULL;

	do {
		if (s5p_tv_standards[i].id == std_id) {
			s5ptv_status.v4l2.std = (struct v4l2_standard *)
				&s5p_tv_standards[i];
			break;
		}

		i++;
	} while (i < S5P_TVOUT_MAX_STANDARDS);

	if (i >= S5P_TVOUT_MAX_STANDARDS || s5ptv_status.v4l2.std == NULL) {
		V4L2PRINTK("(ERR) There is no tv-out standards :\
			index = 0x%08Lx\n", std_id);
		return -EINVAL;
	}
Esempio n. 14
0
/* VIDIOC_S_FMT handlers */
static int s5p_tv_v4l2_s_fmt_vid_out(struct file *file, void *fh,
	struct v4l2_format *f)
{

	struct v4l2_format *vid_out_fmt = f;

	V4L2PRINTK("(0x%08x)++\n", f->type);

	switch (vid_out_fmt->type) {

	case V4L2_BUF_TYPE_VIDEO_OUTPUT: {

		struct v4l2_pix_format_s5p_tvout vparam;
		memcpy(&vparam, vid_out_fmt->fmt.raw_data,
			sizeof(struct v4l2_pix_format_s5p_tvout));

		s5ptv_status.vl_basic_param.img_width =
			vparam.pix_fmt.width;

		s5ptv_status.vl_basic_param.img_height =
			vparam.pix_fmt.height;
	
		s5ptv_status.vl_basic_param.src_width =
			vparam.pix_fmt.width;
		s5ptv_status.vl_basic_param.src_height =
			vparam.pix_fmt.height;
		s5ptv_status.src_color =
			vparam.pix_fmt.pixelformat;

		s5ptv_status.vl_basic_param.top_y_address =
			(unsigned int)vparam.base_y;
		s5ptv_status.vl_basic_param.top_c_address =
			(unsigned int)vparam.base_c;

		/* check progressive or not */
		if (vparam.pix_fmt.field == V4L2_FIELD_NONE) {

			/* progressive */

			switch (vparam.pix_fmt.pixelformat) {

			case V4L2_PIX_FMT_NV12:
				/* linear */
				s5ptv_status.src_color =
				VPROC_SRC_COLOR_NV12;
				break;
			case V4L2_PIX_FMT_NV12T:
				/* tiled */
				s5ptv_status.src_color =
				VPROC_SRC_COLOR_TILE_NV12;
				break;
			default:
				V4L2PRINTK("src img format not supported\n");
				break;
			}

			s5ptv_status.field_id = VPROC_TOP_FIELD;

			if ((s5ptv_status.hpd_status) && s5ptv_status.vp_layer_enable) {
				struct s5p_video_img_address temp_addr;
				struct s5p_img_size	img_size;

				temp_addr.y_address =
					(unsigned int)vparam.base_y;
				temp_addr.c_address =
					(unsigned int)vparam.base_c;
				img_size.img_width =
					(unsigned int)vparam.pix_fmt.width;
				img_size.img_height =
					(unsigned int)vparam.pix_fmt.height;

				_s5p_vlayer_set_top_address((unsigned long)
					&temp_addr);
				_s5p_vlayer_set_img_size((unsigned long)
					&img_size);

			}
		} else if (vparam.pix_fmt.field == V4L2_FIELD_INTERLACED_TB) {

			/* interlaced */

			switch (vparam.pix_fmt.pixelformat) {

			case V4L2_PIX_FMT_NV12:
				/* linear */
				s5ptv_status.src_color =
				VPROC_SRC_COLOR_NV12IW;
				break;
			case V4L2_PIX_FMT_NV12T:
				/* tiled */
				s5ptv_status.src_color =
				VPROC_SRC_COLOR_TILE_NV12IW;
				break;
			default:
				V4L2PRINTK("src img format not supported\n");
				break;
			}

			if (vparam.pix_fmt.priv == V4L2_FIELD_BOTTOM)
				s5ptv_status.field_id = VPROC_BOTTOM_FIELD;
			else
				s5ptv_status.field_id = VPROC_TOP_FIELD;

			if ((s5ptv_status.hpd_status) && s5ptv_status.vp_layer_enable) {
				struct s5p_video_img_address temp_addr;
				struct s5p_img_size	img_size;

				temp_addr.y_address =
					(unsigned int)vparam.base_y;
				temp_addr.c_address =
					(unsigned int)vparam.base_c;
				img_size.img_width =
					(unsigned int)vparam.pix_fmt.width;
				img_size.img_height =
					(unsigned int)vparam.pix_fmt.height;

				_s5p_vlayer_set_top_address((unsigned long)
					&temp_addr);
				_s5p_vlayer_set_img_size((unsigned long)
					&img_size);

			}

		} else {
			V4L2PRINTK("this field id not supported\n");
		}
		break;
	}

	default:
		break;
	}

	V4L2PRINTK("[type 0x%08x] : addr_y: [0x%08x], addr_c [0x%08x],\
		width[%d], height[%d]\n",
		   f->type,
		   s5ptv_status.vl_basic_param.top_y_address,
		   s5ptv_status.vl_basic_param.top_c_address,
		   s5ptv_status.vl_basic_param.src_width,
		   s5ptv_status.vl_basic_param.src_height);
	V4L2PRINTK("()--\n");

	return 0;
}
long s5p_tv_v_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
	switch (cmd) {
	case VIDIOC_INIT_AUDIO:
//		s5ptv_status.hdmi.audio = (unsigned int) arg; //. d: sichoi

		if (arg) {
			s5p_hdmi_set_audio(true);

			if (s5ptv_status.tvout_output_enable)
				s5p_hdmi_audio_enable(true);
		} else {
			s5p_hdmi_set_audio(false);

			if (s5ptv_status.tvout_output_enable)
				s5p_hdmi_audio_enable(false);

		}

		return 0;

	case VIDIOC_AV_MUTE:
		if (arg) {
//			s5ptv_status.hdmi.audio = HDMI_AUDIO_NO; //. d: sichoi

			if (s5ptv_status.tvout_output_enable) {
				s5p_hdmi_audio_enable(false);
				s5p_hdmi_set_bluescreen(true);
			}

			s5p_hdmi_set_mute(true);
		} else {
//			s5ptv_status.hdmi.audio = HDMI_AUDIO_PCM; //. d: sichoi

			if (s5ptv_status.tvout_output_enable) {
				s5p_hdmi_audio_enable(true);
				s5p_hdmi_set_bluescreen(false);
			}

			s5p_hdmi_set_mute(false);
		}

		return 0;
	case VIDIOC_G_AVMUTE:
		return s5p_hdmi_get_mute();

	case VIDIOC_HDCP_ENABLE:
//		s5ptv_status.hdmi.hdcp_en = (unsigned int) arg; //. d: sichoi
		V4L2PRINTK("HDCP status is %s\n",
		       s5ptv_status.hdcp_en ? "enabled" : "disabled");

		return 0;

	case VIDIOC_HDCP_STATUS: {
		unsigned int *status = (unsigned int *)&arg;

		*status = 1;

		V4L2PRINTK("HPD status is %s\n",
		       s5ptv_status.hpd_status ? "plugged" : "unplugged");

		return 0;
	}

	case VIDIOC_HDCP_PROT_STATUS: {
		unsigned int *prot = (unsigned int *)&arg;

		*prot = 1;

//		V4L2PRINTK("hdcp prot status is %d\n", hdcp_protocol_status);

		return 0;
	}

	case VIDIOC_ENUMSTD: {
		struct v4l2_standard *p = (struct v4l2_standard *)arg;

		if (p->index >= S5P_TVOUT_MAX_STANDARDS) {
			V4L2PRINTK("exceeded S5P_TVOUT_MAX_STANDARDS\n");

			return -EINVAL;
		}

		memcpy(p, &s5p_tv_standards[p->index],
			sizeof(struct v4l2_standard));

		return 0;
	}

	default:
		break;
	}

	return video_ioctl2(file, cmd, arg);
}
	/*
	 * For TV system mmu test
	 * vparam.base_y : cookie
	 * vparam.base_c : offset of base_c from base_y
	 */
	base_y = (unsigned long) s5p_getaddress((unsigned int)vparam.base_y);
	base_c = base_y + (unsigned long)vparam.base_c;
	s5p_vp_ctrl_set_src_plane(base_y, base_c, pix_fmt->width,
		pix_fmt->height, color, field );
#else
	s5p_vp_ctrl_set_src_plane(vparam.base_y, vparam.base_c,
		pix_fmt->width, pix_fmt->height, color, field );
#endif
	return 0;

error_on_s_fmt_type_private:
	return -1;
}

#if 0 /* This function will be used */
static int s5p_tv_v4l2_g_fmt_vid_overlay(
		struct file		*file,
		void			*fh,
		struct v4l2_format	*a)
{
	return 0;
}
#endif

static int s5p_tv_v4l2_s_fmt_vid_overlay(
		struct file		*file,
		void			*fh,
		struct v4l2_format	*a)
{
	struct v4l2_rect *rect = &a->fmt.win.w;

	s5p_vp_ctrl_set_dest_win_alpha_val(a->fmt.win.global_alpha);
	s5p_vp_ctrl_set_dest_win(
		rect->left, rect->top,
		rect->width, rect->height);

	return 0;
}

#if 0 /* These functions will be used */
static int s5p_tv_v4l2_cropcap(struct file *file, void *fh,
				struct v4l2_cropcap *a)
{
#ifndef OLD
#else
	struct v4l2_cropcap *cropcap = a;

	switch (cropcap->type) {
	case V4L2_BUF_TYPE_VIDEO_OUTPUT:
		break;

	case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
		break;

	default:
		return -1;
	}

	switch (s5ptv_status.tvout_param.disp) {
	case TVOUT_NTSC_M:
	case TVOUT_NTSC_443:
	case TVOUT_480P_60_16_9:
	case TVOUT_480P_60_4_3:
	case TVOUT_480P_59:
		cropcap->bounds.top = 0;
		cropcap->bounds.left = 0;
		cropcap->bounds.width = 720;
		cropcap->bounds.height = 480;

		cropcap->defrect.top = 0;
		cropcap->defrect.left = 0;
		cropcap->defrect.width = 720;
		cropcap->defrect.height = 480;
		break;

	case TVOUT_PAL_M:
	case TVOUT_PAL_BDGHI:
	case TVOUT_PAL_N:
	case TVOUT_PAL_NC:
	case TVOUT_PAL_60:
	case TVOUT_576P_50_16_9:
	case TVOUT_576P_50_4_3:
		cropcap->bounds.top = 0;
		cropcap->bounds.left = 0;
		cropcap->bounds.width = 720;
		cropcap->bounds.height = 576;

		cropcap->defrect.top = 0;
		cropcap->defrect.left = 0;
		cropcap->defrect.width = 720;
		cropcap->defrect.height = 576;
		break;

	case TVOUT_720P_60:
	case TVOUT_720P_59:
	case TVOUT_720P_50:
		cropcap->bounds.top = 0;
		cropcap->bounds.left = 0;
		cropcap->bounds.width = 1280;
		cropcap->bounds.height = 720;

		cropcap->defrect.top = 0;
		cropcap->defrect.left = 0;
		cropcap->defrect.width = 1280;
		cropcap->defrect.height = 720;
		break;

	case TVOUT_1080I_60:
	case TVOUT_1080I_59:
	case TVOUT_1080I_50:
	case TVOUT_1080P_60:
	case TVOUT_1080P_59:
	case TVOUT_1080P_50:
	case TVOUT_1080P_30:
		cropcap->bounds.top = 0;
		cropcap->bounds.left = 0;
		cropcap->bounds.width = 1920;
		cropcap->bounds.height = 1080;

		cropcap->defrect.top = 0;
		cropcap->defrect.left = 0;
		cropcap->defrect.width = 1920;
		cropcap->defrect.height = 1080;
		break;

	default:
		return -1;

	}

	V4L2PRINTK("[input type 0x%08x] : left: [%d], top [%d],"
		"width[%d], height[%d]\n",
			s5ptv_status.tvout_param.disp,
			cropcap->bounds.top ,
			cropcap->bounds.left ,
			cropcap->bounds.width,
			cropcap->bounds.height);
#endif
	return 0;
}
static int s5p_tv_v4l2_s_fmt_type_private(
		struct file		*file,
		void			*fh,
		struct v4l2_format	*a)
{
	struct v4l2_vid_overlay_src	vparam;
	struct v4l2_pix_format		*pix_fmt;
	enum s5p_vp_src_color		color;
	enum s5p_vp_field		field;
	unsigned long base_y, base_c;
	
	memcpy(&vparam, a->fmt.raw_data, sizeof(struct v4l2_vid_overlay_src));

	pix_fmt = &vparam.pix_fmt;

	/* check progressive or not */
	if (pix_fmt->field == V4L2_FIELD_NONE) {
		/* progressive */
		switch (pix_fmt->pixelformat) {
		case V4L2_PIX_FMT_NV12:
			/* linear */
			color = VP_SRC_COLOR_NV12;
			break;

		case V4L2_PIX_FMT_NV12T:
			/* tiled */
			color = VP_SRC_COLOR_TILE_NV12;
			break;

		default:
			V4L2PRINTK("src img format not supported\n");
			goto error_on_s_fmt_type_private;
		}

		field = VP_TOP_FIELD;
	} else if ((pix_fmt->field == V4L2_FIELD_TOP) || 
			(pix_fmt->field == V4L2_FIELD_BOTTOM)) {
		/* interlaced */
		switch (pix_fmt->pixelformat) {
		case V4L2_PIX_FMT_NV12:
			/* linear */
			color = VP_SRC_COLOR_NV12IW;
			break;

		case V4L2_PIX_FMT_NV12T:
			/* tiled */
			color = VP_SRC_COLOR_TILE_NV12IW;
			break;

		default:
			V4L2PRINTK("src img format not supported\n");
			goto error_on_s_fmt_type_private;
		}

		field = (pix_fmt->field == V4L2_FIELD_BOTTOM) ?
				VP_BOTTOM_FIELD : VP_TOP_FIELD;

	} else {
		V4L2PRINTK("this field id not supported\n");

		goto error_on_s_fmt_type_private;
	}

#if defined(CONFIG_S5P_SYSMMU_TV) && defined(CONFIG_S5P_VMEM)
	/*
	 * For TV system mmu test
	 * vparam.base_y : cookie
	 * vparam.base_c : offset of base_c from base_y
	 */
	base_y = (unsigned long) s5p_getaddress((unsigned int)vparam.base_y);
	base_c = base_y + (unsigned long)vparam.base_c;
	s5p_vp_ctrl_set_src_plane(base_y, base_c, pix_fmt->width,
		pix_fmt->height, color, field );
#else
	s5p_vp_ctrl_set_src_plane(vparam.base_y, vparam.base_c,
		pix_fmt->width, pix_fmt->height, color, field );
#endif
	return 0;

error_on_s_fmt_type_private:
	return -1;
}
static int s5p_tv_v4l2_s_std(struct file *file, void *fh, v4l2_std_id *norm)
{
	unsigned int i = 0;
	v4l2_std_id std_id = *norm;

	s5ptv_status.v4l2.std = NULL;

	do {
		if (s5p_tv_standards[i].id == std_id) {
			s5ptv_status.v4l2.std =
				(struct v4l2_standard *)&s5p_tv_standards[i];
			break;
		}

		i++;
	} while (i < S5P_TVOUT_MAX_STANDARDS);

	if (i >= S5P_TVOUT_MAX_STANDARDS || s5ptv_status.v4l2.std == NULL) {
		V4L2PRINTK("(ERR) There is no tv-out standards :"
			"index = 0x%08Lx\n", std_id);

		return -EINVAL;
	}

	switch (std_id) {
	case V4L2_STD_NTSC_M:
		s5ptv_status.tvout_param.disp = TVOUT_NTSC_M;
		break;

	case V4L2_STD_PAL_BDGHI:
		s5ptv_status.tvout_param.disp = TVOUT_PAL_BDGHI;
		break;

	case V4L2_STD_PAL_M:
		s5ptv_status.tvout_param.disp = TVOUT_PAL_M;
		break;

	case V4L2_STD_PAL_N:
		s5ptv_status.tvout_param.disp = TVOUT_PAL_N;
		break;

	case V4L2_STD_PAL_Nc:
		s5ptv_status.tvout_param.disp = TVOUT_PAL_NC;
		break;

	case V4L2_STD_PAL_60:
		s5ptv_status.tvout_param.disp = TVOUT_PAL_60;
		break;

	case V4L2_STD_NTSC_443:
		s5ptv_status.tvout_param.disp = TVOUT_NTSC_443;
		break;

	case V4L2_STD_480P_60_16_9:
		s5ptv_status.tvout_param.disp = TVOUT_480P_60_16_9;
		break;

	case V4L2_STD_480P_60_4_3:
		s5ptv_status.tvout_param.disp = TVOUT_480P_60_4_3;
		break;

	case V4L2_STD_480P_59:
		s5ptv_status.tvout_param.disp = TVOUT_480P_59;
		break;
	case V4L2_STD_576P_50_16_9:
		s5ptv_status.tvout_param.disp = TVOUT_576P_50_16_9;
		break;

	case V4L2_STD_576P_50_4_3:
		s5ptv_status.tvout_param.disp = TVOUT_576P_50_4_3;
		break;

	case V4L2_STD_720P_60:
		s5ptv_status.tvout_param.disp = TVOUT_720P_60;
		break;

	case V4L2_STD_720P_59:
		s5ptv_status.tvout_param.disp = TVOUT_720P_59;
		break;

	case V4L2_STD_720P_50:
		s5ptv_status.tvout_param.disp = TVOUT_720P_50;
		break;

	case V4L2_STD_1080I_60:
		s5ptv_status.tvout_param.disp = TVOUT_1080I_60;
		break;

	case V4L2_STD_1080I_59:
		s5ptv_status.tvout_param.disp = TVOUT_1080I_59;
		break;

	case V4L2_STD_1080I_50:
		s5ptv_status.tvout_param.disp = TVOUT_1080I_50;
		break;

	case V4L2_STD_1080P_30:
		s5ptv_status.tvout_param.disp = TVOUT_1080P_30;
		break;

	case V4L2_STD_1080P_60:
		s5ptv_status.tvout_param.disp = TVOUT_1080P_60;
		break;

	case V4L2_STD_1080P_59:
		s5ptv_status.tvout_param.disp = TVOUT_1080P_59;
		break;

	case V4L2_STD_1080P_50:
		s5ptv_status.tvout_param.disp = TVOUT_1080P_50;
		break;

	default:
		V4L2PRINTK("(ERR) not supported standard id :"
			"index = 0x%08Lx\n", std_id);

		return -EINVAL;
	}

	return 0;
}