static void stop_vdin(void) { if(hdmirx_device.vdin_started){ stop_tvin_service(0); hdmirx_device.vdin_started=0; printk("%s: stop vdin\n", __func__); } }
void sii5293_stop_vdin(sii5293_vdin *info) { if( info->vdin_started == 0 ) return ; stop_tvin_service(0); set_invert_top_bot(false); info->vdin_started = 0; printk("%s: stop vdin\n", __FUNCTION__); return ; }
void sii9233a_stop_vdin(sii9233a_info_t *info) { if( info->vdin_started == 0 ) return ; stop_tvin_service(0); set_invert_top_bot(false); CLK_GATE_OFF(MISC_DVIN); info->vdin_started = 0; printk("%s: stop vdin\n", __FUNCTION__); return ; }
void sii5293_start_vdin(sii5293_vdin *info, int width, int height, int frame_rate, int field_flag) { vdin_parm_t para; printk("[%s]-%.3d, width = %d, height = %d, frame_rate = %d, field_flag = %d\n", __FUNCTION__, __LINE__, width,height,frame_rate,field_flag); // printk("[%s]-%.3d, info = 0x%x\n",__FUNCTION__, __LINE__, info); if(info->vdin_started) { //printk("[%s]-%.3d, info->vdin_info = 0x%x\n",__FUNCTION__, __LINE__, &(info->vdin_info) ); if( (info->vdin_info.cur_width != width) || (info->vdin_info.cur_height != height) || (info->vdin_info.cur_frame_rate != frame_rate) ) { stop_tvin_service(0); CLK_GATE_OFF(MISC_DVIN); info->vdin_started=0; printk("%s: stop vdin\n", __func__); } } CLK_GATE_ON(MISC_DVIN); if( (info->vdin_started==0) && (width>0) && (height>0) && (frame_rate>0) ) { int start_pix=138, start_line_o=22, start_line_e=23, h_total=1728, v_total=625; info->vdin_info.cur_width = width; info->vdin_info.cur_height = height; info->vdin_info.cur_frame_rate = frame_rate; if(field_flag && height <= 576 ) { // for rgb 576i signal from 9233, it's 720/864, not 1440/1728 if( (width==720)&&(height==288) ) { start_pix = 138; start_line_o = 22; start_line_e = 23; h_total = 1728; v_total = 625; } // for rgb 480i signal from 9233, it's 720/858, not 1440/1716 else if( (width==720)&&(height==240) ) { start_pix = 114; start_line_o = 18; start_line_e = 19; h_total = 1716; v_total = 525; } sii5293_config_dvin(1, //hs_pol_inv, 1, //vs_pol_inv, 0, //de_pol_inv, 0, //field_pol_inv, 0, //ext_field_sel, 3, //de_mode, 0, //data_comp_map, 0, //mode_422to444, 0, //dvin_clk_inv, 0, //vs_hs_tim_ctrl, 400, //hs_lead_vs_odd_min, 1200, //hs_lead_vs_odd_max, start_pix,//sii_get_hs_backporch()*2,//0xdc, //active_start_pix_fe, start_pix,//sii_get_hs_backporch()*2,//0xdc, //active_start_pix_fo, start_line_e,//sii_get_vs_backporch(), //0x19, //active_start_line_fe, start_line_o,//sii_get_vs_backporch(),//0x19, //active_start_line_fo, h_total,//sii_get_h_total(), //0x672, //line_width, v_total//sii_get_v_total()*2 //0x2ee //field_height ); } else { sii5293_config_dvin(height>576?0:1, //hs_pol_inv, height>576?0:1, //vs_pol_inv, 0, //de_pol_inv, (field_flag && height>=540)?1:0, //field_pol_inv, set to 1 for 1080i 0, //ext_field_sel, 3, //de_mode, 0, //data_comp_map, 0, //mode_422to444, 0, //dvin_clk_inv, 0, //vs_hs_tim_ctrl, 0, //hs_lead_vs_odd_min, 0, //hs_lead_vs_odd_max, sii_get_hs_backporch(),//0xdc, //active_start_pix_fe, sii_get_hs_backporch(),//0xdc, //active_start_pix_fo, sii_get_vs_backporch(), //0x19, //active_start_line_fe, sii_get_vs_backporch(),//0x19, //active_start_line_fo, sii_get_h_total(), //0x672, //line_width, sii_get_v_total() //0x2ee //field_height ); } memset( ¶, 0, sizeof(para)); para.port = TVIN_PORT_DVIN0; para.frame_rate = frame_rate; para.h_active = info->vdin_info.cur_width; para.v_active = info->vdin_info.cur_height; if(field_flag){ if(info->vdin_info.cur_width == 1920 && (info->vdin_info.cur_height == 1080 || info->vdin_info.cur_height == 540)){ if( frame_rate == 60 ) para.fmt = TVIN_SIG_FMT_HDMI_1920X1080I_60HZ; else if( frame_rate == 50 ) para.fmt = TVIN_SIG_FMT_HDMI_1920X1080I_50HZ_A; para.v_active = 1080; } /* else if( info->vdin_info.cur_width == 720 && (info->vdin_info.cur_height == 576 || info->vdin_info.cur_height == 288)){ para.fmt = TVIN_SIG_FMT_HDMI_720X576I_50HZ; para.v_active = 576; set_invert_top_bot(true); } */ else if(info->vdin_info.cur_width == 720 && (info->vdin_info.cur_height == 576 || info->vdin_info.cur_height == 288)){ para.fmt = TVIN_SIG_FMT_MAX;//TVIN_SIG_FMT_HDMI_1440X576I_50HZ; para.v_active = 288; set_invert_top_bot(true); } /* else if( info->vdin_info.cur_width == 720 && (info->vdin_info.cur_height == 480 || info->vdin_info.cur_height == 240)){ para.fmt = TVIN_SIG_FMT_HDMI_720X480I_60HZ; para.v_active = 480; set_invert_top_bot(true); } */ else if(info->vdin_info.cur_width == 720 && (info->vdin_info.cur_height == 480 || info->vdin_info.cur_height == 240)){ para.fmt = TVIN_SIG_FMT_MAX;//TVIN_SIG_FMT_HDMI_1440X480I_60HZ; para.v_active = 240; set_invert_top_bot(true); } else{ para.fmt = TVIN_SIG_FMT_MAX+1; set_invert_top_bot(true); } para.scan_mode = TVIN_SCAN_MODE_INTERLACED; } else{ if(info->vdin_info.cur_width == 1920 && info->vdin_info.cur_height == 1080){ if( info->vdin_info.cur_frame_rate == 60 ) para.fmt = TVIN_SIG_FMT_HDMI_1920X1080P_60HZ; else if( info->vdin_info.cur_frame_rate == 30 ) para.fmt = TVIN_SIG_FMT_MAX;//TVIN_SIG_FMT_HDMI_1920X1080P_30HZ; } else if(info->vdin_info.cur_width == 1280 && info->vdin_info.cur_height == 720){ para.fmt = TVIN_SIG_FMT_HDMI_1280X720P_60HZ; } else if((info->vdin_info.cur_width == 1440 || info->vdin_info.cur_width == 720) && info->vdin_info.cur_height == 576){ para.fmt = TVIN_SIG_FMT_HDMI_720X576P_50HZ; } else if((info->vdin_info.cur_width == 1440 || info->vdin_info.cur_width == 720) && info->vdin_info.cur_height == 480){ para.fmt = TVIN_SIG_FMT_HDMI_720X480P_60HZ; } else{ para.fmt = TVIN_SIG_FMT_MAX+1; } para.scan_mode = TVIN_SCAN_MODE_PROGRESSIVE; } para.hsync_phase = 1; para.vsync_phase = 0; //para.hs_bp = 0; //para.vs_bp = 2; para.cfmt = TVIN_RGB444; para.dfmt = TVIN_YUV422; para.reserved = 0; //skip_num printk("[%s] begin start_tvin_service() !\n",__FUNCTION__); #ifdef HDMIIN_FRAME_SKIP_MECHANISM if( (SKIP_STATUS_NORMAL==flag_skip_status) || (SKIP_STATUS_STANDBY==flag_skip_status) || (SKIP_STATUS_CABLE==flag_skip_status) ) flag_skip_enable = 1; #endif start_tvin_service(0,¶); info->vdin_started = 1; //printk("%s: %dx%d %d %d/s\n", __func__, width, height, frame_rate, field_flag); } return ; }
static void start_vdin(int width, int height, int frame_rate, int field_flag) { tvin_parm_t para; if(hdmirx_device.vdin_enable == 0){ return; } if(hdmirx_device.vdin_started){ if(hdmirx_device.cur_width != width || hdmirx_device.cur_height != height || hdmirx_device.cur_frame_rate != frame_rate){ stop_tvin_service(0); hdmirx_device.vdin_started=0; printk("%s: stop vdin\n", __func__); } } if(hdmirx_device.vdin_started==0 && width>0 && height>0 && frame_rate >0){ hdmirx_device.cur_width = width; hdmirx_device.cur_height = height; hdmirx_device.cur_frame_rate = frame_rate; #ifdef DEBUG_DVIN hs_pol_inv = 0; vs_pol_inv = height>480?0:1; de_pol_inv = 0; field_pol_inv = 0; ext_field_sel = 0; de_mode = 0; data_comp_map = 0; mode_422to444 = 0; dvin_clk_inv = 0; vs_hs_tim_ctrl = 0; hs_lead_vs_odd_min = 0; hs_lead_vs_odd_max = 0; active_start_pix_fe = getHDMIRXHorzBackPorch(); active_start_pix_fo = getHDMIRXHorzBackPorch(); active_start_line_fe = getHDMIRXVertSyncBackPorch(); active_start_line_fo = getHDMIRXVertSyncBackPorch(); line_width = getHDMIRXHorzTotal(); field_height = getHDMIRXVertTotal(); #endif if(field_flag && height <= 480 ){ config_dvin(0, //hs_pol_inv, 1, //vs_pol_inv, 0, //de_pol_inv, 0, //field_pol_inv, 0, //ext_field_sel, 2, //de_mode, 0, //data_comp_map, 0, //mode_422to444, 0, //dvin_clk_inv, 0, //vs_hs_tim_ctrl, 400, //hs_lead_vs_odd_min, 1200, //hs_lead_vs_odd_max, getHDMIRXHorzBackPorch(),//0xdc, //active_start_pix_fe, getHDMIRXHorzBackPorch(),//0xdc, //active_start_pix_fo, getHDMIRXVertSyncBackPorch(), //0x19, //active_start_line_fe, getHDMIRXVertSyncBackPorch(),//0x19, //active_start_line_fo, getHDMIRXHorzTotal(), //0x672, //line_width, getHDMIRXVertTotal() //0x2ee //field_height ); } else{ config_dvin(0, //hs_pol_inv, height>480?0:1, //vs_pol_inv, 0, //de_pol_inv, 0, //field_pol_inv, 0, //ext_field_sel, 0, //de_mode, 0, //data_comp_map, 0, //mode_422to444, 0, //dvin_clk_inv, 0, //vs_hs_tim_ctrl, 0, //hs_lead_vs_odd_min, 0, //hs_lead_vs_odd_max, getHDMIRXHorzBackPorch(),//0xdc, //active_start_pix_fe, getHDMIRXHorzBackPorch(),//0xdc, //active_start_pix_fo, getHDMIRXVertSyncBackPorch(), //0x19, //active_start_line_fe, getHDMIRXVertSyncBackPorch(),//0x19, //active_start_line_fo, getHDMIRXHorzTotal(), //0x672, //line_width, getHDMIRXVertTotal() //0x2ee //field_height ); } para.fmt_info.h_active = hdmirx_device.cur_width; para.fmt_info.v_active = hdmirx_device.cur_height; para.port = TVIN_PORT_DVIN0; if(field_flag){ para.fmt_info.v_active <<= 1; //if(height == 1080){ para.fmt_info.fmt = TVIN_SIG_FMT_HDMI_1920x1080I_60Hz; //} //else{ // para.fmt_info.fmt = TVIN_SIG_FMT_HDMI_1440x480I_60Hz; //} } else{ para.fmt_info.fmt = TVIN_SIG_FMT_MAX+1;//TVIN_SIG_FMT_MAX+1;TVIN_SIG_FMT_CAMERA_1280X720P_30Hz } para.fmt_info.frame_rate = frame_rate; para.fmt_info.hsync_phase = 1; para.fmt_info.vsync_phase = 0; start_tvin_service(0,¶); hdmirx_device.vdin_started = 1; printk("%s: %dx%d %d/s\n", __func__, width, height, frame_rate); hdmirx_device.aud_info.real_sample_rate = audio_sample_freq; #ifdef CONFIG_AML_AUDIO_DSP mailbox_send_audiodsp(1, M2B_IRQ0_DSP_AUDIO_EFFECT, DSP_CMD_SET_HDMI_SR, (char *)&hdmirx_device.aud_info.real_sample_rate,sizeof(hdmirx_device.aud_info.real_sample_rate)); printk("[IT660x]%s: mailbox_send_audiodsp %d\n",__func__, hdmirx_device.aud_info.real_sample_rate); #endif } }
static void start_vdin(int width, int height, int frame_rate, int field_flag) { #ifdef USE_TVIN_CAMERA tvin_parm_t para; #else vdin_parm_t para; #endif if(hdmirx_device.vdin_enable == 0){ return; } if(hdmirx_device.vdin_started){ if(hdmirx_device.cur_width != width || hdmirx_device.cur_height != height || hdmirx_device.cur_frame_rate != frame_rate){ stop_tvin_service(0); hdmirx_device.vdin_started=0; printk("%s: stop vdin\n", __func__); } } if(hdmirx_device.vdin_started==0 && width>0 && height>0 && frame_rate >0){ hdmirx_device.cur_width = width; hdmirx_device.cur_height = height; hdmirx_device.cur_frame_rate = frame_rate; if(field_flag && height <= (576/2) ){ config_dvin(0, //hs_pol_inv, 1, //vs_pol_inv, 0, //de_pol_inv, 0, //field_pol_inv, 0, //ext_field_sel, 3, //de_mode, 0, //data_comp_map, 0, //mode_422to444, 0, //dvin_clk_inv, 0, //vs_hs_tim_ctrl, 400, //hs_lead_vs_odd_min, 1200, //hs_lead_vs_odd_max, getHDMIRXHorzBackPorch(),//0xdc, //active_start_pix_fe, getHDMIRXHorzBackPorch(),//0xdc, //active_start_pix_fo, getHDMIRXVertSyncBackPorch(), //0x19, //active_start_line_fe, getHDMIRXVertSyncBackPorch(),//0x19, //active_start_line_fo, getHDMIRXHorzTotal(), //0x672, //line_width, getHDMIRXVertTotal() //0x2ee //field_height ); } else{ config_dvin(0, //hs_pol_inv, (field_flag && height>=540)?0:(height>576?0:1), //vs_pol_inv, 0, //de_pol_inv, (field_flag && height>=540)?1:0, //field_pol_inv, set to 1 for 1080i 0, //ext_field_sel, 3, //de_mode, 0, //data_comp_map, 0, //mode_422to444, 0, //dvin_clk_inv, 0, //vs_hs_tim_ctrl, 0, //hs_lead_vs_odd_min, 0, //hs_lead_vs_odd_max, getHDMIRXHorzBackPorch(),//0xdc, //active_start_pix_fe, getHDMIRXHorzBackPorch(),//0xdc, //active_start_pix_fo, getHDMIRXVertSyncBackPorch(), //0x19, //active_start_line_fe, getHDMIRXVertSyncBackPorch(),//0x19, //active_start_line_fo, getHDMIRXHorzTotal(), //0x672, //line_width, getHDMIRXVertTotal() //0x2ee //field_height ); } #ifdef USE_TVIN_CAMERA para.fmt_info.h_active = hdmirx_device.cur_width; para.fmt_info.v_active = hdmirx_device.cur_height; para.port = TVIN_PORT_DVIN0; if(field_flag){ para.fmt_info.v_active <<= 1; //if(height == 1080){ para.fmt_info.fmt = TVIN_SIG_FMT_HDMI_1920x1080I_60Hz; //} //else{ // para.fmt_info.fmt = TVIN_SIG_FMT_HDMI_1440x480I_60Hz; //} } else{ para.fmt_info.fmt = TVIN_SIG_FMT_MAX+1;//TVIN_SIG_FMT_MAX+1;TVIN_SIG_FMT_CAMERA_1280X720P_30Hz } para.fmt_info.frame_rate = frame_rate; para.fmt_info.hsync_phase = 1; para.fmt_info.vsync_phase = 0; #else memset( ¶, 0, sizeof(para)); para.port = TVIN_PORT_DVIN0; para.frame_rate = frame_rate; para.h_active = hdmirx_device.cur_width; para.v_active = hdmirx_device.cur_height; if(field_flag){ if(hdmirx_device.cur_width == 1920 && (hdmirx_device.cur_height == 1080 || hdmirx_device.cur_height == 540)){ para.fmt = TVIN_SIG_FMT_HDMI_1920X1080I_60HZ; para.v_active = 1080; } /* else if( hdmirx_device.cur_width == 720 && (hdmirx_device.cur_height == 576 || hdmirx_device.cur_height == 288)){ para.fmt = TVIN_SIG_FMT_HDMI_720X576I_50HZ; para.v_active = 576; set_invert_top_bot(true); } else if(hdmirx_device.cur_width == 1440 && (hdmirx_device.cur_height == 576 || hdmirx_device.cur_height == 288)){ para.fmt = TVIN_SIG_FMT_HDMI_1440X576I_50HZ; para.v_active = 576; set_invert_top_bot(true); } else if( hdmirx_device.cur_width == 720 && (hdmirx_device.cur_height == 480 || hdmirx_device.cur_height == 240)){ para.fmt = TVIN_SIG_FMT_HDMI_720X480I_60HZ; para.v_active = 480; set_invert_top_bot(true); } else if(hdmirx_device.cur_width == 1440 && (hdmirx_device.cur_height == 480 || hdmirx_device.cur_height == 240)){ para.fmt = TVIN_SIG_FMT_HDMI_1440X480I_60HZ; para.v_active = 480; set_invert_top_bot(true); }*/ else{ para.fmt = TVIN_SIG_FMT_MAX+1; set_invert_top_bot(true); } para.scan_mode = TVIN_SCAN_MODE_INTERLACED; } else{ if(hdmirx_device.cur_width == 1920 && hdmirx_device.cur_height == 1080){ para.fmt = TVIN_SIG_FMT_HDMI_1920X1080P_60HZ; } else if(hdmirx_device.cur_width == 1280 && hdmirx_device.cur_height == 720){ para.fmt = TVIN_SIG_FMT_HDMI_1280X720P_60HZ; } else if((hdmirx_device.cur_width == 1440 || hdmirx_device.cur_width == 720) && hdmirx_device.cur_height == 576){ para.fmt = TVIN_SIG_FMT_HDMI_720X576P_50HZ; } else if((hdmirx_device.cur_width == 1440 || hdmirx_device.cur_width == 720) && hdmirx_device.cur_height == 480){ para.fmt = TVIN_SIG_FMT_HDMI_720X480P_60HZ; } else{ para.fmt = TVIN_SIG_FMT_MAX+1; } para.scan_mode = TVIN_SCAN_MODE_PROGRESSIVE; } para.hsync_phase = 1; para.vsync_phase = 0; //para.hs_bp = 0; //para.vs_bp = 2; para.cfmt = TVIN_RGB444; para.reserved = 0; //skip_num #endif start_tvin_service(0,¶); hdmirx_device.vdin_started = 1; printk("%s: %dx%d %d/s\n", __func__, width, height, frame_rate); hdmirx_device.aud_info.real_sample_rate = audio_sample_freq; #ifdef CONFIG_AML_AUDIO_DSP mailbox_send_audiodsp(1, M2B_IRQ0_DSP_AUDIO_EFFECT, DSP_CMD_SET_HDMI_SR, (char *)&hdmirx_device.aud_info.real_sample_rate,sizeof(hdmirx_device.aud_info.real_sample_rate)); printk("[IT660x]%s: mailbox_send_audiodsp %d\n",__func__, hdmirx_device.aud_info.real_sample_rate); #endif } }