/*
 * TV cut off sequence
 * VP stop -> Mixer stop -> HDMI stop -> HDMI TG stop
 * Above sequence should be satisfied.
 */
bool _s5p_tv_if_stop(void)
{
	struct s5p_tv_status *st = &s5ptv_status;

	bool t_corr_en 	 = st->hdmi_tg_cmd.timing_correction_en;
	bool sync_en 	 = st->hdmi_tg_cmd.bt656_sync_en;
	enum s5p_tv_o_mode out_mode = st->tvout_param.out_mode;

	TVOUTIFPRINTK("tvout sub sys. stopped!!\n");

	__s5p_vm_stop();

	switch (out_mode) {

	case TVOUT_OUTPUT_COMPOSITE:

	case TVOUT_OUTPUT_SVIDEO:

	case TVOUT_OUTPUT_COMPONENT_YPBPR_INERLACED:

	case TVOUT_OUTPUT_COMPONENT_YPBPR_PROGRESSIVE:

	case TVOUT_OUTPUT_COMPONENT_RGB_PROGRESSIVE:
		if (st->tvout_output_enable)
			__s5p_sdout_stop();
		break;

	case TVOUT_OUTPUT_HDMI:
	case TVOUT_OUTPUT_HDMI_RGB:
	case TVOUT_OUTPUT_DVI:
		if (st->tvout_output_enable) {
			__s5p_hdmi_stop();
			__s5p_hdmi_video_init_tg_cmd(t_corr_en, sync_en,
				false);
		}
		break;

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


#ifdef CONFIG_CPU_S5PC100
	if (__s5p_tv_power_get_power_status()) {
		__s5p_tv_clk_stop();
		__s5p_tv_poweroff();
	}
#endif

	st->tvout_output_enable = false;
	st->tvout_param_available = false;

	return true;
}
bool _s5p_tv_if_init_hd_reg(void)
{
	s5p_tv_status *st = &s5ptv_status;
	
	TVOUTIFPRINTK("audio type : %d, hdcp : %s)\n\r", 
		st->hdmi_audio_type, st->hdcp_en ? "enabled":"disabled");

/* C110_HDCP: 
	if (st->hdcp_en) {
		if ( !(st->hpd_status)) {
			TVOUTIFPRINTK("HPD is not detected\n\r");
			return false;
		}
	}
*/

	if (!_s5p_tv_if_init_hd_video_reg())
		return false;

	switch (st->hdmi_audio_type) {

	case HDMI_AUDIO_PCM:
		/* 
		* PCM, Samplingrate 44100, 16bit, 
		* ignore framesize cuz stream is PCM.
		*/
		__s5p_hdmi_audio_init(PCM, 44100, 16, 0); 
		break;

	case HDMI_AUDIO_NO:
		break;

	default:
		TVOUTIFPRINTK("invalid hdmi_audio_type(%d)\n\r", 
			st->hdmi_audio_type);
		return false;
		break;
	}

/* C110_HDCP: */ //st->hpd_status = 1;

	__s5p_hdmi_stop();

	if (!__s5p_hdmi_start(st->hdmi_audio_type,
			      (st->hdcp_en && st->hpd_status),
			      st->hdcp_i2c_client)) {
		return false;
	}

	return true;
}