bool _s5p_tv_if_init_hd_video_reg(void)
{
	s5p_tv_hdmi_err herr = 0;
	s5p_tv_hdmi_csc_type cscType;
	s5p_tv_status *st = &s5ptv_status;

	bool blue_enable = st->hdmi_video_blue_screen.enable;
	u8 cb_b = st->hdmi_video_blue_screen.cb_b;
	u8 y_g = st->hdmi_video_blue_screen.y_g;
	u8 cr_r = st->hdmi_video_blue_screen.cr_r;
	
	u8 y_min = st->hdmi_color_range.y_min;
	u8 y_max = st->hdmi_color_range.y_max;
	u8 c_min = st->hdmi_color_range.c_min;
	u8 c_max = st->hdmi_color_range.c_max;

	s5p_tv_disp_mode disp_mode = st->tvout_param.disp_mode;
	s5p_tv_o_mode out_mode = st->tvout_param.out_mode;

	s5p_hdmi_transmit a_trans_type = st->hdmi_av_info_frame.trans_type;
	u8 a_check_sum = st->hdmi_av_info_frame.check_sum;
	u8 *a_data = st->hdmi_av_info_frame.data;

	s5p_hdmi_transmit m_trans_type = st->hdmi_mpg_info_frame.trans_type;
	u8 m_check_sum = st->hdmi_mpg_info_frame.check_sum;
	u8 *m_data = st->hdmi_mpg_info_frame.data;

	s5p_hdmi_transmit s_trans_type = st->hdmi_spd_info_frame.trans_type;
	u8 *spd_header = st->hdmi_spd_info_frame.spd_header;
	u8 *spd_data = st->hdmi_spd_info_frame.spd_data;

	bool timing_correction_en = st->hdmi_tg_cmd.timing_correction_en;
	bool bt656_sync_en = st->hdmi_tg_cmd.bt656_sync_en;
	bool tg_en;

	
	herr = __s5p_hdmi_video_init_display_mode(disp_mode,out_mode);

	if (herr != HDMI_NO_ERROR) {
		return false;
	}

	__s5p_hdmi_video_init_bluescreen(blue_enable,cb_b,y_g,cr_r);


	__s5p_hdmi_video_init_color_range(y_min,y_max,c_min,c_max);

	switch (out_mode) {

	case TVOUT_OUTPUT_HDMI_RGB:
	case TVOUT_OUTPUT_HDMI:
		cscType = HDMI_BYPASS;
		break;
		
	case TVOUT_OUTPUT_DVI:
		cscType = HDMI_CSC_YUV601_TO_RGB_LR;
		break;

	default:
		TVOUTIFPRINTK("invalid out_mode parameter(%d)\n\r",
				out_mode);
		return false;
		break;
	}

	herr = __s5p_hdmi_video_init_csc(cscType);

	if (herr != HDMI_NO_ERROR) {
		return false;
	}

	herr =  __s5p_hdmi_video_init_avi_infoframe(a_trans_type,
					a_check_sum,a_data);

	if (herr != HDMI_NO_ERROR) {
		return false;
	}

	herr = __s5p_hdmi_video_init_mpg_infoframe(m_trans_type,
					m_check_sum,m_data);

	if (herr != HDMI_NO_ERROR) {
		return false;
	}

	herr = __s5p_hdmi_init_spd_infoframe(s_trans_type,
					spd_header,spd_data);

	if (herr != HDMI_NO_ERROR) {
		return false;
	}

	st->hdmi_tg_cmd.tg_en = true;
	tg_en = st->hdmi_tg_cmd.tg_en;

	__s5p_hdmi_video_init_tg_cmd(timing_correction_en,bt656_sync_en,tg_en);

	return true;
}
bool _s5p_tv_if_init_hd_video_reg(void)
{
	enum s5p_tv_hdmi_err herr = 0;
	enum s5p_tv_hdmi_csc_type cscType;
	struct s5p_tv_status *st = &s5ptv_status;

	u8 cb_b = st->hdmi_video_blue_screen.cb_b;
	u8 y_g = st->hdmi_video_blue_screen.y_g;
	u8 cr_r = st->hdmi_video_blue_screen.cr_r;

	u8 y_min = st->hdmi_color_range.y_min;
	u8 y_max = st->hdmi_color_range.y_max;
	u8 c_min = st->hdmi_color_range.c_min;
	u8 c_max = st->hdmi_color_range.c_max;

	enum s5p_tv_disp_mode disp_mode = st->tvout_param.disp_mode;
	enum s5p_tv_o_mode out_mode = st->tvout_param.out_mode;

	enum s5p_hdmi_transmit *a_trans_type =
		&st->hdmi_av_info_frame.trans_type;
	u8 *a_check_sum = &st->hdmi_av_info_frame.check_sum;
	u8 *a_data = st->hdmi_av_info_frame.data;

	enum s5p_hdmi_transmit m_trans_type =
		st->hdmi_mpg_info_frame.trans_type;
	u8 m_check_sum = st->hdmi_mpg_info_frame.check_sum;
	u8 *m_data = st->hdmi_mpg_info_frame.data;

	enum s5p_hdmi_transmit s_trans_type =
		st->hdmi_spd_info_frame.trans_type;
	u8 *spd_header = st->hdmi_spd_info_frame.spd_header;
	u8 *spd_data = st->hdmi_spd_info_frame.spd_data;

	if (!_s5p_tv_if_init_avi_frame(&st->tvout_param)) {
		st->tvout_param_available = false;
		return false;
	}

	herr = __s5p_hdmi_video_init_display_mode(disp_mode, out_mode, a_data);

	if (herr != HDMI_NO_ERROR)
		return false;

	st->hdmi_av_info_frame.check_sum = _s5p_tv_if_video_avi_checksum();

	if (!st->hdcp_en)
		__s5p_hdmi_video_init_bluescreen(
				st->hdmi_video_blue_screen.enable,
				cb_b, y_g, cr_r);

	__s5p_hdmi_video_init_color_range(y_min, y_max, c_min, c_max);

	switch (out_mode) {

	case TVOUT_OUTPUT_HDMI_RGB:
	case TVOUT_OUTPUT_HDMI:
		cscType = HDMI_BYPASS;
		break;

	case TVOUT_OUTPUT_DVI:
		cscType = HDMI_CSC_YUV601_TO_RGB_LR;
		s_trans_type = HDMI_DO_NOT_TANS;
		break;

	default:
		TVOUTIFPRINTK("invalid out_mode parameter(%d)\n\r",
				out_mode);
		return false;
		break;
	}

	herr = __s5p_hdmi_video_init_csc(cscType);

	if (herr != HDMI_NO_ERROR)
		return false;


	herr =  __s5p_hdmi_video_init_avi_infoframe(*a_trans_type,
					*a_check_sum, a_data);

	if (herr != HDMI_NO_ERROR)
		return false;


	herr = __s5p_hdmi_video_init_mpg_infoframe(m_trans_type,
					m_check_sum, m_data);

	if (herr != HDMI_NO_ERROR)
		return false;


	herr = __s5p_hdmi_init_spd_infoframe(s_trans_type,
					spd_header, spd_data);

	if (herr != HDMI_NO_ERROR)
		return false;

	return true;
}