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
26 #include <linux/clk.h>
30 static DEFINE_PER_CPU(struct clk, sh_cpuclk);
45 struct cpufreq_policy *policy = target->policy; in __sh_cpufreq_target()
46 int cpu = policy->cpu; in __sh_cpufreq_target()
47 struct clk *cpuclk = &per_cpu(sh_cpuclk, cpu); in __sh_cpufreq_target()
53 return -ENODEV; in __sh_cpufreq_target()
57 /* Convert target_freq from kHz to Hz */ in __sh_cpufreq_target()
58 freq = clk_round_rate(cpuclk, target->freq * 1000); in __sh_cpufreq_target()
60 if (freq < (policy->min * 1000) || freq > (policy->max * 1000)) in __sh_cpufreq_target()
61 return -EINVAL; in __sh_cpufreq_target()
63 dev_dbg(dev, "requested frequency %u Hz\n", target->freq * 1000); in __sh_cpufreq_target()
69 cpufreq_freq_transition_begin(target->policy, &freqs); in __sh_cpufreq_target()
71 cpufreq_freq_transition_end(target->policy, &freqs, 0); in __sh_cpufreq_target()
73 dev_dbg(dev, "set frequency %lu Hz\n", freq); in __sh_cpufreq_target()
86 return work_on_cpu(policy->cpu, __sh_cpufreq_target, &data); in sh_cpufreq_target()
91 struct clk *cpuclk = &per_cpu(sh_cpuclk, policy->cpu); in sh_cpufreq_verify()
94 freq_table = cpuclk->nr_freqs ? cpuclk->freq_table : NULL; in sh_cpufreq_verify()
100 policy->min = (clk_round_rate(cpuclk, 1) + 500) / 1000; in sh_cpufreq_verify()
101 policy->max = (clk_round_rate(cpuclk, ~0UL) + 500) / 1000; in sh_cpufreq_verify()
109 unsigned int cpu = policy->cpu; in sh_cpufreq_cpu_init()
110 struct clk *cpuclk = &per_cpu(sh_cpuclk, cpu); in sh_cpufreq_cpu_init()
118 dev_err(dev, "couldn't get CPU clk\n"); in sh_cpufreq_cpu_init()
122 freq_table = cpuclk->nr_freqs ? cpuclk->freq_table : NULL; in sh_cpufreq_cpu_init()
124 policy->freq_table = freq_table; in sh_cpufreq_cpu_init()
127 "to rate rounding.\n"); in sh_cpufreq_cpu_init()
129 policy->min = policy->cpuinfo.min_freq = in sh_cpufreq_cpu_init()
131 policy->max = policy->cpuinfo.max_freq = in sh_cpufreq_cpu_init()
140 unsigned int cpu = policy->cpu; in sh_cpufreq_cpu_exit()
141 struct clk *cpuclk = &per_cpu(sh_cpuclk, cpu); in sh_cpufreq_cpu_exit()
173 MODULE_AUTHOR("Paul Mundt <lethal@linux-sh.org>");