Lines Matching +full:max +full:- +full:clk +full:- +full:rate +full:- +full:hz

4  * Copyright (C) 2002 - 2012 Paul Mundt
7 * Clock framework bits from arch/avr32/mach-at32ap/cpufreq.c
9 * Copyright (C) 2004-2007 Atmel Corporation
27 #include <linux/clk.h>
31 static DEFINE_PER_CPU(struct clk, sh_cpuclk);
46 struct cpufreq_policy *policy = target->policy; in __sh_cpufreq_target()
47 int cpu = policy->cpu; in __sh_cpufreq_target()
48 struct clk *cpuclk = &per_cpu(sh_cpuclk, cpu); in __sh_cpufreq_target()
54 return -ENODEV; in __sh_cpufreq_target()
58 /* Convert target_freq from kHz to Hz */ in __sh_cpufreq_target()
59 freq = clk_round_rate(cpuclk, target->freq * 1000); in __sh_cpufreq_target()
61 if (freq < (policy->min * 1000) || freq > (policy->max * 1000)) in __sh_cpufreq_target()
62 return -EINVAL; in __sh_cpufreq_target()
64 dev_dbg(dev, "requested frequency %u Hz\n", target->freq * 1000); in __sh_cpufreq_target()
70 cpufreq_freq_transition_begin(target->policy, &freqs); in __sh_cpufreq_target()
72 cpufreq_freq_transition_end(target->policy, &freqs, 0); in __sh_cpufreq_target()
74 dev_dbg(dev, "set frequency %lu Hz\n", freq); in __sh_cpufreq_target()
87 return work_on_cpu(policy->cpu, __sh_cpufreq_target, &data); in sh_cpufreq_target()
92 struct clk *cpuclk = &per_cpu(sh_cpuclk, policy->cpu); in sh_cpufreq_verify()
95 freq_table = cpuclk->nr_freqs ? cpuclk->freq_table : NULL; in sh_cpufreq_verify()
101 policy->min = (clk_round_rate(cpuclk, 1) + 500) / 1000; in sh_cpufreq_verify()
102 policy->max = (clk_round_rate(cpuclk, ~0UL) + 500) / 1000; in sh_cpufreq_verify()
110 unsigned int cpu = policy->cpu; in sh_cpufreq_cpu_init()
111 struct clk *cpuclk = &per_cpu(sh_cpuclk, cpu); in sh_cpufreq_cpu_init()
119 dev_err(dev, "couldn't get CPU clk\n"); in sh_cpufreq_cpu_init()
123 freq_table = cpuclk->nr_freqs ? cpuclk->freq_table : NULL; in sh_cpufreq_cpu_init()
125 policy->freq_table = freq_table; in sh_cpufreq_cpu_init()
128 "to rate rounding.\n"); in sh_cpufreq_cpu_init()
130 policy->min = policy->cpuinfo.min_freq = in sh_cpufreq_cpu_init()
132 policy->max = policy->cpuinfo.max_freq = in sh_cpufreq_cpu_init()
141 unsigned int cpu = policy->cpu; in sh_cpufreq_cpu_exit()
142 struct clk *cpuclk = &per_cpu(sh_cpuclk, cpu); in sh_cpufreq_cpu_exit()
151 struct device *dev = get_cpu_device(policy->cpu); in sh_cpufreq_cpu_ready()
153 dev_info(dev, "CPU Frequencies - Minimum %u.%03u MHz, " in sh_cpufreq_cpu_ready()
155 policy->min / 1000, policy->min % 1000, in sh_cpufreq_cpu_ready()
156 policy->max / 1000, policy->max % 1000); in sh_cpufreq_cpu_ready()
185 MODULE_AUTHOR("Paul Mundt <lethal@linux-sh.org>");