int gpu_maxfreq_handle(unsigned int req_value) { #if 0 pmqos_gpu_dfs_limit_max(req_value); #endif return 0; }
int mali_get_target_profile(u32 curr, int step) { int target; u32 currTmp = curr; u32 maxProfile = g_mali_dfs_var.dfs_Steps - 1; /* target profile calculate */ if ( 3 == step ) { target = maxProfile; } else if ( -3 == step ) { target = 0; } else { target = currTmp + step; target = (target > maxProfile) ? maxProfile : target; target = ((target < 0) ? 0 : target); } if(g_mali_dfs_var.dfs_limitMinRate > g_mali_dfs_var.dfs_limitMaxRate) { MALI_DEBUG_PRINT(1,("mali dfs Error: dfs_limitMinRate is bigger than dfs_limitMaxRate")); g_mali_dfs_var.dfs_limitMaxRate = g_mali_dvfs_profile[g_mali_dfs_var.dfs_limitMaxPrf].freq; g_mali_dfs_var.dfs_limitMinRate = g_mali_dvfs_profile[g_mali_dfs_var.dfs_limitMinPrf].freq; return -1; } if(g_mali_dfs_var.dfs_limitMaxRate != g_mali_dvfs_profile[g_mali_dfs_var.dfs_limitMaxPrf].freq) { pmqos_gpu_dfs_limit_max(1,g_mali_dfs_var.dfs_limitMaxRate); } if(g_mali_dfs_var.dfs_limitMinRate != g_mali_dvfs_profile[g_mali_dfs_var.dfs_limitMinPrf].freq) { pmqos_gpu_dfs_limit_min(1, g_mali_dfs_var.dfs_limitMinRate); } if(g_mali_dfs_var.dfs_limitMinPrf > g_mali_dfs_var.dfs_limitMaxPrf) { MALI_DEBUG_PRINT(1,("mali dfs Error: dfs_limitMinPrf is bigger than dfs_limitMaxPrf")); g_mali_dfs_var.dfs_limitMaxPrf = g_mali_dfs_var.dfs_Steps - 1; g_mali_dfs_var.dfs_limitMinPrf = 0; return -1; } target = (target > g_mali_dfs_var.dfs_limitMaxPrf) ? g_mali_dfs_var.dfs_limitMaxPrf : target; target = (target < g_mali_dfs_var.dfs_limitMinPrf) ? g_mali_dfs_var.dfs_limitMinPrf : target; if( g_mali_dfs_var.dfs_LockOn == 1) { target = g_mali_dfs_var.dfs_LockProfile; } return target; }
void tsensor_monitor_work_fn(struct work_struct *work) { int tempvalue = 0; int ret = TSENSOR_ERR; unsigned int index = 0; index = tsensor_get_index_by_type(TSENSOR_TYPE_LOCAL); ret = tsensor_temp_read_by_index(index, &tempvalue); if(TSENSOR_OK != ret) { pr_err("%s,%d tsensor_temp_read_by_index err\n", __func__, __LINE__); schedule_delayed_work(&tsensor_gov->tsensor_monitor_work,0); return; } pr_err("%s,%d temp_t0:%d tempvalue: %d\n", __func__, __LINE__, gstTempPrtInfo.sensor_config[index].temp_t0,tempvalue); if(tempvalue >= gstTempPrtInfo.sensor_config[index].thres_value) { gstTempPrtInfo.temp_prt_vote |= BIT(TSENSOR_TYPE_LOCAL); tsensor_gov->warning_count++; if(gstTempPrtInfo.temp_offset_benchmark<=(tempvalue-gstTempPrtInfo.sensor_config[index].temp_t0)) { acpufreq_limit_level_regulator(&gstTempPrtInfo,FREQ_DOWN); gstTempPrtInfo.sensor_config[index].temp_t0 = tempvalue; pr_err("acpufreq regulator FREQ_DOWN.\n"); } } else if (tempvalue >= (gstTempPrtInfo.sensor_config[index].thres_value - gstTempPrtInfo.sensor_config[index].lag_value)) { if(gstTempPrtInfo.temp_offset_benchmark<=(gstTempPrtInfo.sensor_config[index].temp_t0 - tempvalue)) { acpufreq_limit_level_regulator(&gstTempPrtInfo,FREQ_UP); gstTempPrtInfo.temp_prt_vote |= BIT(TSENSOR_TYPE_LOCAL); gstTempPrtInfo.sensor_config[index].temp_t0 = tempvalue; pr_err("acpufreq regulator FREQ_UP.\n"); } } else { pwrctrl_acpu_freq_limit_max(gstTempPrtInfo.acpu_freq_limit_table[0], LOCK_FREQ_OFF); gstTempPrtInfo.cur_acpu_freq_index = 0; gstTempPrtInfo.sensor_config[index].temp_t0 = tempvalue; gstTempPrtInfo.temp_prt_vote &= ~(BIT(TSENSOR_TYPE_LOCAL)); pr_err("acpu acpufreq_limit OFF.\n"); } index = tsensor_get_index_by_type(TSENSOR_TYPE_GPU); if(tempvalue>= gstTempPrtInfo.sensor_config[index].thres_value) { unsigned int cur_gpu_freq_index = gstTempPrtInfo.cur_gpu_freq_index; cur_gpu_freq_index++; if(cur_gpu_freq_index < gstTempPrtInfo.gpu_freq_limit_num) { gstTempPrtInfo.cur_gpu_freq_index = cur_gpu_freq_index; } pmqos_gpu_dfs_limit_max(LOCK_FREQ_ON,gstTempPrtInfo.gpu_freq_limit_table[gstTempPrtInfo.cur_gpu_freq_index]); gstTempPrtInfo.temp_prt_vote |= BIT(TSENSOR_TYPE_GPU); pr_err("gpufreq limit ON: %dM.\n", gstTempPrtInfo.gpu_freq_limit_table[gstTempPrtInfo.cur_gpu_freq_index]); } else if (tempvalue < gstTempPrtInfo.sensor_config[index].thres_value - gstTempPrtInfo.sensor_config[index].lag_value) { pmqos_gpu_dfs_limit_max(LOCK_FREQ_OFF, gstTempPrtInfo.gpu_freq_limit_table[0]); gstTempPrtInfo.cur_gpu_freq_index = 0; gstTempPrtInfo.temp_prt_vote &= ~(BIT(TSENSOR_TYPE_GPU)); pr_err("gpufreq limit OFF .\n"); } if(gstTempPrtInfo.temp_prt_vote) { schedule_delayed_work(&tsensor_gov->tsensor_monitor_work,msecs_to_jiffies(tsensor_gov->average_period)); } else { /*Tsensor0温度检测中断屏蔽寄存器。*/ TSENSOR_REG_WRITE(SOC_PERI_SCTRL_SC_TEMP0_INT_EN_ADDR(0), SOC_PERI_SCTRL_SC_TEMP0_INT_EN_temp0_int_en_START, SOC_PERI_SCTRL_SC_TEMP0_INT_EN_temp0_int_en_END, 0x01); } }