Ejemplo n.º 1
0
static int get_sys_all_cpu_freq_info(void)
{
    int i;
    int cpu_total_dmips = 0;

    for (i=0 ; i<NO_CPU_CORES ; i++)
    {
        cpufreqs[i] = cpufreq_quick_get(i)/1000; // MHz
        cpu_total_dmips += cpufreqs[i];
    }

    cpu_total_dmips /= 1000;
    // TODO: think a way to easy start and stop, and start for only once
    if (1 == check_dmips_limit)
    {
        if (cpu_total_dmips > mtktscpu_limited_dmips)
        {
            THRML_ERROR_LOG("cpu %d over limit %d\n", cpu_total_dmips, mtktscpu_limited_dmips);
            if (dmips_limit_warned == false)
            {
                aee_kernel_warning("thermal", "cpu %d over limit %d\n", cpu_total_dmips, mtktscpu_limited_dmips);
                dmips_limit_warned = true;
            }
        }
    }

    return 0;
}
Ejemplo n.º 2
0
static ssize_t mtk_thermal_validation_wr(struct file *file, const char __user *buffer, size_t count, loff_t *data)
{
	char desc[32];
	int check_switch;
	int len = 0;

	len = (count < (sizeof(desc) - 1)) ? count : (sizeof(desc) - 1);
	if (copy_from_user(desc, buffer, len))
	{
		return 0;
	}
	desc[len] = '\0';

	if (sscanf(desc, "%d", &check_switch) == 1)
	{
	    if (1 == check_switch)
	    {
	        dmips_limit_warned = false;
		    check_dmips_limit = check_switch;
		}
		else if (0 == check_switch)
		{
		    check_dmips_limit = check_switch;
		}
		return count;
	}
	else
	{
		THRML_ERROR_LOG("[mtk_thermal_validation_wr] bad argument\n");
	}
	return -EINVAL;
}
Ejemplo n.º 3
0
/* Init */
static int __init mtk_thermal_platform_init(void)
{
    int err = 0;
    struct proc_dir_entry *entry;
    entry = proc_create("driver/tm_validation", S_IRUGO | S_IWUSR, NULL, &mtk_thermal_validation_fops);
    if (!entry)
    {
        THRML_ERROR_LOG("[mtk_thermal_platform_init] Can not create /proc/driver/tm_validation\n");
    }

    return err;
}
Ejemplo n.º 4
0
static int get_sys_all_cpu_freq_info(void)
{
    int nCPU_freq_temp, i;
    char szTempBuf[512];
    int cpu_total_dmips = 0;

    for(i=0 ; i<NUMBER_OF_CORE ; i++)
    {
        sprintf(szTempBuf, "/sys/devices/system/cpu/cpu%01d/cpufreq/cpuinfo_cur_freq", i);
        nCPU_freq_temp = get_sys_cpu_freq_info(szTempBuf, 3);
        if(nCPU_freq_temp > 0)
        {
            cpufreqs[i] = nCPU_freq_temp/1000;
            cpu_total_dmips += nCPU_freq_temp;
        }
        else
        {
            /* CPU is unplug now */
            cpufreqs[i] = nCPU_freq_temp*10;
        }
    }      

    cpu_total_dmips /= 1000;
    // TODO: think a way to easy start and stop, and start for only once
    if (1 == check_dmips_limit)
    {
        if (cpu_total_dmips > mtktscpu_limited_dmips) 
        {
            THRML_ERROR_LOG("cpu %d over limit %d\n", cpu_total_dmips, mtktscpu_limited_dmips);
            if (dmips_limit_warned == false)
            {
                aee_kernel_warning("thermal", "cpu %d over limit %d\n", cpu_total_dmips, mtktscpu_limited_dmips);
                dmips_limit_warned = true;
            }
        }
    }

    return 0;
}