aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/kirkwood-cpufreq.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-10-27 20:29:34 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-10-27 20:29:34 -0400
commit93658cb8597ab76655220be43d3d7f74c66e9e4e (patch)
treee6da56aac9cda2c80315cc73ee31ef4c47af8472 /drivers/cpufreq/kirkwood-cpufreq.c
parent6e0ca95aa3c83c47d13f9f400bfaaa853d0b224b (diff)
parentad7722dab7292dbc1c4586d701ac226b68122d39 (diff)
Merge branch 'pm-cpufreq'
* pm-cpufreq: (167 commits) cpufreq: create per policy rwsem instead of per CPU cpu_policy_rwsem intel_pstate: Add Baytrail support intel_pstate: Refactor driver to support CPUs with different MSR layouts cpufreq: Implement light weight ->target_index() routine PM / OPP: rename header to linux/pm_opp.h PM / OPP: rename data structures to dev_pm equivalents PM / OPP: rename functions to dev_pm_opp* cpufreq / governor: Remove fossil comment cpufreq: exynos4210: Use the common clock framework to set APLL clock rate cpufreq: exynos4x12: Use the common clock framework to set APLL clock rate cpufreq: Detect spurious invocations of update_policy_cpu() cpufreq: pmac64: enable cpufreq on iMac G5 (iSight) model cpufreq: pmac64: provide cpufreq transition latency for older G5 models cpufreq: pmac64: speed up frequency switch cpufreq: highbank-cpufreq: Enable Midway/ECX-2000 exynos-cpufreq: fix false return check from "regulator_set_voltage" speedstep-centrino: Remove unnecessary braces acpi-cpufreq: Add comment under ACPI_ADR_SPACE_SYSTEM_IO case cpufreq: arm-big-little: use clk_get instead of clk_get_sys cpufreq: exynos: Show a list of available frequencies ... Conflicts: drivers/devfreq/exynos/exynos5_bus.c
Diffstat (limited to 'drivers/cpufreq/kirkwood-cpufreq.c')
-rw-r--r--drivers/cpufreq/kirkwood-cpufreq.c55
1 files changed, 7 insertions, 48 deletions
diff --git a/drivers/cpufreq/kirkwood-cpufreq.c b/drivers/cpufreq/kirkwood-cpufreq.c
index ba10658a9394..0ae4dd7e1f2d 100644
--- a/drivers/cpufreq/kirkwood-cpufreq.c
+++ b/drivers/cpufreq/kirkwood-cpufreq.c
@@ -55,8 +55,8 @@ static unsigned int kirkwood_cpufreq_get_cpu_frequency(unsigned int cpu)
55 return kirkwood_freq_table[0].frequency; 55 return kirkwood_freq_table[0].frequency;
56} 56}
57 57
58static void kirkwood_cpufreq_set_cpu_state(struct cpufreq_policy *policy, 58static int kirkwood_cpufreq_target(struct cpufreq_policy *policy,
59 unsigned int index) 59 unsigned int index)
60{ 60{
61 struct cpufreq_freqs freqs; 61 struct cpufreq_freqs freqs;
62 unsigned int state = kirkwood_freq_table[index].driver_data; 62 unsigned int state = kirkwood_freq_table[index].driver_data;
@@ -100,24 +100,6 @@ static void kirkwood_cpufreq_set_cpu_state(struct cpufreq_policy *policy,
100 local_irq_enable(); 100 local_irq_enable();
101 } 101 }
102 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); 102 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
103};
104
105static int kirkwood_cpufreq_verify(struct cpufreq_policy *policy)
106{
107 return cpufreq_frequency_table_verify(policy, kirkwood_freq_table);
108}
109
110static int kirkwood_cpufreq_target(struct cpufreq_policy *policy,
111 unsigned int target_freq,
112 unsigned int relation)
113{
114 unsigned int index = 0;
115
116 if (cpufreq_frequency_table_target(policy, kirkwood_freq_table,
117 target_freq, relation, &index))
118 return -EINVAL;
119
120 kirkwood_cpufreq_set_cpu_state(policy, index);
121 103
122 return 0; 104 return 0;
123} 105}
@@ -125,40 +107,17 @@ static int kirkwood_cpufreq_target(struct cpufreq_policy *policy,
125/* Module init and exit code */ 107/* Module init and exit code */
126static int kirkwood_cpufreq_cpu_init(struct cpufreq_policy *policy) 108static int kirkwood_cpufreq_cpu_init(struct cpufreq_policy *policy)
127{ 109{
128 int result; 110 return cpufreq_generic_init(policy, kirkwood_freq_table, 5000);
129
130 /* cpuinfo and default policy values */
131 policy->cpuinfo.transition_latency = 5000; /* 5uS */
132 policy->cur = kirkwood_cpufreq_get_cpu_frequency(0);
133
134 result = cpufreq_frequency_table_cpuinfo(policy, kirkwood_freq_table);
135 if (result)
136 return result;
137
138 cpufreq_frequency_table_get_attr(kirkwood_freq_table, policy->cpu);
139
140 return 0;
141}
142
143static int kirkwood_cpufreq_cpu_exit(struct cpufreq_policy *policy)
144{
145 cpufreq_frequency_table_put_attr(policy->cpu);
146 return 0;
147} 111}
148 112
149static struct freq_attr *kirkwood_cpufreq_attr[] = {
150 &cpufreq_freq_attr_scaling_available_freqs,
151 NULL,
152};
153
154static struct cpufreq_driver kirkwood_cpufreq_driver = { 113static struct cpufreq_driver kirkwood_cpufreq_driver = {
155 .get = kirkwood_cpufreq_get_cpu_frequency, 114 .get = kirkwood_cpufreq_get_cpu_frequency,
156 .verify = kirkwood_cpufreq_verify, 115 .verify = cpufreq_generic_frequency_table_verify,
157 .target = kirkwood_cpufreq_target, 116 .target_index = kirkwood_cpufreq_target,
158 .init = kirkwood_cpufreq_cpu_init, 117 .init = kirkwood_cpufreq_cpu_init,
159 .exit = kirkwood_cpufreq_cpu_exit, 118 .exit = cpufreq_generic_exit,
160 .name = "kirkwood-cpufreq", 119 .name = "kirkwood-cpufreq",
161 .attr = kirkwood_cpufreq_attr, 120 .attr = cpufreq_generic_attr,
162}; 121};
163 122
164static int kirkwood_cpufreq_probe(struct platform_device *pdev) 123static int kirkwood_cpufreq_probe(struct platform_device *pdev)