Lines Matching refs:gpstates

218 	struct global_pstate_info *gpstates = policy->driver_data;  in reset_gpstates()  local
220 gpstates->highest_lpstate_idx = 0; in reset_gpstates()
221 gpstates->elapsed_time = 0; in reset_gpstates()
222 gpstates->last_sampled_time = 0; in reset_gpstates()
223 gpstates->last_lpstate_idx = 0; in reset_gpstates()
224 gpstates->last_gpstate_idx = 0; in reset_gpstates()
643 static inline void queue_gpstate_timer(struct global_pstate_info *gpstates) in queue_gpstate_timer() argument
653 if ((gpstates->elapsed_time + GPSTATE_TIMER_INTERVAL) in queue_gpstate_timer()
655 timer_interval = MAX_RAMP_DOWN_TIME - gpstates->elapsed_time; in queue_gpstate_timer()
659 mod_timer(&gpstates->timer, jiffies + msecs_to_jiffies(timer_interval)); in queue_gpstate_timer()
673 struct global_pstate_info *gpstates = from_timer(gpstates, t, timer); in gpstate_timer_handler() local
674 struct cpufreq_policy *policy = gpstates->policy; in gpstate_timer_handler()
678 - gpstates->last_sampled_time; in gpstate_timer_handler()
681 if (!spin_trylock(&gpstates->gpstate_lock)) in gpstate_timer_handler()
688 gpstates->timer.expires = jiffies + msecs_to_jiffies(1); in gpstate_timer_handler()
689 add_timer_on(&gpstates->timer, cpumask_first(policy->cpus)); in gpstate_timer_handler()
690 spin_unlock(&gpstates->gpstate_lock); in gpstate_timer_handler()
704 spin_unlock(&gpstates->gpstate_lock); in gpstate_timer_handler()
708 gpstates->last_sampled_time += time_diff; in gpstate_timer_handler()
709 gpstates->elapsed_time += time_diff; in gpstate_timer_handler()
711 if (gpstates->elapsed_time > MAX_RAMP_DOWN_TIME) { in gpstate_timer_handler()
715 gpstates->highest_lpstate_idx = gpstate_idx; in gpstate_timer_handler()
718 gpstate_idx = calc_global_pstate(gpstates->elapsed_time, in gpstate_timer_handler()
719 gpstates->highest_lpstate_idx, in gpstate_timer_handler()
723 gpstates->last_gpstate_idx = gpstate_idx; in gpstate_timer_handler()
724 gpstates->last_lpstate_idx = lpstate_idx; in gpstate_timer_handler()
729 if (gpstate_idx != gpstates->last_lpstate_idx) in gpstate_timer_handler()
730 queue_gpstate_timer(gpstates); in gpstate_timer_handler()
733 spin_unlock(&gpstates->gpstate_lock); in gpstate_timer_handler()
746 struct global_pstate_info *gpstates = policy->driver_data; in powernv_cpufreq_target_index() local
763 if (!gpstates) { in powernv_cpufreq_target_index()
768 spin_lock(&gpstates->gpstate_lock); in powernv_cpufreq_target_index()
770 if (!gpstates->last_sampled_time) { in powernv_cpufreq_target_index()
772 gpstates->highest_lpstate_idx = new_index; in powernv_cpufreq_target_index()
776 if (gpstates->last_gpstate_idx < new_index) { in powernv_cpufreq_target_index()
777 gpstates->elapsed_time += cur_msec - in powernv_cpufreq_target_index()
778 gpstates->last_sampled_time; in powernv_cpufreq_target_index()
785 if (gpstates->elapsed_time > MAX_RAMP_DOWN_TIME) { in powernv_cpufreq_target_index()
787 gpstates->highest_lpstate_idx = new_index; in powernv_cpufreq_target_index()
791 gpstate_idx = calc_global_pstate(gpstates->elapsed_time, in powernv_cpufreq_target_index()
792 gpstates->highest_lpstate_idx, in powernv_cpufreq_target_index()
797 gpstates->highest_lpstate_idx = new_index; in powernv_cpufreq_target_index()
806 queue_gpstate_timer(gpstates); in powernv_cpufreq_target_index()
808 del_timer_sync(&gpstates->timer); in powernv_cpufreq_target_index()
812 gpstates->last_sampled_time = cur_msec; in powernv_cpufreq_target_index()
813 gpstates->last_gpstate_idx = gpstate_idx; in powernv_cpufreq_target_index()
814 gpstates->last_lpstate_idx = new_index; in powernv_cpufreq_target_index()
816 spin_unlock(&gpstates->gpstate_lock); in powernv_cpufreq_target_index()
832 struct global_pstate_info *gpstates; in powernv_cpufreq_cpu_init() local
860 gpstates = kzalloc(sizeof(*gpstates), GFP_KERNEL); in powernv_cpufreq_cpu_init()
861 if (!gpstates) in powernv_cpufreq_cpu_init()
864 policy->driver_data = gpstates; in powernv_cpufreq_cpu_init()
867 gpstates->policy = policy; in powernv_cpufreq_cpu_init()
868 timer_setup(&gpstates->timer, gpstate_timer_handler, in powernv_cpufreq_cpu_init()
870 gpstates->timer.expires = jiffies + in powernv_cpufreq_cpu_init()
872 spin_lock_init(&gpstates->gpstate_lock); in powernv_cpufreq_cpu_init()
880 struct global_pstate_info *gpstates = policy->driver_data; in powernv_cpufreq_cpu_exit() local
885 if (gpstates) in powernv_cpufreq_cpu_exit()
886 del_timer_sync(&gpstates->timer); in powernv_cpufreq_cpu_exit()