diff options
author | Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> | 2015-09-08 12:41:03 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-09-08 20:22:55 -0400 |
commit | 953ba9ff77f3d08635712eaeffb218d46889b58a (patch) | |
tree | 46aa18e75ff08674183b8fe9610304a1368e9b58 | |
parent | 201f3716575781b83259ed026845a213c2355035 (diff) |
cpufreq-dt: add suspend frequency support
Add suspend frequency support and if needed set it to
the frequency obtained from the suspend opp (can be defined
using opp-v2 bindings and is optional).
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/cpufreq/cpufreq-dt.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index 3b64c203bf99..7c0d70e2a861 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c | |||
@@ -196,6 +196,7 @@ static int cpufreq_init(struct cpufreq_policy *policy) | |||
196 | struct device *cpu_dev; | 196 | struct device *cpu_dev; |
197 | struct regulator *cpu_reg; | 197 | struct regulator *cpu_reg; |
198 | struct clk *cpu_clk; | 198 | struct clk *cpu_clk; |
199 | struct dev_pm_opp *suspend_opp; | ||
199 | unsigned long min_uV = ~0, max_uV = 0; | 200 | unsigned long min_uV = ~0, max_uV = 0; |
200 | unsigned int transition_latency; | 201 | unsigned int transition_latency; |
201 | bool need_update = false; | 202 | bool need_update = false; |
@@ -333,6 +334,13 @@ static int cpufreq_init(struct cpufreq_policy *policy) | |||
333 | policy->driver_data = priv; | 334 | policy->driver_data = priv; |
334 | 335 | ||
335 | policy->clk = cpu_clk; | 336 | policy->clk = cpu_clk; |
337 | |||
338 | rcu_read_lock(); | ||
339 | suspend_opp = dev_pm_opp_get_suspend_opp(cpu_dev); | ||
340 | if (suspend_opp) | ||
341 | policy->suspend_freq = dev_pm_opp_get_freq(suspend_opp) / 1000; | ||
342 | rcu_read_unlock(); | ||
343 | |||
336 | ret = cpufreq_table_validate_and_show(policy, freq_table); | 344 | ret = cpufreq_table_validate_and_show(policy, freq_table); |
337 | if (ret) { | 345 | if (ret) { |
338 | dev_err(cpu_dev, "%s: invalid frequency table: %d\n", __func__, | 346 | dev_err(cpu_dev, "%s: invalid frequency table: %d\n", __func__, |
@@ -423,6 +431,7 @@ static struct cpufreq_driver dt_cpufreq_driver = { | |||
423 | .ready = cpufreq_ready, | 431 | .ready = cpufreq_ready, |
424 | .name = "cpufreq-dt", | 432 | .name = "cpufreq-dt", |
425 | .attr = cpufreq_dt_attr, | 433 | .attr = cpufreq_dt_attr, |
434 | .suspend = cpufreq_generic_suspend, | ||
426 | }; | 435 | }; |
427 | 436 | ||
428 | static int dt_cpufreq_probe(struct platform_device *pdev) | 437 | static int dt_cpufreq_probe(struct platform_device *pdev) |