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; }
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; }