Lines Matching refs:cpufreq_device

269 static int build_dyn_power_table(struct cpufreq_cooling_device *cpufreq_device,  in build_dyn_power_table()  argument
278 for_each_cpu(cpu, &cpufreq_device->allowed_cpus) { in build_dyn_power_table()
281 dev_warn(&cpufreq_device->cool_dev->device, in build_dyn_power_table()
338 cpufreq_device->cpu_dev = dev; in build_dyn_power_table()
339 cpufreq_device->dyn_power_table = power_table; in build_dyn_power_table()
340 cpufreq_device->dyn_power_table_entries = i; in build_dyn_power_table()
350 static u32 cpu_freq_to_power(struct cpufreq_cooling_device *cpufreq_device, in cpu_freq_to_power() argument
354 struct power_table *pt = cpufreq_device->dyn_power_table; in cpu_freq_to_power()
356 for (i = 1; i < cpufreq_device->dyn_power_table_entries; i++) in cpu_freq_to_power()
363 static u32 cpu_power_to_freq(struct cpufreq_cooling_device *cpufreq_device, in cpu_power_to_freq() argument
367 struct power_table *pt = cpufreq_device->dyn_power_table; in cpu_power_to_freq()
369 for (i = 1; i < cpufreq_device->dyn_power_table_entries; i++) in cpu_power_to_freq()
385 static u32 get_load(struct cpufreq_cooling_device *cpufreq_device, int cpu, in get_load() argument
392 delta_idle = now_idle - cpufreq_device->time_in_idle[cpu_idx]; in get_load()
393 delta_time = now - cpufreq_device->time_in_idle_timestamp[cpu_idx]; in get_load()
400 cpufreq_device->time_in_idle[cpu_idx] = now_idle; in get_load()
401 cpufreq_device->time_in_idle_timestamp[cpu_idx] = now; in get_load()
421 static int get_static_power(struct cpufreq_cooling_device *cpufreq_device, in get_static_power() argument
427 struct cpumask *cpumask = &cpufreq_device->allowed_cpus; in get_static_power()
430 if (!cpufreq_device->plat_get_static_power || in get_static_power()
431 !cpufreq_device->cpu_dev) { in get_static_power()
438 opp = dev_pm_opp_find_freq_exact(cpufreq_device->cpu_dev, freq_hz, in get_static_power()
445 dev_warn_ratelimited(cpufreq_device->cpu_dev, in get_static_power()
451 return cpufreq_device->plat_get_static_power(cpumask, tz->passive_delay, in get_static_power()
463 static u32 get_dynamic_power(struct cpufreq_cooling_device *cpufreq_device, in get_dynamic_power() argument
468 raw_cpu_power = cpu_freq_to_power(cpufreq_device, freq); in get_dynamic_power()
469 return (raw_cpu_power * cpufreq_device->last_load) / 100; in get_dynamic_power()
487 struct cpufreq_cooling_device *cpufreq_device = cdev->devdata; in cpufreq_get_max_state() local
489 *state = cpufreq_device->max_level; in cpufreq_get_max_state()
506 struct cpufreq_cooling_device *cpufreq_device = cdev->devdata; in cpufreq_get_cur_state() local
508 *state = cpufreq_device->cpufreq_state; in cpufreq_get_cur_state()
526 struct cpufreq_cooling_device *cpufreq_device = cdev->devdata; in cpufreq_set_cur_state() local
527 unsigned int cpu = cpumask_any(&cpufreq_device->allowed_cpus); in cpufreq_set_cur_state()
531 if (WARN_ON(state > cpufreq_device->max_level)) in cpufreq_set_cur_state()
535 if (cpufreq_device->cpufreq_state == state) in cpufreq_set_cur_state()
538 clip_freq = cpufreq_device->freq_table[state]; in cpufreq_set_cur_state()
539 cpufreq_device->cpufreq_state = state; in cpufreq_set_cur_state()
540 cpufreq_device->clipped_freq = clip_freq; in cpufreq_set_cur_state()
577 struct cpufreq_cooling_device *cpufreq_device = cdev->devdata; in cpufreq_get_requested_power() local
580 cpu = cpumask_any_and(&cpufreq_device->allowed_cpus, cpu_online_mask); in cpufreq_get_requested_power()
594 u32 ncpus = cpumask_weight(&cpufreq_device->allowed_cpus); in cpufreq_get_requested_power()
599 for_each_cpu(cpu, &cpufreq_device->allowed_cpus) { in cpufreq_get_requested_power()
603 load = get_load(cpufreq_device, cpu, i); in cpufreq_get_requested_power()
614 cpufreq_device->last_load = total_load; in cpufreq_get_requested_power()
616 dynamic_power = get_dynamic_power(cpufreq_device, freq); in cpufreq_get_requested_power()
617 ret = get_static_power(cpufreq_device, tz, freq, &static_power); in cpufreq_get_requested_power()
625 &cpufreq_device->allowed_cpus, in cpufreq_get_requested_power()
658 struct cpufreq_cooling_device *cpufreq_device = cdev->devdata; in cpufreq_state2power() local
660 cpumask_and(&cpumask, &cpufreq_device->allowed_cpus, cpu_online_mask); in cpufreq_state2power()
669 freq = cpufreq_device->freq_table[state]; in cpufreq_state2power()
673 dynamic_power = cpu_freq_to_power(cpufreq_device, freq) * num_cpus; in cpufreq_state2power()
674 ret = get_static_power(cpufreq_device, tz, freq, &static_power); in cpufreq_state2power()
710 struct cpufreq_cooling_device *cpufreq_device = cdev->devdata; in cpufreq_power2state() local
712 cpu = cpumask_any_and(&cpufreq_device->allowed_cpus, cpu_online_mask); in cpufreq_power2state()
719 ret = get_static_power(cpufreq_device, tz, cur_freq, &static_power); in cpufreq_power2state()
725 last_load = cpufreq_device->last_load ?: 1; in cpufreq_power2state()
727 target_freq = cpu_power_to_freq(cpufreq_device, normalised_power); in cpufreq_power2state()
737 trace_thermal_power_cpu_limit(&cpufreq_device->allowed_cpus, in cpufreq_power2state()