Lines Matching +full:clk +full:- +full:out +full:- +full:frequency
1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (C) 2013 - 2019 ARM Ltd.
14 #include <linux/clk.h>
48 static struct clk *clk[MAX_CLUSTERS]; variable
53 static unsigned int clk_little_max; /* Maximum clock frequency (Little) */
90 u32 rate = clk_get_rate(clk[cur_cluster]) / 1000; in clk_get_cpu_rate()
127 ret = clk_set_rate(clk[new_cluster], new_rate * 1000); in ve_spc_cpufreq_set_rate()
133 * current design of the clk core layer. To work around this in ve_spc_cpufreq_set_rate()
135 * correct. This needs to be removed once clk core is fixed. in ve_spc_cpufreq_set_rate()
137 if (clk_get_rate(clk[new_cluster]) != new_rate * 1000) in ve_spc_cpufreq_set_rate()
138 ret = -EIO; in ve_spc_cpufreq_set_rate()
166 clk_set_rate(clk[old_cluster], new_rate * 1000)) { in ve_spc_cpufreq_set_rate()
176 /* Set clock frequency */
180 u32 cpu = policy->cpu, cur_cluster, new_cluster, actual_cluster; in ve_spc_cpufreq_set_target()
186 freqs_new = freq_table[cur_cluster][index].frequency; in ve_spc_cpufreq_set_target()
204 for (count = 0; table[count].frequency != CPUFREQ_TABLE_END; count++) in get_table_count()
210 /* get the minimum frequency in the cpufreq_frequency_table */
217 if (pos->frequency < min_freq) in get_table_min()
218 min_freq = pos->frequency; in get_table_min()
222 /* get the maximum frequency in the cpufreq_frequency_table */
229 if (pos->frequency > max_freq) in get_table_max()
230 max_freq = pos->frequency; in get_table_max()
240 if (table[count].frequency == freq) in search_frequency()
257 return -ENOMEM; in merge_cluster_tables()
262 for (i = MAX_CLUSTERS - 1; i >= 0; i--, count = k) { in merge_cluster_tables()
263 for (j = 0; freq_table[i][j].frequency != CPUFREQ_TABLE_END; in merge_cluster_tables()
266 search_frequency(table, count, freq_table[i][j].frequency)) in merge_cluster_tables()
268 table[k++].frequency = in merge_cluster_tables()
269 VIRT_FREQ(i, freq_table[i][j].frequency); in merge_cluster_tables()
274 table[k].frequency = CPUFREQ_TABLE_END; in merge_cluster_tables()
282 u32 cluster = raw_cpu_to_cluster(cpu_dev->id); in _put_cluster_clk_and_freq_table()
287 clk_put(clk[cluster]); in _put_cluster_clk_and_freq_table()
294 u32 cluster = cpu_to_cluster(cpu_dev->id); in put_cluster_clk_and_freq_table()
319 u32 cluster = raw_cpu_to_cluster(cpu_dev->id); in _get_cluster_clk_and_freq_table()
327 * so just check if the OPP count is non-zero in _get_cluster_clk_and_freq_table()
331 goto out; in _get_cluster_clk_and_freq_table()
335 goto out; in _get_cluster_clk_and_freq_table()
337 clk[cluster] = clk_get(cpu_dev, NULL); in _get_cluster_clk_and_freq_table()
338 if (!IS_ERR(clk[cluster])) in _get_cluster_clk_and_freq_table()
341 dev_err(cpu_dev, "%s: Failed to get clk for cpu: %d, cluster: %d\n", in _get_cluster_clk_and_freq_table()
342 __func__, cpu_dev->id, cluster); in _get_cluster_clk_and_freq_table()
343 ret = PTR_ERR(clk[cluster]); in _get_cluster_clk_and_freq_table()
346 out: in _get_cluster_clk_and_freq_table()
355 u32 cluster = cpu_to_cluster(cpu_dev->id); in get_cluster_clk_and_freq_table()
376 return -ENODEV; in get_cluster_clk_and_freq_table()
399 return -ENODEV; in get_cluster_clk_and_freq_table()
409 /* Per-CPU initialization */
412 u32 cur_cluster = cpu_to_cluster(policy->cpu); in ve_spc_cpufreq_init()
416 cpu_dev = get_cpu_device(policy->cpu); in ve_spc_cpufreq_init()
419 policy->cpu); in ve_spc_cpufreq_init()
420 return -ENODEV; in ve_spc_cpufreq_init()
426 dev_pm_opp_get_sharing_cpus(cpu_dev, policy->cpus); in ve_spc_cpufreq_init()
428 for_each_cpu(cpu, policy->cpus) in ve_spc_cpufreq_init()
432 per_cpu(physical_cluster, policy->cpu) = A15_CLUSTER; in ve_spc_cpufreq_init()
435 ret = get_cluster_clk_and_freq_table(cpu_dev, policy->cpus); in ve_spc_cpufreq_init()
439 policy->freq_table = freq_table[cur_cluster]; in ve_spc_cpufreq_init()
440 policy->cpuinfo.transition_latency = 1000000; /* 1 ms */ in ve_spc_cpufreq_init()
443 per_cpu(cpu_last_req_freq, policy->cpu) = in ve_spc_cpufreq_init()
444 clk_get_cpu_rate(policy->cpu); in ve_spc_cpufreq_init()
446 dev_info(cpu_dev, "%s: CPU %d initialized\n", __func__, policy->cpu); in ve_spc_cpufreq_init()
454 cpu_dev = get_cpu_device(policy->cpu); in ve_spc_cpufreq_exit()
457 policy->cpu); in ve_spc_cpufreq_exit()
461 put_cluster_clk_and_freq_table(cpu_dev, policy->related_cpus); in ve_spc_cpufreq_exit()
465 .name = "vexpress-spc",
559 pr_info("%s: Un-registered platform driver: %s\n", __func__, in ve_spc_cpufreq_remove()
565 .name = "vexpress-spc-cpufreq",
572 MODULE_ALIAS("platform:vexpress-spc-cpufreq");