void s5p_tv_late_resume(struct early_suspend *h)
{
	BASEPRINTK("(hpd_status = %d)++\n", g_s5ptv_status.hpd_status);

	mutex_lock(g_mutex_for_fo);
	g_s5ptv_status.suspend_status = false;

	if (g_s5ptv_status.hpd_status == true) {
		/* clk & power on */
		s5p_tv_base_clk_gate(true);
		if (g_s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI ||
		    g_s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI_RGB)
			s5p_tv_base_phy_power(true);

		/* tv on */
		if (g_s5ptv_status.tvout_output_enable)
			s5p_tv_if_start();

		/* video layer start */
		if (g_s5ptv_status.vp_layer_enable)
			s5p_vlayer_start();

		/* grp0 layer start */
		if (g_s5ptv_status.grp_layer_enable[VM_GPR0_LAYER])
			s5p_grp_start(VM_GPR0_LAYER);

		/* grp1 layer start */
		if (g_s5ptv_status.grp_layer_enable[VM_GPR1_LAYER])
			s5p_grp_start(VM_GPR1_LAYER);

#ifdef CONFIG_TV_FB
		if (g_s5ptv_status.tvout_output_enable) {
			s5ptvfb_display_on(&g_s5ptv_status);
			s5ptvfb_set_par(g_s5ptv_status.fb);
		}
#endif
	}
	mutex_unlock(g_mutex_for_fo);
	BASEPRINTK("()--\n");
	return;
}
void s5p_tv_base_handle_cable(void)
{
	char env_buf[120];
	char *envp[2];
	int env_offset = 0;
	bool previous_hpd_status = g_s5ptv_status.hpd_status;

#ifdef CONFIG_HDMI_HPD
#else
	return;
#endif

	switch (g_s5ptv_status.tvout_param.out_mode) {
	case TVOUT_OUTPUT_HDMI:
	case TVOUT_OUTPUT_HDMI_RGB:
	case TVOUT_OUTPUT_DVI:
		break;
	default:
		return;
	}

	g_s5ptv_status.hpd_status = s5p_hpd_get_state();

	if (previous_hpd_status == g_s5ptv_status.hpd_status) {
		pr_err("same hpd_status value: %d\n", previous_hpd_status);
		return;
	}

	memset(env_buf, 0, sizeof(env_buf));

	if (g_s5ptv_status.hpd_status == true) {
		BASEPRINTK("\n hdmi cable is connected\n");
		sprintf(env_buf, "HDMI_STATE=online");
		envp[env_offset++] = env_buf;
		envp[env_offset] = NULL;

		s5p_set_qos();

		if (g_s5ptv_status.suspend_status) {
			kobject_uevent_env(&(s5p_tvout[0].dev.kobj), KOBJ_CHANGE, envp);
			return;
		}

#ifdef CONFIG_PM
		s5p_tv_base_clk_gate(true);
		s5p_tv_base_phy_power(true);
#endif
		/* tv on */
		if (g_s5ptv_status.tvout_output_enable)
			s5p_tv_if_start();

		/* video layer start */
		if (g_s5ptv_status.vp_layer_enable)
			s5p_vlayer_start();

		/* grp0 layer start */
		if (g_s5ptv_status.grp_layer_enable[VM_GPR0_LAYER])
			s5p_grp_start(VM_GPR0_LAYER);

		/* grp1 layer start */
		if (g_s5ptv_status.grp_layer_enable[VM_GPR1_LAYER])
			s5p_grp_start(VM_GPR1_LAYER);

	} else {
		BASEPRINTK("\n hdmi cable is disconnected\n");
		sprintf(env_buf, "HDMI_STATE=offline");
		envp[env_offset++] = env_buf;
		envp[env_offset] = NULL;

		s5p_restore_qos();

		if (g_s5ptv_status.suspend_status) {
			kobject_uevent_env(&(s5p_tvout[0].dev.kobj), KOBJ_CHANGE, envp);
			return;
		}

		if (g_s5ptv_status.vp_layer_enable) {
			s5p_vlayer_stop();
			g_s5ptv_status.vp_layer_enable = true;
		}

		/* grp0 layer stop */
		if (g_s5ptv_status.grp_layer_enable[VM_GPR0_LAYER]) {
			s5p_grp_stop(VM_GPR0_LAYER);
			g_s5ptv_status.grp_layer_enable[VM_GPR0_LAYER] = true;
		}

		/* grp1 layer stop */
		if (g_s5ptv_status.grp_layer_enable[VM_GPR1_LAYER]) {
			s5p_grp_stop(VM_GPR1_LAYER);
			g_s5ptv_status.grp_layer_enable[VM_GPR1_LAYER] = true;
		}

		/* tv off */
		if (g_s5ptv_status.tvout_output_enable) {
			s5p_tv_if_stop();
			g_s5ptv_status.tvout_output_enable = true;
			g_s5ptv_status.tvout_param_available = true;
		}

#ifdef CONFIG_PM
		/* clk & power off */
		s5p_tv_base_clk_gate(false);
		s5p_tv_base_phy_power(false);
#endif
	}
	kobject_uevent_env(&(s5p_tvout[0].dev.kobj), KOBJ_CHANGE, envp);
}
/*
* before call this ftn. set the status data!!
*/
bool s5p_tv_if_set_disp(void)
{
	struct s5p_tv_status *st = &g_s5ptv_status;

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

	TVOUTIFPRINTK("(%d, %d)\n", disp_mode, out_mode);

	switch (disp_mode) {
	case TVOUT_NTSC_M:
	case TVOUT_NTSC_443:
		st->sdout_video_scale_cfg.component_level =
			S5P_TV_SD_LEVEL_0IRE;
		st->sdout_video_scale_cfg.component_ratio =
			SDOUT_VTOS_RATIO_7_3;
		st->sdout_video_scale_cfg.composite_level =
			S5P_TV_SD_LEVEL_75IRE;
		st->sdout_video_scale_cfg.composite_ratio =
			SDOUT_VTOS_RATIO_10_4;
		break;
	case TVOUT_PAL_BDGHI:
	case TVOUT_PAL_M:
	case TVOUT_PAL_N:
	case TVOUT_PAL_NC:
	case TVOUT_PAL_60:
		st->sdout_video_scale_cfg.component_level =
			S5P_TV_SD_LEVEL_0IRE;
		st->sdout_video_scale_cfg.component_ratio =
			SDOUT_VTOS_RATIO_7_3;
		st->sdout_video_scale_cfg.composite_level =
			S5P_TV_SD_LEVEL_0IRE;
		st->sdout_video_scale_cfg.composite_ratio =
			SDOUT_VTOS_RATIO_7_3;
		break;
	case TVOUT_480P_60_16_9:
	case TVOUT_480P_60_4_3:
	case TVOUT_576P_50_16_9:
	case TVOUT_576P_50_4_3:
	case TVOUT_720P_50:
	case TVOUT_720P_60:
	case TVOUT_1080I_50:
	case TVOUT_1080I_60:
	case TVOUT_1080P_50:
	case TVOUT_1080P_60:
	case TVOUT_1080P_30:
	case TVOUT_480P_59:
	case TVOUT_720P_59:
	case TVOUT_1080I_59:
	case TVOUT_1080P_59:
		break;
	default:
		pr_err("%s::invalid disp_mode parameter(%d)\n",
			__func__, disp_mode);
		st->tvout_param_available = false;
		return false;
		break;
	}

	switch (out_mode) {
	case TVOUT_OUTPUT_COMPOSITE:
		st->sdout_order = S5P_TV_SD_O_ORDER_COMPOSITE_Y_C_CVBS;
		st->sdout_dac_on[SDOUT_CHANNEL_0] = true;
		st->sdout_dac_on[SDOUT_CHANNEL_1] = false;
		st->sdout_dac_on[SDOUT_CHANNEL_2] = false;
		break;
	case TVOUT_OUTPUT_SVIDEO:
		st->sdout_order = S5P_TV_SD_O_ORDER_COMPOSITE_C_Y_CVBS;
		st->sdout_dac_on[SDOUT_CHANNEL_0] = false;
		st->sdout_dac_on[SDOUT_CHANNEL_1] = true;
		st->sdout_dac_on[SDOUT_CHANNEL_2] = true;
		break;
	case TVOUT_OUTPUT_COMPONENT_YPBPR_INERLACED:
	case TVOUT_OUTPUT_COMPONENT_YPBPR_PROGRESSIVE:
	case TVOUT_OUTPUT_COMPONENT_RGB_PROGRESSIVE:
		st->sdout_order = S5P_TV_SD_O_ORDER_COMPONENT_RBG_PRPBY;
		st->sdout_dac_on[SDOUT_CHANNEL_0] = true;
		st->sdout_dac_on[SDOUT_CHANNEL_1] = true;
		st->sdout_dac_on[SDOUT_CHANNEL_2] = true;
		break;
	case TVOUT_OUTPUT_HDMI_RGB:
	case TVOUT_OUTPUT_HDMI:
	case TVOUT_OUTPUT_DVI:
		st->hdmi_video_blue_screen.cb_b = 0;/* 128 */;
		st->hdmi_video_blue_screen.y_g  = 0;
		st->hdmi_video_blue_screen.cr_r = 0;/* 128 */;
		break;
	default:
		pr_err("%s::invalid out_mode parameter(%d)\n",
			__func__, out_mode);
		st->tvout_param_available = false;
		return false;
		break;
	}
#if defined(CONFIG_PM)
    if ((st->hpd_status) && st->suspend_status == false) {
#endif
	s5p_tv_if_start();
#if defined(CONFIG_PM)
    }
    /* If the cable is not inserted or system is on suspend mode
     * Just set variable, s5p_tv_if_start() function will be called in resume
     * or handle_cable function according to this variable
     */
    else
	    st->tvout_output_enable = true;
#endif

	return true;
}