.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * S3C2416/2450 CPUfreq Support |
---|
3 | 4 | * |
---|
.. | .. |
---|
6 | 7 | * based on s3c64xx_cpufreq.c |
---|
7 | 8 | * |
---|
8 | 9 | * Copyright 2009 Wolfson Microelectronics plc |
---|
9 | | - * |
---|
10 | | - * This program is free software; you can redistribute it and/or modify |
---|
11 | | - * it under the terms of the GNU General Public License version 2 as |
---|
12 | | - * published by the Free Software Foundation. |
---|
13 | 10 | */ |
---|
14 | 11 | |
---|
15 | 12 | #include <linux/kernel.h> |
---|
.. | .. |
---|
307 | 304 | { |
---|
308 | 305 | struct s3c2416_data *s3c_freq = &s3c2416_cpufreq; |
---|
309 | 306 | int ret; |
---|
| 307 | + struct cpufreq_policy *policy; |
---|
310 | 308 | |
---|
311 | 309 | mutex_lock(&cpufreq_lock); |
---|
312 | 310 | |
---|
.. | .. |
---|
321 | 319 | */ |
---|
322 | 320 | if (s3c_freq->is_dvs) { |
---|
323 | 321 | pr_debug("cpufreq: leave dvs on reboot\n"); |
---|
324 | | - ret = cpufreq_driver_target(cpufreq_cpu_get(0), FREQ_SLEEP, 0); |
---|
| 322 | + |
---|
| 323 | + policy = cpufreq_cpu_get(0); |
---|
| 324 | + if (!policy) { |
---|
| 325 | + pr_debug("cpufreq: get no policy for cpu0\n"); |
---|
| 326 | + return NOTIFY_BAD; |
---|
| 327 | + } |
---|
| 328 | + |
---|
| 329 | + ret = cpufreq_driver_target(policy, FREQ_SLEEP, 0); |
---|
| 330 | + cpufreq_cpu_put(policy); |
---|
| 331 | + |
---|
325 | 332 | if (ret < 0) |
---|
326 | 333 | return NOTIFY_BAD; |
---|
327 | 334 | } |
---|
.. | .. |
---|
450 | 457 | /* Datasheet says PLL stabalisation time must be at least 300us, |
---|
451 | 458 | * so but add some fudge. (reference in LOCKCON0 register description) |
---|
452 | 459 | */ |
---|
453 | | - ret = cpufreq_generic_init(policy, s3c_freq->freq_table, |
---|
| 460 | + cpufreq_generic_init(policy, s3c_freq->freq_table, |
---|
454 | 461 | (500 * 1000) + s3c_freq->regulator_latency); |
---|
455 | | - if (ret) |
---|
456 | | - goto err_freq_table; |
---|
457 | | - |
---|
458 | 462 | register_reboot_notifier(&s3c2416_cpufreq_reboot_notifier); |
---|
459 | 463 | |
---|
460 | 464 | return 0; |
---|
461 | 465 | |
---|
462 | | -err_freq_table: |
---|
463 | 466 | #ifdef CONFIG_ARM_S3C2416_CPUFREQ_VCORESCALE |
---|
464 | | - regulator_put(s3c_freq->vddarm); |
---|
465 | 467 | err_vddarm: |
---|
466 | | -#endif |
---|
467 | 468 | clk_put(s3c_freq->armclk); |
---|
| 469 | +#endif |
---|
468 | 470 | err_armclk: |
---|
469 | 471 | clk_put(s3c_freq->hclk); |
---|
470 | 472 | err_hclk: |
---|