/* We use the same work function to sale up and down */ static void cpufreq_interactivex_freq_change_time_work(struct work_struct *work) { unsigned int cpu; unsigned int newtarget; cpumask_t tmp_mask = work_cpumask; newtarget = FREQ_THRESHOLD; for_each_cpu(cpu, tmp_mask) { if (!suspended) { if (target_freq == policy->max) { if (nr_running() == 1) { cpumask_clear_cpu(cpu, &work_cpumask); return; } // __cpufreq_driver_target(policy, target_freq, CPUFREQ_RELATION_H); __cpufreq_driver_target(policy, newtarget, CPUFREQ_RELATION_H); } else { target_freq = cpufreq_interactivex_calc_freq(cpu); __cpufreq_driver_target(policy, target_freq, CPUFREQ_RELATION_L); } } freq_change_time_in_idle = get_cpu_idle_time_us(cpu, &freq_change_time); cpumask_clear_cpu(cpu, &work_cpumask); } }
/* We use the same work function to sale up and down */ static void cpufreq_interactivex_freq_change_time_work(struct work_struct *work) { unsigned int cpu; cpumask_t tmp_mask = work_cpumask; for_each_cpu(cpu, tmp_mask) { if (!suspended && (target_freq >= freq_threshold || target_freq == policy->max) ) { if (policy->cur < 400000) { // avoid quick jump from lowest to highest target_freq = resume_speed; } if (nr_running() == 1) { cpumask_clear_cpu(cpu, &work_cpumask); return; } __cpufreq_driver_target(policy, target_freq, CPUFREQ_RELATION_H); } else { if (!suspended) { target_freq = cpufreq_interactivex_calc_freq(cpu); __cpufreq_driver_target(policy, target_freq, CPUFREQ_RELATION_L); } else { // special care when suspended if (target_freq > suspendfreq) { __cpufreq_driver_target(policy, suspendfreq, CPUFREQ_RELATION_H); } else { target_freq = cpufreq_interactivex_calc_freq(cpu); if (target_freq < policy->cur) __cpufreq_driver_target(policy, target_freq, CPUFREQ_RELATION_H); } } } freq_change_time_in_idle = get_cpu_idle_time_us(cpu, &freq_change_time); cpumask_clear_cpu(cpu, &work_cpumask); } }