/* 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(s5ptv_status.suspend_status == true || !(s5ptv_status.hpd_status)) { switch (i) { /* Vlayer */ case V4L2_BUF_TYPE_VIDEO_OUTPUT: _s5p_vlayer_init_param(0); s5ptv_status.vp_layer_enable = true; break; // GRP0/1 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY : 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(!(s5ptv_status.vp_layer_enable)) { _s5p_vlayer_init_param(0); _s5p_vlayer_start(); s5ptv_status.vp_layer_enable = true; } 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; }
/* * Resume */ int s5p_tv_late_resume(struct platform_device *dev) { BASEPRINTK("(hpd_status = %d)++\n", s5ptv_status.hpd_status); mutex_lock(mutex_for_fo); s5ptv_status.suspend_status = false; if(!(s5ptv_status.hpd_status)) { mutex_unlock(mutex_for_fo); return 0; } else { #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 /* clk & power on */ 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 /* 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); #ifdef CONFIG_TV_FB if ( s5ptv_status.tvout_output_enable ) { s5ptvfb_display_on(&s5ptv_status); s5ptvfb_set_par(s5ptv_status.fb); } #endif } mutex_unlock(mutex_for_fo); BASEPRINTK("()--\n"); return 0; }
/* * Resume */ int s5p_tv_late_resume(struct platform_device *dev) { BASEPRINTK("(hpd_status = %d)++\n", s5ptv_status.hpd_status); mutex_lock(mutex_for_fo); s5ptv_status.suspend_status = false; 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) s5p_handle_cable(); if(!(s5ptv_status.hpd_status)) { mutex_unlock(mutex_for_fo); return 0; } else { #ifdef CONFIG_CPU_FREQ_S5PV210 s5pv210_set_cpufreq_level(RESTRICT_TABLE); #endif /* CONFIG_CPU_FREQ_S5PV210 */ /* clk & power on */ 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 ); /* 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); #ifdef CONFIG_TV_FB if (s5ptv_status.tvout_output_enable) { s5ptvfb_display_on(&s5ptv_status); s5ptvfb_set_par(s5ptv_status.fb); } #endif } mutex_unlock(mutex_for_fo); BASEPRINTK("()--\n"); return 0; }
/* * Resume */ void s5p_tv_late_resume(struct early_suspend *h) { BASEPRINTK("%s----------------start \n", __func__); mutex_lock(mutex_for_fo); s5ptv_status.suspend_status = false; if (!(s5ptv_status.hpd_status)) { printk(KERN_INFO "(hpd_status = %d)++\n", \ s5ptv_status.hpd_status); mutex_unlock(mutex_for_fo); return ; } else { #ifdef CONFIG_CPU_FREQ_S5PV210 s5pv210_set_cpufreq_level(RESTRICT_TABLE); #endif /* CONFIG_CPU_FREQ_S5PV210 */ /* clk & power on */ 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); /* 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); #ifdef CONFIG_TV_FB if (s5ptv_status.tvout_output_enable) { s5ptvfb_display_on(&s5ptv_status); s5ptvfb_set_par(s5ptv_status.fb); } #endif } mutex_unlock(mutex_for_fo); BASEPRINTK("()--\n"); return ; }
/* * Resume */ int s5p_tv_resume(struct platform_device *dev) { /* clk & power on */ s5p_tv_clk_gate( true ); //tv_phy_power( true ); if ( s5ptv_status.tvout_output_enable ) _s5p_tv_if_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); if ( s5ptv_status.grp_layer_enable[1] ) _s5p_grp_start(VM_GPR1_LAYER); return 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 */ } }
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 */ } }
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 } }