Esempio n. 1
0
/*
 *  Suspend
 */
int s5p_tv_suspend(struct platform_device *dev, pm_message_t state)
{
	/* video layer stop */
        if ( s5ptv_status.vp_layer_enable ) {
	//__s5p_vm_save_reg();
	_s5p_vlayer_stop();
                s5ptv_status.vp_layer_enable = true;
        }
        if ( s5ptv_status.grp_layer_enable[0] ) {
                _s5p_grp_stop(VM_GPR0_LAYER);
                s5ptv_status.grp_layer_enable[VM_GPR0_LAYER] = true;
        }
        if ( s5ptv_status.grp_layer_enable[1] ) {
                _s5p_grp_stop(VM_GPR1_LAYER);
                s5ptv_status.grp_layer_enable[VM_GPR0_LAYER] = true;
        }
        if ( s5ptv_status.tvout_output_enable ) {
	_s5p_tv_if_stop();
                s5ptv_status.tvout_output_enable = true;
                s5ptv_status.tvout_param_available = true;
        }
        s5p_tv_clk_gate( false );
        //tv_phy_power( false );

	return 0;
}
Esempio n. 2
0
int s5p_tv_v_release(struct file *filp)
{
	printk(KERN_INFO "%s", __func__);

#if defined(CONFIG_CPU_S5PV210) && defined(CONFIG_PM)
	if ((s5ptv_status.hpd_status) && !(s5ptv_status.suspend_status)) {
#endif
		if (s5ptv_status.vp_layer_enable)
			_s5p_vlayer_stop();
		if (s5ptv_status.tvout_output_enable)
			_s5p_tv_if_stop();
#if defined(CONFIG_CPU_S5PV210) && defined(CONFIG_PM)
	} else
		s5ptv_status.vp_layer_enable = false;
#endif
	s5ptv_status.hdcp_en = false;

	s5ptv_status.tvout_output_enable = false;

	/*
	 * drv. release
	 *        - just check drv. state reg. or not.
	 */
#ifdef I2C_BASE
	mutex_lock(mutex_for_i2c);

	if (hdcp_i2c_drv_state) {
		i2c_del_driver(&hdcp_i2c_driver);
		hdcp_i2c_drv_state = false;
	}

	mutex_unlock(mutex_for_i2c);
#endif

#ifdef CONFIG_CPU_S5PV210
#ifdef CONFIG_PM
	if ((s5ptv_status.hpd_status) && !(s5ptv_status.suspend_status)) {
#endif
//		s5p_tv_clk_gate(false);
/*		if (s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI || \
		s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI_RGB)
*/
//			tv_phy_power(false);
#ifdef CONFIG_CPU_FREQ_S5PV210
		if (s5ptv_status.hpd_status)
			s5pv210_set_cpufreq_level(NORMAL_TABLE);
#endif /* CONFIG_CPU_FREQ_S5PV210 */

#ifdef CONFIG_PM
	}
#endif
#endif

	s5p_tv_clk_gate(false);
	tv_phy_power(false);

	return 0;
}
Esempio n. 3
0
/*
 *  Suspend
 */
int s5p_tv_early_suspend(struct platform_device *dev, pm_message_t state)
{
    BASEPRINTK("(hpd_status = %d)++\n", s5ptv_status.hpd_status);

    mutex_lock(mutex_for_fo);
    s5ptv_status.suspend_status = true;

    if(!(s5ptv_status.hpd_status))
    {
	    mutex_unlock(mutex_for_fo);
	    return 0;
    }
    else
    {
	    /* video layer stop */
	    if ( s5ptv_status.vp_layer_enable ) {
		    _s5p_vlayer_stop();
		    s5ptv_status.vp_layer_enable = true;

	    }

	    /* grp0 layer stop */
	    if ( s5ptv_status.grp_layer_enable[0] ) {
		    _s5p_grp_stop(VM_GPR0_LAYER);
		    s5ptv_status.grp_layer_enable[VM_GPR0_LAYER] = true;
	    }

	    /* grp1 layer stop */
	    if ( s5ptv_status.grp_layer_enable[1] ) {
		    _s5p_grp_stop(VM_GPR1_LAYER);
		    s5ptv_status.grp_layer_enable[VM_GPR0_LAYER] = true;
	    }

	    if(s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI || s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI_RGB
			|| s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_DVI)
		    tv_phy_power( false );
	    
	   
	    /* tv off */
	    if ( s5ptv_status.tvout_output_enable ) {
		    _s5p_tv_if_stop();
		    s5ptv_status.tvout_output_enable = true;
		    s5ptv_status.tvout_param_available = true;
	    }

	    /* clk & power off */
	    s5p_tv_clk_gate( false );


#ifdef CONFIG_CPU_FREQ_S5PV210
	    s5pv210_set_cpufreq_level(NORMAL_TABLE);
#endif /* CONFIG_CPU_FREQ_S5PV210 */
    }

    mutex_unlock(mutex_for_fo);
    BASEPRINTK("()--\n");
    return 0;
}
Esempio n. 4
0
static int s5p_tv_release(struct file *file)
{
	s5ptv_status.hdcp_en = false;

	if ( s5ptv_status.tvout_output_enable )
		_s5p_tv_if_stop();
	
	return 0;
}
Esempio n. 5
0
/*
 *  Suspend
 */
int s5p_tv_early_suspend(struct platform_device *dev, pm_message_t state)
{
    BASEPRINTK("(hpd_status = %d)++\n", s5ptv_status.hpd_status);

    mutex_lock(mutex_for_fo);
    s5ptv_status.suspend_status = true;

    if(!(s5ptv_status.hpd_status))
    {
	    mutex_unlock(mutex_for_fo);
	    return 0;
    }
    else
    {
	    /* video layer stop */
	    if ( s5ptv_status.vp_layer_enable ) {
		    _s5p_vlayer_stop();
		    s5ptv_status.vp_layer_enable = true;

	    }

	    /* grp0 layer stop */
	    if ( s5ptv_status.grp_layer_enable[0] ) {
		    _s5p_grp_stop(VM_GPR0_LAYER);
		    s5ptv_status.grp_layer_enable[VM_GPR0_LAYER] = true;
	    }

	    /* grp1 layer stop */
	    if ( s5ptv_status.grp_layer_enable[1] ) {
		    _s5p_grp_stop(VM_GPR1_LAYER);
		    s5ptv_status.grp_layer_enable[VM_GPR0_LAYER] = true;
	    }

	    /* tv off */
	    if ( s5ptv_status.tvout_output_enable ) {
		    _s5p_tv_if_stop();
		    s5ptv_status.tvout_output_enable = true;
		    s5ptv_status.tvout_param_available = true;
	    }

#ifdef CONFIG_PM_PWR_GATING
	    /* clk & power off */
	    s5p_tv_clk_gate( false );
	    if(s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI || s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI_RGB)
		    tv_phy_power( false );
#endif
#if 0
#ifdef CONFIG_CPU_FREQ
	    s5pc110_unlock_dvfs_high_level(DVFS_LOCK_TOKEN_4);
#endif
#endif    
    }

    mutex_unlock(mutex_for_fo);
    BASEPRINTK("()--\n");
    return 0;
}
Esempio n. 6
0
int s5p_tv_v_release(struct file *filp)
{
#if defined(CONFIG_CPU_S5PV210) && defined(CONFIG_PM_PWR_GATING)
	if((s5ptv_status.hpd_status) && !(s5ptv_status.suspend_status))
	{
#endif
		if(s5ptv_status.vp_layer_enable)
			_s5p_vlayer_stop();
		if(s5ptv_status.tvout_output_enable)
			_s5p_tv_if_stop();
#if defined(CONFIG_CPU_S5PV210) && defined(CONFIG_PM_PWR_GATING)
	}else
		s5ptv_status.vp_layer_enable = false;
#endif 

	s5ptv_status.hdcp_en = false;

	s5ptv_status.tvout_output_enable = false;

	/* 
	 * drv. release
	 *        - just check drv. state reg. or not.
	 */
#ifdef I2C_BASE	 
	mutex_lock(mutex_for_i2c);

	if (hdcp_i2c_drv_state) {
		i2c_del_driver(&hdcp_i2c_driver);
		hdcp_i2c_drv_state = false;
	}

	mutex_unlock(mutex_for_i2c);
#endif

#ifdef CONFIG_CPU_S5PV210
#ifdef CONFIG_PM_PWR_GATING
	if((s5ptv_status.hpd_status) && !(s5ptv_status.suspend_status))
	{
#endif
		s5p_tv_clk_gate(false);
		tv_phy_power( false );
#if 0
#ifdef CONFIG_CPU_FREQ
		if(s5ptv_status.hpd_status)
			s5pc110_unlock_dvfs_high_level(DVFS_LOCK_TOKEN_4);
#endif
#endif    
#ifdef CONFIG_PM_PWR_GATING
	}
#endif
#endif

	return 0;
}
Esempio n. 7
0
static int s5p_tv_open(struct file *file)
{
	/* 
	 * for first open 
	 * when boot up time this parameter is set.
	 */
	if ( s5ptv_status.tvout_output_enable )
		_s5p_tv_if_stop();

	return 0;	
}
Esempio n. 8
0
/*
 *  Suspend
 */
void s5p_tv_early_suspend(struct early_suspend *h)
{
	BASEPRINTK("%s----------------start \n", __func__);

	mutex_lock(mutex_for_fo);
	s5ptv_status.suspend_status = true;

	if (!(s5ptv_status.hpd_status)) {
		printk(KERN_INFO "(hpd_status = %d)++\n", \
				s5ptv_status.hpd_status);
		mutex_unlock(mutex_for_fo);
		return ;
	} else  {
		/* video layer stop */
		if (s5ptv_status.vp_layer_enable) {
			_s5p_vlayer_stop();
			s5ptv_status.vp_layer_enable = true;
		}

		/* grp0 layer stop */
		if (s5ptv_status.grp_layer_enable[0]) {
			_s5p_grp_stop(VM_GPR0_LAYER);
			s5ptv_status.grp_layer_enable[VM_GPR0_LAYER] = true;
		}

		/* grp1 layer stop */
		if (s5ptv_status.grp_layer_enable[1]) {
			_s5p_grp_stop(VM_GPR1_LAYER);
			s5ptv_status.grp_layer_enable[VM_GPR0_LAYER] = true;
		}

		/* tv off */
		if (s5ptv_status.tvout_output_enable) {
			_s5p_tv_if_stop();
			s5ptv_status.tvout_output_enable = true;
			s5ptv_status.tvout_param_available = true;
		}

		/* clk & power off */
		s5p_tv_clk_gate(false);
		if ((s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI) ||\
		(s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI_RGB))
			tv_phy_power(false);

#ifdef CONFIG_CPU_FREQ_S5PV210
		s5pv210_set_cpufreq_level(NORMAL_TABLE);
#endif /* CONFIG_CPU_FREQ_S5PV210 */
	}

	mutex_unlock(mutex_for_fo);
	BASEPRINTK("()--\n");
	return ;
}
Esempio n. 9
0
static int s5ptvfb_release(struct fb_info *fb, int user)
{
/*
 * Following block is deleted for enabling multiple open of TV frame buffer
 *
 *	struct s5ptvfb_window *win = fb->par;
 */
	int ret;
	struct s5ptvfb_window *win = fb->par;

	s5ptvfb_release_window(fb);

/*
 * Following block is deleted for enabling multiple open of TV frame buffer
 *
 *	mutex_lock(&s5ptv_status.fb_lock);
 *	atomic_dec(&win->in_use);
 *	mutex_unlock(&s5ptv_status.fb_lock);
 */

	_s5p_vlayer_stop();
	_s5p_tv_if_stop();

	s5ptv_status.hdcp_en = false;

	s5ptv_status.tvout_output_enable = false;

	/*
	* drv. release
	*        - just check drv. state reg. or not.
	*/

	ret = s5p_tv_clk_gate(false);
	if (ret < 0) {
		printk(KERN_ERR "[Error]Cannot release\n");
		return -1;
	}
	tv_phy_power(false);

	mutex_lock(&s5ptv_status.fb_lock);
	atomic_dec(&win->in_use);
	mutex_unlock(&s5ptv_status.fb_lock);

	return 0;
}
Esempio n. 10
0
int s5p_tv_v_release(struct file *filp)
{
#if 1 
	ref_count_tv -- ;

   if(ref_count_tv <= 0)
    {

	_s5p_vlayer_stop();
	_s5p_tv_if_stop();

	s5ptv_status.hdcp_en = false;

	s5ptv_status.tvout_output_enable = false;

	/* 
	 * drv. release
	 *        - just check drv. state reg. or not.
	 */
	mutex_lock(mutex_for_i2c);
	
	if (hdcp_i2c_drv_state) {
		i2c_del_driver(&hdcp_i2c_driver);
		hdcp_i2c_drv_state = false;
	}

	mutex_unlock(mutex_for_i2c);
	
	#ifdef CONFIG_CPU_S5PC110
	s5p_tv_clk_gate(false);
	//tv_phy_power( false );
	#endif
    }


#endif

	return 0;
}
Esempio n. 11
0
void s5p_handle_cable(void)
{
    char env_buf[120];
    char *envp[2];
    int env_offset = 0;

	#if 0
    if(s5ptv_status.tvout_param.out_mode != TVOUT_OUTPUT_HDMI && s5ptv_status.tvout_param.out_mode != TVOUT_OUTPUT_HDMI_RGB)
        return;
#endif
   int previous_hpd_status = s5ptv_status.hpd_status;
#ifdef CONFIG_HDMI_HPD
    if (s5p_hpd_get_state()) {
        s5ptv_status.hpd_status = 1;
        set_irq_type(IRQ_EINT13, IRQ_TYPE_EDGE_FALLING);
        if (suspend_resume_sync == 2)
            suspend_resume_sync = 0;

    } else {
        s5ptv_status.hpd_status = 0;
        set_irq_type(IRQ_EINT13, IRQ_TYPE_EDGE_RISING); 
    }

//    s5ptv_status.hpd_status= gpio_get_value(S5PV210_GPH1(5));
#else
    return;
#endif
    printk(KERN_INFO "HDMI handle_cable previous status is %d and current status is %d\n",previous_hpd_status,s5ptv_status.hpd_status);
    
    memset(env_buf, 0, sizeof(env_buf));

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

    if(s5ptv_status.hpd_status)
    {
        TVout_LDO_ctrl(true);
        BASEPRINTK("\n hdmi cable is connected \n");
		sprintf(env_buf, "HDMI_STATE=online");
		envp[env_offset++] = env_buf;
		envp[env_offset] = NULL;
		kobject_uevent_env(&(s5p_tvout[0].dev.kobj), KOBJ_CHANGE, envp);
        
        if(s5ptv_status.suspend_status)
        {
		    printk("[TVOUT]hdmi cable is connected Before Suspend \n");
            return;
        }
#ifdef CONFIG_CPU_FREQ_S5PV210
        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
    #if 0
        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 );
    #endif
    #endif
        /* tv on */
        if ( s5ptv_status.tvout_output_enable )
                _s5p_tv_if_start();

        /* video layer start */
        if ( s5ptv_status.vp_layer_enable )
                _s5p_vlayer_start();

        /* grp0 layer start */
        if ( s5ptv_status.grp_layer_enable[0] )
                _s5p_grp_start(VM_GPR0_LAYER);

        /* grp1 layer start */
        if ( s5ptv_status.grp_layer_enable[1] )
                _s5p_grp_start(VM_GPR1_LAYER);
		
		
		printk("[TVOUT]hdmi cable is connected\n");
    }
    else{
		
        BASEPRINTK("\n hdmi cable is disconnected \n");

	#if 1
        if(s5ptv_status.suspend_status || suspend_resume_sync == 2)
        {
			//if(gpio_get_value(GPIO_ACCESSORY_INT))
			{
				s5p_tv_clk_gate( true );
				tv_phy_power( true );
			}
 			//else
            //	return;
        }
	#endif 
//    if (!s5ptv_status.suspend_status) {
    if (suspend_resume_sync == 0) {
        if ( s5ptv_status.vp_layer_enable ) {
            _s5p_vlayer_stop();
            s5ptv_status.vp_layer_enable = true;

        }

        /* grp0 layer stop */
        if ( s5ptv_status.grp_layer_enable[0] ) {
            _s5p_grp_stop(VM_GPR0_LAYER);
            s5ptv_status.grp_layer_enable[VM_GPR0_LAYER] = true;
        }

        /* grp1 layer stop */
        if ( s5ptv_status.grp_layer_enable[1] ) {
            _s5p_grp_stop(VM_GPR1_LAYER);
            s5ptv_status.grp_layer_enable[VM_GPR0_LAYER] = true;
        }

        /* tv off */
        if ( s5ptv_status.tvout_output_enable ) {
            _s5p_tv_if_stop();
            s5ptv_status.tvout_output_enable = false;
            s5ptv_status.tvout_param_available = false;
        }

    #ifdef CONFIG_PM
        /* clk & power off */
        s5p_tv_clk_gate( false );
  //if(s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI || s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI_RGB)
    //    tv_phy_power( false );
    #endif
    }

		sprintf(env_buf, "HDMI_STATE=offline");
		envp[env_offset++] = env_buf;
		envp[env_offset] = NULL;
		kobject_uevent_env(&(s5p_tvout[0].dev.kobj), KOBJ_CHANGE, envp);
		printk("[TVOUT]hdmi cable is disconnected\n");

#ifdef CONFIG_CPU_FREQ_S5PV210
    if (suspend_resume_sync == 0)
        s5pv210_set_cpufreq_level(NORMAL_TABLE);
#endif /* CONFIG_CPU_FREQ_S5PV210 */
    }
}
Esempio n. 12
0
/*
 *  Suspend
 */
int s5p_tv_early_suspend(struct platform_device *dev, pm_message_t state)
{
    BASEPRINTK("(hpd_status = %d)++\n", s5ptv_status.hpd_status);

    mutex_lock(mutex_for_fo);
    s5ptv_status.suspend_status = true;
    suspend_resume_sync = 1;
    printk(KERN_INFO "s5p_tv_early suspend executing..\n");
#ifdef CABLE_CHECK
          //s5p_hpd_set_state(HPD_SLEEP);
    if (s5p_hpd_get_state()) {
        hpd_sleep_state = 0;
        set_irq_type(IRQ_EINT13, IRQ_TYPE_EDGE_FALLING);
    } else {
        hpd_sleep_state = 1;
        set_irq_type(IRQ_EINT13, IRQ_TYPE_EDGE_RISING);
    }
#endif
    if(!(s5ptv_status.hpd_status))
    {
        printk(KERN_INFO "s5p_tv_early_suspend returned no HDMI connected\n");
	    mutex_unlock(mutex_for_fo);
        return 0;
    }
    else
    {
                 IsPower_on = false;
                 TVout_LDO_ctrl(true);
	    /* video layer stop */
	    if ( s5ptv_status.vp_layer_enable ) {
		    _s5p_vlayer_stop();
		    s5ptv_status.vp_layer_enable = true;

	    }

	    /* grp0 layer stop */
	    if ( s5ptv_status.grp_layer_enable[0] ) {
		    _s5p_grp_stop(VM_GPR0_LAYER);
		    s5ptv_status.grp_layer_enable[VM_GPR0_LAYER] = true;
	    }

	    /* grp1 layer stop */
	    if ( s5ptv_status.grp_layer_enable[1] ) {
		    _s5p_grp_stop(VM_GPR1_LAYER);
		    s5ptv_status.grp_layer_enable[VM_GPR0_LAYER] = true;
	    }

	    if(s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI || s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI_RGB
			|| s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_DVI)
		    tv_phy_power( false );
	    
	   
	    /* tv off */
	    if ( s5ptv_status.tvout_output_enable ) {
		    _s5p_tv_if_stop();
		    s5ptv_status.tvout_output_enable = true;
		    s5ptv_status.tvout_param_available = true;
	    }

	    /* clk & power off */
	    s5p_tv_clk_gate( false );


#ifdef CONFIG_CPU_FREQ_S5PV210
	    s5pv210_set_cpufreq_level(NORMAL_TABLE);
#endif /* CONFIG_CPU_FREQ_S5PV210 */
    }

    mutex_unlock(mutex_for_fo);
    BASEPRINTK("()--\n");
    return 0;
}
Esempio n. 13
0
bool _s5p_tv_if_start(void)
{
	s5p_tv_status *st = &s5ptv_status;
	s5p_tv_clk_err cerr = HDMI_NO_ERROR;

	s5p_tv_o_mode out_mode = st->tvout_param.out_mode;

	__s5p_vm_set_underflow_interrupt_enable(VM_VIDEO_LAYER, 
		false);
	__s5p_vm_set_underflow_interrupt_enable(VM_GPR0_LAYER, 
		false);
	__s5p_vm_set_underflow_interrupt_enable(VM_GPR1_LAYER, 
		false);

	_s5p_tv_if_stop();

	if (st->vp_layer_enable) 
	{
		_s5p_vlayer_stop();
		// In order to start video layer on the s5p_tv_resume() or handle_calbe() function
		st->vp_layer_enable = true; 
	}

	// Clear All Interrupt Pending
	__s5p_vm_clear_pend_all();
	

	/*
	* have not to call 
	* another request function simultaneously
	*/
#ifdef CONFIG_CPU_S5PC100

	s5p_tv_disp_mode disp_mode = st->tvout_param.disp_mode;

	if (!__s5p_tv_power_get_power_status()) { 
		__s5p_tv_poweron();
	}
#endif
#ifdef CONFIG_CPU_S5PV210
        // move to tv_phy_power()
	//__s5p_tv_poweron();
#endif
	__s5p_tv_clk_set_vmixer_hclk_onoff(true);
	__s5p_tv_clk_set_vmixer_sclk_onoff(true);

	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:
		__s5p_tv_clk_init_video_mixer(TVOUT_CLK_VMIXER_SRCCLK_VCLK_54);
		__s5p_tv_clk_set_sdout_hclk_onoff(true);
		__s5p_tv_clk_set_sdout_sclk_onoff(true);
		__s5p_tv_clk_set_hdmi_hclk_onoff(false);
		__s5p_tv_clk_set_hdmi_sclk_onoff(false);
#ifdef CONFIG_CPU_S5PC100
		__s5p_tv_clk_init_hpll(0xffff, 96, 6, 3);
#endif
#ifdef CONFIG_CPU_S5PV210
		__s5p_tv_clk_init_hpll(0, 0xffff, 108, 6, 3);
#endif		
		break;

	case TVOUT_OUTPUT_HDMI:
	case TVOUT_OUTPUT_HDMI_RGB:		
	case TVOUT_OUTPUT_DVI:
		__s5p_tv_clk_init_video_mixer(TVOUT_CLK_VMIXER_SRCCLK_MOUT_HPLL);
		__s5p_tv_clk_set_sdout_hclk_onoff(false);
		__s5p_tv_clk_set_sdout_sclk_onoff(false);
		__s5p_tv_clk_set_hdmi_hclk_onoff(true);
		__s5p_tv_clk_set_hdmi_sclk_onoff(true);


		cerr = __s5p_tv_clk_init_href(S5P_TV_CLK_HPLL_REF_27M);

		if (cerr != S5P_TV_CLK_ERR_NO_ERROR) {
			return false;
		}

		cerr = __s5p_tv_clk_init_mout_hpll(S5P_TV_CLK_MOUT_HPLL_FOUT_HPLL);

		if (cerr != S5P_TV_CLK_ERR_NO_ERROR) {
			return false;
		}

#ifdef CONFIG_CPU_S5PC100

		__s5p_tv_clk_init_hdmi_ratio(2);

		switch (disp_mode) {

		case TVOUT_480P_60_16_9:

		case TVOUT_480P_60_4_3:

		case TVOUT_576P_50_16_9:

		case TVOUT_576P_50_4_3:
			__s5p_tv_clk_init_hpll(0xffff, 96, 6, 3);
			break;

	
		case TVOUT_720P_50:

		case TVOUT_720P_60:
			__s5p_tv_clk_init_hpll(0xffff, 132, 6, 2);
			break;

		default:
			_s5p_tv_if_stop();
			TVOUTIFPRINTK("invalid out_mode parameter(%d)\n\r",
					out_mode);
			st->tvout_param_available = false;
			return false;
			break;
		}
#endif 

#ifdef CONFIG_CPU_S5PV210

		__s5p_tv_clk_init_hdmi_ratio(0);
#endif		
		
		__s5p_tv_clk_hpll_onoff(true);

#ifdef CONFIG_CPU_S5PC100
		__s5p_tv_poweroff();
		__s5p_tv_poweron();
#endif
		break;

	default:
		_s5p_tv_if_stop();
		TVOUTIFPRINTK("invalid out_mode parameter(%d)\n\r", 
			st->tvout_param.out_mode);
		st->tvout_param_available = false;
		return false;
		break;
	}

	if (!_s5p_tv_if_init_vm_reg()) {
		return false;
	}

	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 (!_s5p_tv_if_init_sd_reg()) {
			return false;
		}

		break;

	case TVOUT_OUTPUT_DVI:
		st->hdmi_audio_type = HDMI_AUDIO_NO;
		
	case TVOUT_OUTPUT_HDMI:
	case TVOUT_OUTPUT_HDMI_RGB:		
		if (!_s5p_tv_if_init_hd_reg()) {
			return false;
		}

		break;

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

	st->tvout_output_enable = true;

	__s5p_vm_set_underflow_interrupt_enable(VM_VIDEO_LAYER, 
		true);
	__s5p_vm_set_underflow_interrupt_enable(VM_GPR0_LAYER, 
		true);
	__s5p_vm_set_underflow_interrupt_enable(VM_GPR1_LAYER, 
		true);

	// Clear All Interrupt Pending
	__s5p_vm_clear_pend_all();

	TVOUTIFPRINTK("()\n\r");

	return true;
}
Esempio n. 14
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;
}
bool _s5p_tv_if_start(void)
{
	struct s5p_tv_status *st = &s5ptv_status;


	enum s5p_tv_o_mode out_mode = st->tvout_param.out_mode;

	__s5p_vm_set_underflow_interrupt_enable(VM_VIDEO_LAYER,
		false);
	__s5p_vm_set_underflow_interrupt_enable(VM_GPR0_LAYER,
		false);
	__s5p_vm_set_underflow_interrupt_enable(VM_GPR1_LAYER,
		false);

	_s5p_tv_if_stop();

	if (st->vp_layer_enable) 
	{
		_s5p_vlayer_stop();
		// In order to start video layer on the s5p_tv_resume() or handle_calbe() function
		st->vp_layer_enable = true; 
	}

	// Clear All Interrupt Pending
	__s5p_vm_clear_pend_all();


	/*
	* have not to call
	* another request function simultaneously
	*/
#ifdef CONFIG_CPU_S5PV210
        // move to tv_phy_power()
	//__s5p_tv_poweron();
#endif

	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:


#ifdef CONFIG_CPU_S5PV210
		clk_set_parent(st->sclk_mixer, st->sclk_dac);
#endif
		break;

	case TVOUT_OUTPUT_HDMI:
	case TVOUT_OUTPUT_HDMI_RGB:
	case TVOUT_OUTPUT_DVI:


#ifdef CONFIG_CPU_S5PV210
		clk_set_parent(st->sclk_mixer, st->sclk_hdmi);
		clk_set_parent(st->sclk_hdmi, st->sclk_hdmiphy);
#endif

		break;

	default:
		_s5p_tv_if_stop();
		TVOUTIFPRINTK("invalid out_mode parameter(%d)\n\r",
			st->tvout_param.out_mode);
		st->tvout_param_available = false;
		return false;
		break;
	}

	if (!_s5p_tv_if_init_vm_reg())
		return false;


	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 (!_s5p_tv_if_init_sd_reg())
			return false;


		break;

	case TVOUT_OUTPUT_DVI:
		st->hdmi_audio_type = HDMI_AUDIO_NO;

	case TVOUT_OUTPUT_HDMI:
	case TVOUT_OUTPUT_HDMI_RGB:
		if (!_s5p_tv_if_init_hd_reg())
			return false;
		if (s5ptv_status.hdcp_en)
		{
			__s5p_start_hdcp();
		}
		break;

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

	st->tvout_output_enable = true;

	__s5p_vm_set_underflow_interrupt_enable(VM_VIDEO_LAYER,
		true);
	__s5p_vm_set_underflow_interrupt_enable(VM_GPR0_LAYER,
		true);
	__s5p_vm_set_underflow_interrupt_enable(VM_GPR1_LAYER,
		true);

	/* Clear All Interrupt Pending */
	__s5p_vm_clear_pend_all();

	TVOUTIFPRINTK("()\n\r");

	return true;
}
Esempio n. 16
0
int s5p_tv_v_release(struct file *filp)
{
	TVout_LDO_ctrl(true);
#if defined(CONFIG_CPU_S5PV210) && defined(CONFIG_PM)
/*
	if(s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI || s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI_RGB
			|| s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_DVI)
				tv_phy_power( false );
*/

	if((s5ptv_status.hpd_status) && !(s5ptv_status.suspend_status))
	{
#endif
		if (s5ptv_status.vp_layer_enable)
			_s5p_vlayer_stop();
		if (s5ptv_status.tvout_output_enable)
			_s5p_tv_if_stop();
#if defined(CONFIG_CPU_S5PV210) && defined(CONFIG_PM)
	} else
		s5ptv_status.vp_layer_enable = false;
#endif

	s5ptv_status.hdcp_en = false;

	s5ptv_status.tvout_output_enable = false;

	/*
	 * drv. release
	 *        - just check drv. state reg. or not.
	 */
#ifdef I2C_BASE
	mutex_lock(mutex_for_i2c);

	if (hdcp_i2c_drv_state) {
		i2c_del_driver(&hdcp_i2c_driver);
		hdcp_i2c_drv_state = false;
	}

	mutex_unlock(mutex_for_i2c);
#endif

	s5p_tv_clk_gate(false);

#ifdef CONFIG_CPU_S5PV210
#ifdef CONFIG_PM
	if((s5ptv_status.hpd_status) && !(s5ptv_status.suspend_status))
	{
#endif

#ifdef CONFIG_CPU_FREQ_S5PV210
		if (s5ptv_status.hpd_status)
			s5pv210_set_cpufreq_level(NORMAL_TABLE);
#endif /* CONFIG_CPU_FREQ_S5PV210 */

#ifdef CONFIG_PM
	}
#endif
#endif

	Isdrv_open = 0;
	if(s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI || s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI_RGB
			|| s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_DVI)
				tv_phy_power( false );
	s5p_tv_clk_gate(false);
	TVout_LDO_ctrl(false);
	printk("[TVOUT]s5p_tv_v_release --\n");
	return 0;
}
Esempio n. 17
0
void s5p_handle_cable(void)
{
    char env_buf[120];
    char *envp[2];
    int env_offset = 0;

	#if 0
    if(s5ptv_status.tvout_param.out_mode != TVOUT_OUTPUT_HDMI && s5ptv_status.tvout_param.out_mode != TVOUT_OUTPUT_HDMI_RGB)
        return;
#endif

    bool previous_hpd_status = s5ptv_status.hpd_status;
#ifdef CONFIG_HDMI_HPD
    s5ptv_status.hpd_status= s5p_hpd_get_state();
#else
    return;
#endif
    
    memset(env_buf, 0, sizeof(env_buf));

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

    if(s5ptv_status.hpd_status)
    {
    	
        BASEPRINTK("\n hdmi cable is connected \n");
		sprintf(env_buf, "HDMI_STATE=online");
		envp[env_offset++] = env_buf;
		envp[env_offset] = NULL;
		kobject_uevent_env(&(s5p_tvout[0].dev.kobj), KOBJ_CHANGE, envp);
        
        if(s5ptv_status.suspend_status)
            return;

#ifdef CONFIG_CPU_FREQ_S5PV210
        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
    #if 0
        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 );
    #endif
    #endif
        /* tv on */
        if ( s5ptv_status.tvout_output_enable )
                _s5p_tv_if_start();

        /* video layer start */
        if ( s5ptv_status.vp_layer_enable )
                _s5p_vlayer_start();

        /* grp0 layer start */
        if ( s5ptv_status.grp_layer_enable[0] )
                _s5p_grp_start(VM_GPR0_LAYER);

        /* grp1 layer start */
        if ( s5ptv_status.grp_layer_enable[1] )
                _s5p_grp_start(VM_GPR1_LAYER);
		
		
		printk("[TVOUT]hdmi cable is connected\n");
    }
    else{
		
        BASEPRINTK("\n hdmi cable is disconnected \n");

	#if 1
        if(s5ptv_status.suspend_status)
        {
			//if(gpio_get_value(GPIO_ACCESSORY_INT))
			{
				s5p_tv_clk_gate( true );
				tv_phy_power( true );
			}
 			//else
            //	return;
        }
	#endif 
        if ( s5ptv_status.vp_layer_enable ) {
            _s5p_vlayer_stop();
            s5ptv_status.vp_layer_enable = true;

        }

        /* grp0 layer stop */
        if ( s5ptv_status.grp_layer_enable[0] ) {
            _s5p_grp_stop(VM_GPR0_LAYER);
            s5ptv_status.grp_layer_enable[VM_GPR0_LAYER] = true;
        }

        /* grp1 layer stop */
        if ( s5ptv_status.grp_layer_enable[1] ) {
            _s5p_grp_stop(VM_GPR1_LAYER);
            s5ptv_status.grp_layer_enable[VM_GPR0_LAYER] = true;
        }

        /* tv off */
        if ( s5ptv_status.tvout_output_enable ) {
            _s5p_tv_if_stop();
            s5ptv_status.tvout_output_enable = false;
            s5ptv_status.tvout_param_available = false;
        }

    #ifdef CONFIG_PM
        /* clk & power off */
        s5p_tv_clk_gate( false );
  //if(s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI || s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI_RGB)
    //    tv_phy_power( false );
    #endif

		sprintf(env_buf, "HDMI_STATE=offline");
		envp[env_offset++] = env_buf;
		envp[env_offset] = NULL;
		kobject_uevent_env(&(s5p_tvout[0].dev.kobj), KOBJ_CHANGE, envp);
		printk("[TVOUT]hdmi cable is disconnected\n");

#ifdef CONFIG_CPU_FREQ_S5PV210
        s5pv210_set_cpufreq_level(NORMAL_TABLE);
#endif /* CONFIG_CPU_FREQ_S5PV210 */
    }
}
Esempio n. 18
0
void s5p_handle_cable(void)
{
    char env_buf[120];
    char *envp[2];
    int env_offset = 0;

#if defined (CONFIG_S5PC110_DEMPSEY_BOARD)				//MHL v1 //NAGSM_Android_SEL_Kernel_Aakash_20101130

#else
    if(s5ptv_status.tvout_param.out_mode != TVOUT_OUTPUT_HDMI && s5ptv_status.tvout_param.out_mode != TVOUT_OUTPUT_HDMI_RGB)
        return;
#endif

    bool previous_hpd_status = s5ptv_status.hpd_status;
#ifdef CONFIG_HDMI_HPD
    s5ptv_status.hpd_status= s5p_hpd_get_state();
#else
    return;
#endif
    
    memset(env_buf, 0, sizeof(env_buf));

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

    if(s5ptv_status.hpd_status)
    {
        BASEPRINTK("\n hdmi cable is connected \n");			
        if(s5ptv_status.suspend_status)
            return;

#if 0
    #ifdef CONFIG_CPU_FREQ
    #ifdef CONFIG_CPU_MAX_FREQ_1GHZ // 2010.3.9.
        s5pc110_lock_dvfs_high_level(DVFS_LOCK_TOKEN_4, 3);
    #else
        s5pc110_lock_dvfs_high_level(DVFS_LOCK_TOKEN_4, 2);    
    #endif
    #endif
#endif

    #ifdef CONFIG_PM_PWR_GATING
        s5p_tv_clk_gate( true );
        tv_phy_power( true );
    #endif
        /* tv on */
        if ( s5ptv_status.tvout_output_enable )
                _s5p_tv_if_start();

        /* video layer start */
        if ( s5ptv_status.vp_layer_enable )
                _s5p_vlayer_start();

        /* grp0 layer start */
        if ( s5ptv_status.grp_layer_enable[0] )
                _s5p_grp_start(VM_GPR0_LAYER);

        /* grp1 layer start */
        if ( s5ptv_status.grp_layer_enable[1] )
                _s5p_grp_start(VM_GPR1_LAYER);

        sprintf(env_buf, "HDMI_STATE=online");
        envp[env_offset++] = env_buf;
        envp[env_offset] = NULL;
        kobject_uevent_env(&(s5p_tvout[0].dev.kobj), KOBJ_CHANGE, envp);
    }
    else{
        BASEPRINTK("\n hdmi cable is disconnected \n");
        
        if(s5ptv_status.suspend_status)
            return;

        sprintf(env_buf, "HDMI_STATE=offline");
        envp[env_offset++] = env_buf;
        envp[env_offset] = NULL;
        kobject_uevent_env(&(s5p_tvout[0].dev.kobj), KOBJ_CHANGE, envp);

        if ( s5ptv_status.vp_layer_enable ) {
            _s5p_vlayer_stop();
            s5ptv_status.vp_layer_enable = true;

        }

        /* grp0 layer stop */
        if ( s5ptv_status.grp_layer_enable[0] ) {
            _s5p_grp_stop(VM_GPR0_LAYER);
            s5ptv_status.grp_layer_enable[VM_GPR0_LAYER] = true;
        }

        /* grp1 layer stop */
        if ( s5ptv_status.grp_layer_enable[1] ) {
            _s5p_grp_stop(VM_GPR1_LAYER);
            s5ptv_status.grp_layer_enable[VM_GPR0_LAYER] = true;
        }

        /* tv off */
        if ( s5ptv_status.tvout_output_enable ) {
            _s5p_tv_if_stop();
            s5ptv_status.tvout_output_enable = true;
            s5ptv_status.tvout_param_available = true;
        }

    #ifdef CONFIG_PM_PWR_GATING
        /* clk & power off */
        s5p_tv_clk_gate( false );
        tv_phy_power( false );
    #endif

#if 0
    #ifdef CONFIG_CPU_FREQ
        s5pc110_unlock_dvfs_high_level(DVFS_LOCK_TOKEN_4);
    #endif
#endif    
    }
        
}