Exemplo n.º 1
0
int s5p_hpd_set_eint(void)
{
	/* HDMI -> EINT */
	atomic_set(&hdmi_status, HDMI_OFF);

	s5p_hdmi_clear_pending(HDMI_IRQ_HPD_PLUG);
	s5p_hdmi_clear_pending(HDMI_IRQ_HPD_UNPLUG);

	s5p_hdmi_disable_interrupts(HDMI_IRQ_HPD_PLUG);
	s5p_hdmi_disable_interrupts(HDMI_IRQ_HPD_UNPLUG);

	s3c_gpio_cfgpin(S5PV210_GPH1(5), S5PV210_GPH1_5_EXT_INT31_5);
	s3c_gpio_setpull(S5PV210_GPH1(5), S3C_GPIO_PULL_DOWN);
	if (s5p_hpd_get_state())
		set_irq_type(IRQ_EINT13, IRQ_TYPE_EDGE_FALLING);
	else
		set_irq_type(IRQ_EINT13, IRQ_TYPE_EDGE_RISING);
	
	s3c_gpio_set_drvstrength(S5PV210_GPH1(5), S3C_GPIO_DRVSTR_4X);
	
	printk("\n++ s5p_hpd_set_eint\n"); 
	return 0;
}
Exemplo n.º 2
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 */
    }
}
Exemplo n.º 3
0
static int __devinit s5p_tv_probe(struct platform_device *pdev)
{
	int 	irq_num;
	int 	ret;
	int 	i,retval;

	s5ptv_status.dev_fb = &pdev->dev;

	//enable power	
	max8998_ldo3_8_control(1,LDO_TV_OUT); //ldo 3,8 on
	printk("%s: LDO3_8 is enabled by TV \n", __func__);

	__s5p_sdout_probe(pdev, 0);
	__s5p_vp_probe(pdev, 1);
	__s5p_mixer_probe(pdev, 2);

#ifdef CONFIG_CPU_S5PC100
	__s5p_hdmi_probe(pdev, 3);
	__s5p_tvclk_probe(pdev, 4);
#endif


#ifdef CONFIG_CPU_S5PV210
	tv_clk_get(pdev, &s5ptv_status);
	s5p_tv_clk_gate( true );
#endif
#ifdef CONFIG_CPU_S5PV210	
	__s5p_hdmi_probe(pdev, 3, 4);
	__s5p_hdcp_init( );
#endif		

#ifdef FIX_27M_UNSTABLE_ISSUE /* for smdkc100 pop */
	writel(0x1, S5PC1XX_GPA0_BASE + 0x56c);
#endif

#ifdef I2C_BASE
	/* for dev_dbg err. */
	spin_lock_init(&slock_hpd);

	/* for bh */
	INIT_WORK(&ws_hpd, (void *)set_ddc_port);
#endif
	/* check EINT init state */

#ifdef CONFIG_CPU_S5PC100
	s3c_gpio_cfgpin(S5PC1XX_GPH0(5), S3C_GPIO_SFN(2));
	s3c_gpio_setpull(S5PC1XX_GPH0(5), S3C_GPIO_PULL_UP);

	s5ptv_status.hpd_status = gpio_get_value(S5PC1XX_GPH0(5)) 
		? false:true;
#endif

#ifdef CONFIG_CPU_S5PV210
#ifdef CONFIG_HDMI_HPD
	if(0 == gpio_get_value(GPIO_ACCESSORY_INT))  //docking station attached
    s5ptv_status.hpd_status= s5p_hpd_get_state();
	else 
		s5ptv_status.hpd_status= 0;
#else
    s5ptv_status.hpd_status= 0;
#endif    
#endif
	dev_info(&pdev->dev, "hpd status is cable %s\n", 
		s5ptv_status.hpd_status ? "inserted":"removed");


	/* interrupt */
	TVOUT_IRQ_INIT(irq_num, ret, pdev, 0, out, __s5p_mixer_irq, "mixer");
	TVOUT_IRQ_INIT(irq_num, ret, pdev, 1, out_hdmi_irq, __s5p_hdmi_irq , "hdmi");
	TVOUT_IRQ_INIT(irq_num, ret, pdev, 2, out_tvenc_irq, s5p_tvenc_irq, "tvenc");
	
#ifdef CONFIG_CPU_S5PC100	
	TVOUT_IRQ_INIT(irq_num, ret, pdev, 3, out_hpd_irq, __s5p_hpd_irq, "hpd");
	set_irq_type(IRQ_EINT5, IRQ_TYPE_LEVEL_LOW);
#endif


	/* v4l2 video device registration */
	for (i = 0; i < S5P_TVMAX_CTRLS; i++) {
		s5ptv_status.video_dev[i] = &s5p_tvout[i];

		if (video_register_device(s5ptv_status.video_dev[i],
				VFL_TYPE_GRABBER, s5p_tvout[i].minor) != 0) {

			dev_err(&pdev->dev,
				"Couldn't register tvout driver.\n");
			return 0;
		}
	}


#ifdef CONFIG_TV_FB
	mutex_init(&s5ptv_status.fb_lock);

	/* for default start up */
	_s5p_tv_if_init_param();

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

#ifndef CONFIG_USER_ALLOC_TVOUT
	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
		|| s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_DVI)
	tv_phy_power(true);
	_s5p_tv_if_set_disp();
#endif

	s5ptvfb_set_lcd_info(&s5ptv_status);

	/* prepare memory */
	if (s5ptvfb_alloc_framebuffer())
		goto err_alloc;

	if (s5ptvfb_register_framebuffer())
		goto err_alloc;
#ifndef CONFIG_USER_ALLOC_TVOUT
	s5ptvfb_display_on(&s5ptv_status);
#endif
#endif

	mutex_for_fo = kmalloc(sizeof(struct mutex),
		GFP_KERNEL);

	if (mutex_for_fo == NULL) {
		dev_err(&pdev->dev,
			"failed to create mutex handle\n");
		goto out;
	}

#ifdef I2C_BASE
	mutex_for_i2c = kmalloc(sizeof(struct mutex),
		GFP_KERNEL);

	if (mutex_for_i2c == NULL) {
		dev_err(&pdev->dev,
			"failed to create mutex handle\n");
		goto out;
	}
	mutex_init(mutex_for_i2c);
#endif
	mutex_init(mutex_for_fo);

#ifdef CONFIG_CPU_S5PV210
	/* added for phy cut off when boot up */
	clk_enable(s5ptv_status.i2c_phy_clk);
	__s5p_hdmi_phy_power(false);
	clk_disable(s5ptv_status.i2c_phy_clk);
	s5p_tv_clk_gate( false );
#endif
	//disable power
	max8998_ldo3_8_control(0,LDO_TV_OUT);  //ldo 3,8 off
	printk("%s: LDO3_8 is disabled by TV \n", __func__);

	return 0;

#ifdef CONFIG_TV_FB
err_alloc:
#endif

#ifdef CONFIG_CPU_S5PC100
out_hpd_irq:
	free_irq(IRQ_TVENC, pdev);
#endif

out_tvenc_irq:
	free_irq(IRQ_HDMI, pdev);

out_hdmi_irq:
	free_irq(IRQ_MIXER, pdev);

out:
	printk(KERN_ERR "not found (%d). \n", ret);

	return ret;
}
Exemplo n.º 4
0
static int __devinit s5p_tv_probe(struct platform_device *pdev)
{
	int	irq_num;
	int	ret = 0;
	int	i;

	g_s5ptv_status.dev_fb = &pdev->dev;
	g_clks_enabled = 0;

	ret = s5p_sdout_probe(pdev, 0);
	if (ret != 0) {
		pr_err("%s::s5p_sdout_probe() fail\n", __func__);
		goto err_s5p_sdout_probe;
	}

	ret = s5p_vp_probe(pdev, 1);
	if (ret != 0) {
		pr_err("%s::s5p_vmixer_probe() fail\n", __func__);
		goto err_s5p_vp_probe;
	}

	ret = s5p_vmixer_probe(pdev, 2);
	if (ret != 0) {
		pr_err("%s::s5p_vmixer_probe() fail\n", __func__);
		goto err_s5p_vmixer_probe;
	}

	tv_clk_get(pdev, &g_s5ptv_status);
	s5p_tv_base_clk_gate(true);

	ret = s5p_hdmi_probe(pdev, 3, 4);
	if (ret != 0) {
		pr_err("%s::s5p_hdmi_probe() fail\n", __func__);
		goto err_s5p_hdmi_probe;
	}

	s5p_hdcp_init();

#ifdef CONFIG_HDMI_HPD
	g_s5ptv_status.hpd_status = s5p_hpd_get_state();
#else
	g_s5ptv_status.hpd_status = 0;
#endif
	dev_info(&pdev->dev, "hpd status is cable %s\n",
			g_s5ptv_status.hpd_status ? "inserted" : "removed");

	/* interrupt */
	TVOUT_IRQ_INIT(irq_num, ret, pdev, 0, err_vm_irq,    s5p_vmixer_irq, "mixer");
	TVOUT_IRQ_INIT(irq_num, ret, pdev, 1, err_hdmi_irq,  s5p_hdmi_irq , "hdmi");
	TVOUT_IRQ_INIT(irq_num, ret, pdev, 2, err_tvenc_irq, s5p_tvenc_irq, "tvenc");

	/* v4l2 video device registration */
	for (i = 0; i < S5P_TVMAX_CTRLS; i++) {
		g_s5ptv_status.video_dev[i] = &s5p_tvout[i];

		if (video_register_device(g_s5ptv_status.video_dev[i],
					VFL_TYPE_GRABBER, s5p_tvout[i].minor) != 0) {

			dev_err(&pdev->dev,
					"Couldn't register tvout driver.\n");

			ret = -EBUSY;
			goto err_video_register_device;
		}
	}

#ifdef CONFIG_TV_FB
	mutex_init(&g_s5ptv_status.fb_lock);

	/* for default start up */
	s5p_tv_if_init_param();

	g_s5ptv_status.tvout_param.disp_mode = TVOUT_720P_60;
	g_s5ptv_status.tvout_param.out_mode  = TVOUT_OUTPUT_HDMI;

#ifndef CONFIG_USER_ALLOC_TVOUT
	s5p_tv_base_clk_gate(true);
	s5p_tv_base_phy_power(true);
	s5p_tv_if_set_disp();
#endif

	s5ptvfb_set_lcd_info(&g_s5ptv_status);

	/* prepare memory */
	if (s5ptvfb_alloc_framebuffer()) {
		ret = -ENOMEM;
		goto err_alloc_fb;
	}

	if (s5ptvfb_register_framebuffer()) {
		ret = -EBUSY;
		goto err_register_fb;
	}

#ifndef CONFIG_USER_ALLOC_TVOUT
	s5ptvfb_display_on(&g_s5ptv_status);
#endif
#endif
	g_mutex_for_fo = kmalloc(sizeof(struct mutex),
			GFP_KERNEL);

	if (g_mutex_for_fo == NULL) {
		dev_err(&pdev->dev,
			"failed to create mutex handle\n");
		ret = -ENOMEM;
		goto err_mutex_alloc;
	}

	mutex_init(g_mutex_for_fo);

	/* added for phy cut off when boot up */
	clk_enable(g_s5ptv_status.i2c_phy_clk);
	s5p_hdmi_phy_power(false);
	clk_disable(g_s5ptv_status.i2c_phy_clk);
	s5p_tv_base_clk_gate(false);

	return 0;

err_mutex_alloc:
#ifdef CONFIG_TV_FB
err_register_fb:
	s5ptvfb_free_framebuffer();
err_alloc_fb:
#endif
err_video_register_device:
	free_irq(IRQ_TVENC, pdev);

err_tvenc_irq:
	free_irq(IRQ_HDMI, pdev);

err_hdmi_irq:
	free_irq(IRQ_MIXER, pdev);

err_vm_irq:
	s5p_hdmi_release(pdev);

err_s5p_hdmi_probe:
	s5p_vmixer_release(pdev);

err_s5p_vmixer_probe:
	s5p_vp_release(pdev);

err_s5p_vp_probe:
	s5p_sdout_release(pdev);

err_s5p_sdout_probe:
	pr_err("%s::not found (%d).\n", __func__, ret);

	return ret;
}
Exemplo n.º 5
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);
}
Exemplo n.º 6
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 */
    }
}
Exemplo n.º 7
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;
}
Exemplo n.º 8
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    
    }
        
}