• Home
  • Raw
  • Download

Lines Matching +full:p +full:- +full:states

1 // SPDX-License-Identifier: GPL-2.0-only
3 * This file provides the ACPI based P-state support. This
6 * (arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c)
28 MODULE_DESCRIPTION("ACPI Processor P-States Driver");
59 return -ENODEV; in processor_set_pstate()
86 /* To be used only after data->acpi_data is initialized */
96 for (i = 0; i < data->acpi_data.state_count; i++) { in extract_clock()
97 if (value == data->acpi_data.states[i].status) in extract_clock()
98 return data->acpi_data.states[i].core_frequency; in extract_clock()
100 return data->acpi_data.states[i-1].core_frequency; in extract_clock()
109 unsigned int cpu = req->cpu; in processor_get_freq()
116 return -EAGAIN; in processor_get_freq()
133 unsigned int cpu = req->cpu; in processor_set_freq()
135 int ret, state = req->state; in processor_set_freq()
140 return -EAGAIN; in processor_set_freq()
142 if (state == data->acpi_data.state) { in processor_set_freq()
143 if (unlikely(data->resume)) { in processor_set_freq()
144 pr_debug("Called after resume, resetting to P%d\n", state); in processor_set_freq()
145 data->resume = 0; in processor_set_freq()
147 pr_debug("Already at target state (P%d)\n", state); in processor_set_freq()
152 pr_debug("Transitioning from P%d to P%d\n", in processor_set_freq()
153 data->acpi_data.state, state); in processor_set_freq()
159 value = (u32) data->acpi_data.states[state].control; in processor_set_freq()
166 return -ENODEV; in processor_set_freq()
169 data->acpi_data.state = state; in processor_set_freq()
195 req.cpu = policy->cpu; in acpi_cpufreq_target()
206 unsigned int cpu = policy->cpu; in acpi_cpufreq_cpu_init()
215 return (-ENOMEM); in acpi_cpufreq_cpu_init()
219 result = acpi_processor_register_performance(&data->acpi_data, cpu); in acpi_cpufreq_cpu_init()
225 if (data->acpi_data.state_count <= 1) { in acpi_cpufreq_cpu_init()
226 pr_debug("No P-States\n"); in acpi_cpufreq_cpu_init()
227 result = -ENODEV; in acpi_cpufreq_cpu_init()
231 if ((data->acpi_data.control_register.space_id != in acpi_cpufreq_cpu_init()
233 (data->acpi_data.status_register.space_id != in acpi_cpufreq_cpu_init()
236 (u32) (data->acpi_data.control_register.space_id), in acpi_cpufreq_cpu_init()
237 (u32) (data->acpi_data.status_register.space_id)); in acpi_cpufreq_cpu_init()
238 result = -ENODEV; in acpi_cpufreq_cpu_init()
243 freq_table = kcalloc(data->acpi_data.state_count + 1, in acpi_cpufreq_cpu_init()
247 result = -ENOMEM; in acpi_cpufreq_cpu_init()
252 policy->cpuinfo.transition_latency = 0; in acpi_cpufreq_cpu_init()
253 for (i=0; i<data->acpi_data.state_count; i++) { in acpi_cpufreq_cpu_init()
254 if ((data->acpi_data.states[i].transition_latency * 1000) > in acpi_cpufreq_cpu_init()
255 policy->cpuinfo.transition_latency) { in acpi_cpufreq_cpu_init()
256 policy->cpuinfo.transition_latency = in acpi_cpufreq_cpu_init()
257 data->acpi_data.states[i].transition_latency * 1000; in acpi_cpufreq_cpu_init()
262 for (i = 0; i <= data->acpi_data.state_count; i++) in acpi_cpufreq_cpu_init()
264 if (i < data->acpi_data.state_count) { in acpi_cpufreq_cpu_init()
266 data->acpi_data.states[i].core_frequency * 1000; in acpi_cpufreq_cpu_init()
272 policy->freq_table = freq_table; in acpi_cpufreq_cpu_init()
277 pr_info("CPU%u - ACPI performance management activated\n", cpu); in acpi_cpufreq_cpu_init()
279 for (i = 0; i < data->acpi_data.state_count; i++) in acpi_cpufreq_cpu_init()
281 (i == data->acpi_data.state?'*':' '), i, in acpi_cpufreq_cpu_init()
282 (u32) data->acpi_data.states[i].core_frequency, in acpi_cpufreq_cpu_init()
283 (u32) data->acpi_data.states[i].power, in acpi_cpufreq_cpu_init()
284 (u32) data->acpi_data.states[i].transition_latency, in acpi_cpufreq_cpu_init()
285 (u32) data->acpi_data.states[i].bus_master_latency, in acpi_cpufreq_cpu_init()
286 (u32) data->acpi_data.states[i].status, in acpi_cpufreq_cpu_init()
287 (u32) data->acpi_data.states[i].control); in acpi_cpufreq_cpu_init()
289 /* the first call to ->target() should result in us actually in acpi_cpufreq_cpu_init()
291 data->resume = 1; in acpi_cpufreq_cpu_init()
309 struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu]; in acpi_cpufreq_cpu_exit()
314 acpi_io_data[policy->cpu] = NULL; in acpi_cpufreq_cpu_exit()
315 acpi_processor_unregister_performance(policy->cpu); in acpi_cpufreq_cpu_exit()
316 kfree(policy->freq_table); in acpi_cpufreq_cpu_exit()
330 .name = "acpi-cpufreq",