static int framerate_automation_set_mode(vmode_t mode_target) { int auto_mode = 0; auto_mode = get_exchange_mode(mode_target); printk("vout [%s] mode_target = %d\n", __FUNCTION__, mode_target); printk("+++++++++++++++++%s[%d]auto_mode=%d++++++++++++++++\n",__func__,__LINE__,auto_mode); switch( auto_mode ) { case 0: // need not change vmode break; case 1: // just change pll to adjust clock update_vmode_status(get_name_from_vmode(mode_target)); update_current_vinfo(mode_target); clock_fine_tune(); vout_notifier_call_chain(VOUT_EVENT_MODE_CHANGE,&mode_target) ; break; case 2: // change vmode and notify all client set_vout_mode_fr_auto(get_name_from_vmode(mode_target)); break; default: break; } return 0; }
static void set_vout_mode(char * name) { vmode_t mode; amlog_mask_level(LOG_MASK_PARA,LOG_LEVEL_HIGH,"tvmode set to %s\n",name); mode=validate_vmode(name); if(VMODE_MAX==mode) { amlog_mask_level(LOG_MASK_PARA,LOG_LEVEL_HIGH,"no matched vout mode\n"); return ; } #ifdef CONFIG_AML_VOUT_FRAMERATE_AUTOMATION mode_by_user = mode; #endif if(mode==get_current_vmode()) { amlog_mask_level(LOG_MASK_PARA,LOG_LEVEL_HIGH,"don't set the same mode as current.\n"); return ; } #ifdef CONFIG_AML_VOUT_FRAMERATE_AUTOMATION //if plug hdmi during fps (stream is playing), then adjust mode to fps vmode fps_auto_adjust_mode(&mode); printk("%s[%d]fps_target_mode=%d\n",__func__,__LINE__,mode); update_vmode_status(get_name_from_vmode(mode)); #endif set_current_vmode(mode); #ifdef CONFIG_AML_VOUT_FRAMERATE_AUTOMATION amlog_mask_level(LOG_MASK_PARA,LOG_LEVEL_HIGH,"new mode =%s set ok\n",get_name_from_vmode(mode)); #endif vout_notifier_call_chain(VOUT_EVENT_MODE_CHANGE,&mode) ; printk("%s[%d]\n", __func__, __LINE__); }
/* if plug hdmi during fps (stream is playing), then adjust mode to fps vmode */ static void fps_auto_adjust_mode(enum vmode_e *pmode) { if (fps_playing_flag == 1) { if (want_hdmi_mode(*pmode) == 1) { if ((hdmitx_is_vmode_supported_process( get_name_from_vmode(mode_by_user)) == 1) && (hdmitx_is_vmode_supported_process( get_name_from_vmode(fps_target_mode)) == 1)) { *pmode = fps_target_mode; } else { mode_by_user = *pmode; fps_target_mode = *pmode; } } } }
static int tv_set_current_vmode(enum vmode_e mode) { if ((mode & VMODE_MODE_BIT_MASK) > VMODE_MAX) return -EINVAL; #ifdef CONFIG_AML_VOUT_FRAMERATE_AUTOMATION /* * if plug hdmi during fps (stream is playing) * then adjust mode to fps vmode */ if (!want_hdmi_mode(mode)) { if (DOWN_HPLL == fine_tune_mode) update_tv_info_duration(fps_target_mode, UP_HPLL); } fps_auto_adjust_mode(&mode); update_vmode_status(get_name_from_vmode(mode)); vout_log_info("%s[%d]fps_target_mode=%d\n", __func__, __LINE__, mode); info->vinfo = update_tv_info_duration(mode, fine_tune_mode); #else info->vinfo = get_tv_info(mode & VMODE_MODE_BIT_MASK); #endif if (!info->vinfo) { vout_log_info("don't get tv_info, mode is %d\n", mode); return 1; } vout_log_info("mode is %d,sync_duration_den=%d,sync_duration_num=%d\n", mode, info->vinfo->sync_duration_den, info->vinfo->sync_duration_num); if (mode & VMODE_LOGO_BIT_MASK) return 0; vout_change_mode_preprocess(mode); #ifdef CONFIG_AML_VPU switch_vpu_mem_pd_vmod(info->vinfo->mode, VPU_MEM_POWER_ON); request_vpu_clk_vmod(info->vinfo->video_clk, info->vinfo->mode); #endif tv_out_reg_write(VPP_POSTBLEND_H_SIZE, info->vinfo->width); tv_out_setmode(vmode_to_tvmode(mode)); #ifdef CONFIG_AML_VOUT_FRAMERATE_AUTOMATION vout_log_info("new mode =%s set ok\n", get_name_from_vmode(mode)); #endif return 0; }
static int framerate_automation_set_mode( enum vmode_e mode_target, enum hint_mode_e hint_mode) { const struct vinfo_s *pvinfo; enum vmode_e mode_current = VMODE_INIT_NULL; if ((mode_target&VMODE_MODE_BIT_MASK) > VMODE_MAX) return 1; pvinfo = tv_get_current_info(); if (!pvinfo) { vout_log_err("don't get tv_info, mode is %d\n", mode_target); return 1; } mode_current = pvinfo->mode; if (!want_hdmi_mode(mode_current)) { vout_log_info("not in valid HDMI mode!\n"); return 1; } if (mode_current == mode_target) { if (fine_tune_mode == KEEP_HPLL) return 0; } vout_log_info("vout [%s] mode_target = %d\n", __func__, mode_target); if (START_HINT == hint_mode) { info->vinfo = update_tv_info_duration(mode_target, fine_tune_mode); } else if (END_HINT == hint_mode) { /*recovery tv_info array, e.g. 1080p59hz->1080p50hz or 1080p59hz->1080p60hz, recovery 1080p60hz vinfo*/ update_tv_info_duration(fps_target_mode, fine_tune_mode); /*get current vinfo, maybe change is 1080p->1080p50, then get info->vinfo for 1080p50hz*/ info->vinfo = get_tv_info(mode_target & VMODE_MODE_BIT_MASK); } update_vmode_status(get_name_from_vmode(mode_target)); vout_notifier_call_chain(VOUT_EVENT_MODE_CHANGE, &mode_target); return 0; }
static enum vmode_e get_target_vmode(int fr_vsource) { int is_receiver_supported = 0; const struct vinfo_s *pvinfo; enum vmode_e mode_target = VMODE_INIT_NULL; int i = 0, count = 0; struct fps_mode_conv *s = NULL; vout_log_info("fr_vsource = %d\n", fr_vsource); pvinfo = tv_get_current_info(); if (!pvinfo) { vout_log_info("don't get vinfo!\n"); return mode_target; } mode_target = pvinfo->mode; mode_by_user = mode_target; if (fr_auto_policy == 1) {/* for amlogic */ fine_tune_mode = get_fine_tune_mode(mode_target, fr_vsource); } else if (fr_auto_policy == 2) {/* for jiewei */ switch (fr_vsource) { case 2397: s = fps_mode_map_23; count = ARRAY_SIZE(fps_mode_map_23); break; case 2400: s = fps_mode_map_24; count = ARRAY_SIZE(fps_mode_map_24); break; case 2500: s = fps_mode_map_25; count = ARRAY_SIZE(fps_mode_map_25); break; case 2997: s = fps_mode_map_29; count = ARRAY_SIZE(fps_mode_map_29); break; case 3000: s = fps_mode_map_30; count = ARRAY_SIZE(fps_mode_map_30); break; case 5000: s = fps_mode_map_50; count = ARRAY_SIZE(fps_mode_map_50); break; case 5994: s = fps_mode_map_59; count = ARRAY_SIZE(fps_mode_map_59); break; case 6000: s = fps_mode_map_60; count = ARRAY_SIZE(fps_mode_map_60); break; default: break; } } for (i = 0; i < count; i++) { if (s[i].cur_mode == mode_target) break; } if (i < count) { mode_target = s[i].target_mode; /*for jiewei policy=2, if mode not support in edid, then will use Amloigc policy*/ fine_tune_mode = get_fine_tune_mode(mode_target, fr_vsource); } is_receiver_supported = hdmitx_is_vmode_supported_process( get_name_from_vmode(mode_target)); vout_log_info("mode_target=%d,is_receiver_supported=%d\n", mode_target, is_receiver_supported); switch (is_receiver_supported) { case 0: /* not supported in edid */ case 2: /* no edid */ mode_target = pvinfo->mode; break; case 1:/* supported in edid */ default: break; } fps_target_mode = mode_target; return mode_target; }