Lines Matching refs:gpstates
226 struct global_pstate_info *gpstates = policy->driver_data; in reset_gpstates() local
228 gpstates->highest_lpstate_idx = 0; in reset_gpstates()
229 gpstates->elapsed_time = 0; in reset_gpstates()
230 gpstates->last_sampled_time = 0; in reset_gpstates()
231 gpstates->last_lpstate_idx = 0; in reset_gpstates()
232 gpstates->last_gpstate_idx = 0; in reset_gpstates()
642 static inline void queue_gpstate_timer(struct global_pstate_info *gpstates) in queue_gpstate_timer() argument
652 if ((gpstates->elapsed_time + GPSTATE_TIMER_INTERVAL) in queue_gpstate_timer()
654 timer_interval = MAX_RAMP_DOWN_TIME - gpstates->elapsed_time; in queue_gpstate_timer()
658 mod_timer(&gpstates->timer, jiffies + msecs_to_jiffies(timer_interval)); in queue_gpstate_timer()
672 struct global_pstate_info *gpstates = from_timer(gpstates, t, timer); in gpstate_timer_handler() local
673 struct cpufreq_policy *policy = gpstates->policy; in gpstate_timer_handler()
677 - gpstates->last_sampled_time; in gpstate_timer_handler()
680 if (!spin_trylock(&gpstates->gpstate_lock)) in gpstate_timer_handler()
687 gpstates->timer.expires = jiffies + msecs_to_jiffies(1); in gpstate_timer_handler()
688 add_timer_on(&gpstates->timer, cpumask_first(policy->cpus)); in gpstate_timer_handler()
689 spin_unlock(&gpstates->gpstate_lock); in gpstate_timer_handler()
703 spin_unlock(&gpstates->gpstate_lock); in gpstate_timer_handler()
707 gpstates->last_sampled_time += time_diff; in gpstate_timer_handler()
708 gpstates->elapsed_time += time_diff; in gpstate_timer_handler()
710 if (gpstates->elapsed_time > MAX_RAMP_DOWN_TIME) { in gpstate_timer_handler()
714 gpstates->highest_lpstate_idx = gpstate_idx; in gpstate_timer_handler()
717 gpstate_idx = calc_global_pstate(gpstates->elapsed_time, in gpstate_timer_handler()
718 gpstates->highest_lpstate_idx, in gpstate_timer_handler()
722 gpstates->last_gpstate_idx = gpstate_idx; in gpstate_timer_handler()
723 gpstates->last_lpstate_idx = lpstate_idx; in gpstate_timer_handler()
728 if (gpstate_idx != gpstates->last_lpstate_idx) in gpstate_timer_handler()
729 queue_gpstate_timer(gpstates); in gpstate_timer_handler()
732 spin_unlock(&gpstates->gpstate_lock); in gpstate_timer_handler()
745 struct global_pstate_info *gpstates = policy->driver_data; in powernv_cpufreq_target_index() local
762 if (!gpstates) { in powernv_cpufreq_target_index()
767 spin_lock(&gpstates->gpstate_lock); in powernv_cpufreq_target_index()
769 if (!gpstates->last_sampled_time) { in powernv_cpufreq_target_index()
771 gpstates->highest_lpstate_idx = new_index; in powernv_cpufreq_target_index()
775 if (gpstates->last_gpstate_idx < new_index) { in powernv_cpufreq_target_index()
776 gpstates->elapsed_time += cur_msec - in powernv_cpufreq_target_index()
777 gpstates->last_sampled_time; in powernv_cpufreq_target_index()
784 if (gpstates->elapsed_time > MAX_RAMP_DOWN_TIME) { in powernv_cpufreq_target_index()
786 gpstates->highest_lpstate_idx = new_index; in powernv_cpufreq_target_index()
790 gpstate_idx = calc_global_pstate(gpstates->elapsed_time, in powernv_cpufreq_target_index()
791 gpstates->highest_lpstate_idx, in powernv_cpufreq_target_index()
796 gpstates->highest_lpstate_idx = new_index; in powernv_cpufreq_target_index()
805 queue_gpstate_timer(gpstates); in powernv_cpufreq_target_index()
807 del_timer_sync(&gpstates->timer); in powernv_cpufreq_target_index()
811 gpstates->last_sampled_time = cur_msec; in powernv_cpufreq_target_index()
812 gpstates->last_gpstate_idx = gpstate_idx; in powernv_cpufreq_target_index()
813 gpstates->last_lpstate_idx = new_index; in powernv_cpufreq_target_index()
815 spin_unlock(&gpstates->gpstate_lock); in powernv_cpufreq_target_index()
831 struct global_pstate_info *gpstates; in powernv_cpufreq_cpu_init() local
859 gpstates = kzalloc(sizeof(*gpstates), GFP_KERNEL); in powernv_cpufreq_cpu_init()
860 if (!gpstates) in powernv_cpufreq_cpu_init()
863 policy->driver_data = gpstates; in powernv_cpufreq_cpu_init()
866 gpstates->policy = policy; in powernv_cpufreq_cpu_init()
867 timer_setup(&gpstates->timer, gpstate_timer_handler, in powernv_cpufreq_cpu_init()
869 gpstates->timer.expires = jiffies + in powernv_cpufreq_cpu_init()
871 spin_lock_init(&gpstates->gpstate_lock); in powernv_cpufreq_cpu_init()
1007 struct global_pstate_info *gpstates = policy->driver_data; in powernv_cpufreq_stop_cpu() local
1012 if (gpstates) in powernv_cpufreq_stop_cpu()
1013 del_timer_sync(&gpstates->timer); in powernv_cpufreq_stop_cpu()