예제 #1
0
static int s5p_tv_v_open(struct file *file)
{
	int ret = 0;

	mutex_lock(g_mutex_for_fo);

	if (g_s5ptv_status.tvout_output_enable) {
		pr_err("%s::tvout drv. already used !!\n", __func__);
		ret =  -EBUSY;
		goto drv_used;
	}

#ifdef CONFIG_PM
	if ((g_s5ptv_status.hpd_status) && !(g_s5ptv_status.suspend_status)) {
		BASEPRINTK("tv is turned on\n");
#endif
		s5p_set_qos();
		s5p_tv_base_clk_gate(true);
		s5p_tv_base_phy_power(true);
#ifdef CONFIG_PM
	} else
		BASEPRINTK("tv is off\n");
#endif
	s5p_tv_if_init_param();

	s5p_tv_v4l2_init_param();

	mutex_unlock(g_mutex_for_fo);

	return 0;

drv_used:
	mutex_unlock(g_mutex_for_fo);
	return ret;
}
예제 #2
0
static int s5ptvfb_open(struct fb_info *fb, int user)
{
	struct s5ptvfb_window *win = fb->par;
	int ret = 0;

	ret = s5p_tv_clk_gate(true);
	if (ret < 0) {
		printk(KERN_ERR "[Error]Cannot open it\n");
		return -1;
	}

	tv_phy_power(true);

	_s5p_tv_if_init_param();

	s5p_tv_v4l2_init_param();

	/*      s5ptv_status.tvout_param.disp_mode = TVOUT_720P_60; */
	s5ptv_status.tvout_param.out_mode  = TVOUT_OUTPUT_HDMI_RGB;

	_s5p_tv_if_set_disp();

#ifndef CONFIG_USER_ALLOC_TVOUT
	s5ptvfb_display_on(&s5ptv_status);

	s5ptvfb_enable_window(0);
#endif

	mutex_lock(&s5ptv_status.fb_lock);

	if (atomic_read(&win->in_use)) {
		dev_dbg(s5ptv_status.dev_fb,
		"do not allow multiple open "
		"for window\n");
		ret = -EBUSY;

	} else
		atomic_inc(&win->in_use);

	mutex_unlock(&s5ptv_status.fb_lock);

	return ret;

}
예제 #3
0
/*
 * ftn for video
 */
static int s5p_tv_v_open(struct file *file)
{
	int ret = 0;
	printk("[TVOUT]s5p_tv_v_open ++\n");
	TVout_LDO_ctrl(true);
	Isdrv_open = 1;
	mutex_lock(mutex_for_fo);

	if (s5ptv_status.tvout_output_enable) {
		BASEPRINTK("tvout drv. already used !!\n");
		ret =  -EBUSY;
		goto drv_used;
	}

		s5p_tv_clk_gate( true );
		

#ifdef CONFIG_CPU_S5PV210
#ifdef CONFIG_PM 
	if((s5ptv_status.hpd_status) && !(s5ptv_status.suspend_status))
	{
		BASEPRINTK("tv is turned on\n");
#endif
#ifdef CONFIG_CPU_FREQ_S5PV210
		if((s5ptv_status.hpd_status))
			s5pv210_set_cpufreq_level(RESTRICT_TABLE);
#endif /* CONFIG_CPU_FREQ_S5PV210 */
		//s5p_tv_clk_gate( true );
		//if(s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI || s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI_RGB)
		//tv_phy_power( true );
#ifdef CONFIG_PM
	}
	else
		BASEPRINTK("tv is off\n");
#endif
#endif
	_s5p_tv_if_init_param();

	s5p_tv_v4l2_init_param();

	mutex_unlock(mutex_for_fo);

#ifdef I2C_BASE
	mutex_lock(mutex_for_i2c);
	/* for ddc(hdcp port) */
	if (s5ptv_status.hpd_status) {
		if (i2c_add_driver(&hdcp_i2c_driver))
			BASEPRINTK("HDCP port add failed\n");
		hdcp_i2c_drv_state = true;
	} else
		hdcp_i2c_drv_state = false;

	mutex_unlock(mutex_for_i2c);
	/* for i2c probing */
	udelay(100);
#endif

	//if(s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI || s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI_RGB)
		tv_phy_power( true );

	return 0;

drv_used:
	mutex_unlock(mutex_for_fo);
	return ret;
}
예제 #4
0
int s5ptvfb_direct_ioctl(int id, unsigned int cmd, unsigned long arg)
{
	struct fb_info *fb = s5ptv_status.fb;
	struct fb_fix_screeninfo *fix = &fb->fix;
	struct s5ptvfb_window *win = fb->par;
	void *argp = (void *) arg;
	int ret = 0;

	switch (cmd) {

	case FBIO_ALLOC:
		win->path = (enum s5ptvfb_data_path_t) argp;
		break;

	case FBIOGET_FSCREENINFO:
		ret = memcpy(argp, &fb->fix, sizeof(fb->fix)) ? 0 : -EFAULT;
		break;

	case FBIOGET_VSCREENINFO:
		ret = memcpy(argp, &fb->var, sizeof(fb->var)) ? 0 : -EFAULT;
		break;

	case FBIOPUT_VSCREENINFO:
		ret = s5ptvfb_check_var((struct fb_var_screeninfo *) argp, fb);
		if (ret) {
			dev_err(s5ptv_status.dev_fb, "invalid vscreeninfo\n");
			break;
		}

		ret = memcpy(&fb->var, (struct fb_var_screeninfo *) argp,
				sizeof(fb->var)) ? 0 : -EFAULT;
		if (ret) {
			dev_err(s5ptv_status.dev_fb,
			       "failed to put new vscreeninfo\n");
			break;
		}

		ret = s5ptvfb_set_par(fb);
		break;

	case S5PTVFB_SET_WIN_ON:
#ifdef CONFIG_USER_ALLOC_TVOUT
		s5ptvfb_display_on(&s5ptv_status);
		s5ptvfb_enable_window(0);
#endif
		break;

	case S5PTVFB_SET_WIN_OFF:
#ifdef CONFIG_USER_ALLOC_TVOUT
		s5ptvfb_display_off(&s5ptv_status);
		s5ptvfb_disable_window(0);
#endif
		break;

	case S5PTVFB_POWER_ON:
		s5p_tv_clk_gate(true);
		tv_phy_power(true);

		_s5p_tv_if_init_param();

		s5p_tv_v4l2_init_param();

		/*      s5ptv_status.tvout_param.disp_mode = TVOUT_720P_60; */
		s5ptv_status.tvout_param.out_mode  = TVOUT_OUTPUT_HDMI;

		_s5p_tv_if_set_disp();

		break;

	case S5PTVFB_POWER_OFF:
		_s5p_vlayer_stop();
		_s5p_tv_if_stop();

		s5p_tv_clk_gate(false);
		tv_phy_power(false);
		break;

	case S5PTVFB_WIN_SET_ADDR:
		fix->smem_start = (unsigned long)argp;
		s5ptvfb_set_buffer_address(&s5ptv_status, win->id);
		break;

	default:
		ret = s5ptvfb_ioctl(fb, cmd, arg);
		break;
	}

	return ret;
}
예제 #5
0
/*
 * ftn for video
 */
static int s5p_tv_v_open(struct file *file)
{
	int ret = 0,err;

	mutex_lock(mutex_for_fo);

	if (s5ptv_status.tvout_output_enable) {
		BASEPRINTK("tvout drv. already used !!\n");
		ret =  -EBUSY;
		goto drv_used;
	}

#ifdef CONFIG_CPU_S5PV210
#ifdef CONFIG_PM_PWR_GATING 
	if((s5ptv_status.hpd_status) && !(s5ptv_status.suspend_status))
	{
		BASEPRINTK("tv is turned on\n");
#endif
#if 0
#ifdef CONFIG_CPU_FREQ
#ifdef CONFIG_CPU_MAX_FREQ_1GHZ // 2010.3.9.
		if((s5ptv_status.hpd_status))
			s5pc110_lock_dvfs_high_level(DVFS_LOCK_TOKEN_4, 3);    
#else
		if((s5ptv_status.hpd_status))
			s5pc110_lock_dvfs_high_level(DVFS_LOCK_TOKEN_4, 2);
#endif
#endif
#endif

#if defined(CONFIG_S5PC110_SIDEKICK_BOARD)	
	err = gpio_request(S5PV210_GPJ3(1),"EAR_SEL");
	udelay(50);
	gpio_direction_output(S5PV210_GPJ3(1),0);
	gpio_set_value(S5PV210_GPJ3(1),0);
	udelay(50);
#elif defined(CONFIG_S5PC110_DEMPSEY_BOARD)
//there is no connected pin
#else
	err = gpio_request(S5PV210_GPJ4(4),"TV_EN");
	udelay(50);
	gpio_direction_output(S5PV210_GPJ4(4),1);
	gpio_set_value(S5PV210_GPJ4(4),1);
	udelay(50);

	err = gpio_request(S5PV210_GPJ2(6),"EAR_SEL");
	udelay(50);
	gpio_direction_output(S5PV210_GPJ2(6),0);
	gpio_set_value(S5PV210_GPJ2(6),0);
	udelay(50);
#endif
	
		s5p_tv_clk_gate( true );
		tv_phy_power( true );
#ifdef CONFIG_PM_PWR_GATING
	}
	else
		BASEPRINTK("tv is off\n");
#endif
#endif
	_s5p_tv_if_init_param();

	s5p_tv_v4l2_init_param();

	mutex_unlock(mutex_for_fo);

	/* c110 test */	//s5ptv_status.hpd_status = true;

  printk("\n\nTV open success\n\n");

#ifdef I2C_BASE
	mutex_lock(mutex_for_i2c);
	/* for ddc(hdcp port) */
	if(s5ptv_status.hpd_status) {
		if (i2c_add_driver(&hdcp_i2c_driver)) 
			BASEPRINTK("HDCP port add failed\n");
		hdcp_i2c_drv_state = true;
	} else 
		hdcp_i2c_drv_state = false;

	mutex_unlock(mutex_for_i2c);
	/* for i2c probing */
	udelay(100);
#endif

	return 0;

drv_used:
	mutex_unlock(mutex_for_fo);
	return ret;
}
예제 #6
0
/*
 * ftn for video
 */
static int s5p_tv_v_open(struct file *file)
{
	int ret = 0,err;
	unsigned int status;
	ref_count_tv ++ ;
	mutex_lock(mutex_for_fo);

	if (s5ptv_status.tvout_output_enable) {
		mutex_unlock(mutex_for_fo);
		goto re_open;
		BASEPRINTK("tvout drv. already used !!\n");
		ret =  -EBUSY;
		goto drv_used;
	}

#ifdef CONFIG_CPU_S5PC110
	s5p_tv_clk_gate( true );
#endif
	
#ifdef CONFIG_CPU_S5PC110

#if defined(CONFIG_S5PC110_KEPLER_BOARD)//Kepler

	err = gpio_request(S5PC11X_GPJ4(4),"TV_EN");
	udelay(50);
	gpio_direction_output(S5PC11X_GPJ4(4),1);
	gpio_set_value(S5PC11X_GPJ4(4),1);
	udelay(50);

	err = gpio_request(S5PC11X_GPJ2(6),"EAR_SEL");
	udelay(50);
	gpio_direction_output(S5PC11X_GPJ2(6),0);
	gpio_set_value(S5PC11X_GPJ2(6),0);
	udelay(50);

#elif (defined CONFIG_S5PC110_T959_BOARD)//T959
	status=get_headset_status();
	printk("s5p_tv_v_open: get_headset_status:%d\n",status);
	
	if((SEC_HEADSET_3_POLE_DEVICE==status)||(SEC_TVOUT_DEVICE==status))
	{
		printk("EAR_SEL:Low\n");
		err = gpio_request(S5PC11X_GPJ2(6),"EAR_SEL"); //GPIO_EARPATH_SEL
		udelay(50);
		gpio_direction_output(S5PC11X_GPJ2(6),0);
		gpio_set_value(S5PC11X_GPJ2(6),0);
		udelay(50);
	}
	else if(SEC_HEADSET_4_POLE_DEVICE==status)
	{
		printk("EAR_SEL:High\n");
		err = gpio_request(S5PC11X_GPJ2(6),"EAR_SEL"); //GPIO_EARPATH_SEL
		udelay(50);
		gpio_direction_output(S5PC11X_GPJ2(6),0);
		gpio_set_value(S5PC11X_GPJ2(6),1);
		udelay(50);
	}

#endif

#endif

	_s5p_tv_if_init_param();

	s5p_tv_v4l2_init_param();

	mutex_unlock(mutex_for_fo);
	#if 0
	mutex_lock(mutex_for_i2c);
	/* for ddc(hdcp port) */
	if(s5ptv_status.hpd_status) {
		if (i2c_add_driver(&hdcp_i2c_driver)) 
			BASEPRINTK("HDCP port add failed\n");
		hdcp_i2c_drv_state = true;
	} else 
		hdcp_i2c_drv_state = false;

	mutex_unlock(mutex_for_i2c);
	#endif
	printk("\n\nTV open success\n\n");
re_open:
	/* for i2c probing */
	udelay(100);
	
	return 0;

drv_used:
	mutex_unlock(mutex_for_fo);
	return ret;
}