Пример #1
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 (g_s5ptv_status.suspend_status == true || !(g_s5ptv_status.hpd_status)) {
		switch (i) {
		/* Vlayer */
		case V4L2_BUF_TYPE_VIDEO_OUTPUT:
			s5p_vlayer_init_param(0);
			g_s5ptv_status.vp_layer_enable = true;
			break;
		/* GRP0/1 */
		case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
			g_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 (!(g_s5ptv_status.vp_layer_enable)) {
			s5p_vlayer_init_param(0);
			s5p_vlayer_start();
			g_s5ptv_status.vp_layer_enable = true;
		/*
		mdelay(50);
		if (g_s5ptv_status.hdcp_en)
			s5p_start_hdcp();
		*/
		} 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;
}
Пример #2
0
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;
}
Пример #3
0
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);
}