aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/devfreq/exynos
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/devfreq/exynos')
-rw-r--r--drivers/devfreq/exynos/exynos4_bus.c29
-rw-r--r--drivers/devfreq/exynos/exynos5_bus.c57
2 files changed, 37 insertions, 49 deletions
diff --git a/drivers/devfreq/exynos/exynos4_bus.c b/drivers/devfreq/exynos/exynos4_bus.c
index c5f86d8caca3..cede6f71cd63 100644
--- a/drivers/devfreq/exynos/exynos4_bus.c
+++ b/drivers/devfreq/exynos/exynos4_bus.c
@@ -19,7 +19,7 @@
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/mutex.h> 20#include <linux/mutex.h>
21#include <linux/suspend.h> 21#include <linux/suspend.h>
22#include <linux/opp.h> 22#include <linux/pm_opp.h>
23#include <linux/devfreq.h> 23#include <linux/devfreq.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/regulator/consumer.h> 25#include <linux/regulator/consumer.h>
@@ -639,7 +639,7 @@ static int exynos4_bus_target(struct device *dev, unsigned long *_freq,
639 struct platform_device *pdev = container_of(dev, struct platform_device, 639 struct platform_device *pdev = container_of(dev, struct platform_device,
640 dev); 640 dev);
641 struct busfreq_data *data = platform_get_drvdata(pdev); 641 struct busfreq_data *data = platform_get_drvdata(pdev);
642 struct opp *opp; 642 struct dev_pm_opp *opp;
643 unsigned long freq; 643 unsigned long freq;
644 unsigned long old_freq = data->curr_oppinfo.rate; 644 unsigned long old_freq = data->curr_oppinfo.rate;
645 struct busfreq_opp_info new_oppinfo; 645 struct busfreq_opp_info new_oppinfo;
@@ -650,8 +650,8 @@ static int exynos4_bus_target(struct device *dev, unsigned long *_freq,
650 rcu_read_unlock(); 650 rcu_read_unlock();
651 return PTR_ERR(opp); 651 return PTR_ERR(opp);
652 } 652 }
653 new_oppinfo.rate = opp_get_freq(opp); 653 new_oppinfo.rate = dev_pm_opp_get_freq(opp);
654 new_oppinfo.volt = opp_get_voltage(opp); 654 new_oppinfo.volt = dev_pm_opp_get_voltage(opp);
655 rcu_read_unlock(); 655 rcu_read_unlock();
656 freq = new_oppinfo.rate; 656 freq = new_oppinfo.rate;
657 657
@@ -873,7 +873,7 @@ static int exynos4210_init_tables(struct busfreq_data *data)
873 exynos4210_busclk_table[i].volt = exynos4210_asv_volt[mgrp][i]; 873 exynos4210_busclk_table[i].volt = exynos4210_asv_volt[mgrp][i];
874 874
875 for (i = LV_0; i < EX4210_LV_NUM; i++) { 875 for (i = LV_0; i < EX4210_LV_NUM; i++) {
876 err = opp_add(data->dev, exynos4210_busclk_table[i].clk, 876 err = dev_pm_opp_add(data->dev, exynos4210_busclk_table[i].clk,
877 exynos4210_busclk_table[i].volt); 877 exynos4210_busclk_table[i].volt);
878 if (err) { 878 if (err) {
879 dev_err(data->dev, "Cannot add opp entries.\n"); 879 dev_err(data->dev, "Cannot add opp entries.\n");
@@ -940,7 +940,7 @@ static int exynos4x12_init_tables(struct busfreq_data *data)
940 } 940 }
941 941
942 for (i = 0; i < EX4x12_LV_NUM; i++) { 942 for (i = 0; i < EX4x12_LV_NUM; i++) {
943 ret = opp_add(data->dev, exynos4x12_mifclk_table[i].clk, 943 ret = dev_pm_opp_add(data->dev, exynos4x12_mifclk_table[i].clk,
944 exynos4x12_mifclk_table[i].volt); 944 exynos4x12_mifclk_table[i].volt);
945 if (ret) { 945 if (ret) {
946 dev_err(data->dev, "Fail to add opp entries.\n"); 946 dev_err(data->dev, "Fail to add opp entries.\n");
@@ -956,7 +956,7 @@ static int exynos4_busfreq_pm_notifier_event(struct notifier_block *this,
956{ 956{
957 struct busfreq_data *data = container_of(this, struct busfreq_data, 957 struct busfreq_data *data = container_of(this, struct busfreq_data,
958 pm_notifier); 958 pm_notifier);
959 struct opp *opp; 959 struct dev_pm_opp *opp;
960 struct busfreq_opp_info new_oppinfo; 960 struct busfreq_opp_info new_oppinfo;
961 unsigned long maxfreq = ULONG_MAX; 961 unsigned long maxfreq = ULONG_MAX;
962 int err = 0; 962 int err = 0;
@@ -969,7 +969,7 @@ static int exynos4_busfreq_pm_notifier_event(struct notifier_block *this,
969 data->disabled = true; 969 data->disabled = true;
970 970
971 rcu_read_lock(); 971 rcu_read_lock();
972 opp = opp_find_freq_floor(data->dev, &maxfreq); 972 opp = dev_pm_opp_find_freq_floor(data->dev, &maxfreq);
973 if (IS_ERR(opp)) { 973 if (IS_ERR(opp)) {
974 rcu_read_unlock(); 974 rcu_read_unlock();
975 dev_err(data->dev, "%s: unable to find a min freq\n", 975 dev_err(data->dev, "%s: unable to find a min freq\n",
@@ -977,8 +977,8 @@ static int exynos4_busfreq_pm_notifier_event(struct notifier_block *this,
977 mutex_unlock(&data->lock); 977 mutex_unlock(&data->lock);
978 return PTR_ERR(opp); 978 return PTR_ERR(opp);
979 } 979 }
980 new_oppinfo.rate = opp_get_freq(opp); 980 new_oppinfo.rate = dev_pm_opp_get_freq(opp);
981 new_oppinfo.volt = opp_get_voltage(opp); 981 new_oppinfo.volt = dev_pm_opp_get_voltage(opp);
982 rcu_read_unlock(); 982 rcu_read_unlock();
983 983
984 err = exynos4_bus_setvolt(data, &new_oppinfo, 984 err = exynos4_bus_setvolt(data, &new_oppinfo,
@@ -1020,7 +1020,7 @@ unlock:
1020static int exynos4_busfreq_probe(struct platform_device *pdev) 1020static int exynos4_busfreq_probe(struct platform_device *pdev)
1021{ 1021{
1022 struct busfreq_data *data; 1022 struct busfreq_data *data;
1023 struct opp *opp; 1023 struct dev_pm_opp *opp;
1024 struct device *dev = &pdev->dev; 1024 struct device *dev = &pdev->dev;
1025 int err = 0; 1025 int err = 0;
1026 1026
@@ -1065,15 +1065,16 @@ static int exynos4_busfreq_probe(struct platform_device *pdev)
1065 } 1065 }
1066 1066
1067 rcu_read_lock(); 1067 rcu_read_lock();
1068 opp = opp_find_freq_floor(dev, &exynos4_devfreq_profile.initial_freq); 1068 opp = dev_pm_opp_find_freq_floor(dev,
1069 &exynos4_devfreq_profile.initial_freq);
1069 if (IS_ERR(opp)) { 1070 if (IS_ERR(opp)) {
1070 rcu_read_unlock(); 1071 rcu_read_unlock();
1071 dev_err(dev, "Invalid initial frequency %lu kHz.\n", 1072 dev_err(dev, "Invalid initial frequency %lu kHz.\n",
1072 exynos4_devfreq_profile.initial_freq); 1073 exynos4_devfreq_profile.initial_freq);
1073 return PTR_ERR(opp); 1074 return PTR_ERR(opp);
1074 } 1075 }
1075 data->curr_oppinfo.rate = opp_get_freq(opp); 1076 data->curr_oppinfo.rate = dev_pm_opp_get_freq(opp);
1076 data->curr_oppinfo.volt = opp_get_voltage(opp); 1077 data->curr_oppinfo.volt = dev_pm_opp_get_voltage(opp);
1077 rcu_read_unlock(); 1078 rcu_read_unlock();
1078 1079
1079 platform_set_drvdata(pdev, data); 1080 platform_set_drvdata(pdev, data);
diff --git a/drivers/devfreq/exynos/exynos5_bus.c b/drivers/devfreq/exynos/exynos5_bus.c
index 574b16b59be5..a60da3c1c48e 100644
--- a/drivers/devfreq/exynos/exynos5_bus.c
+++ b/drivers/devfreq/exynos/exynos5_bus.c
@@ -15,10 +15,9 @@
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/devfreq.h> 16#include <linux/devfreq.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/opp.h> 18#include <linux/pm_opp.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/suspend.h> 20#include <linux/suspend.h>
21#include <linux/opp.h>
22#include <linux/clk.h> 21#include <linux/clk.h>
23#include <linux/delay.h> 22#include <linux/delay.h>
24#include <linux/platform_device.h> 23#include <linux/platform_device.h>
@@ -132,7 +131,7 @@ static int exynos5_busfreq_int_target(struct device *dev, unsigned long *_freq,
132 struct platform_device *pdev = container_of(dev, struct platform_device, 131 struct platform_device *pdev = container_of(dev, struct platform_device,
133 dev); 132 dev);
134 struct busfreq_data_int *data = platform_get_drvdata(pdev); 133 struct busfreq_data_int *data = platform_get_drvdata(pdev);
135 struct opp *opp; 134 struct dev_pm_opp *opp;
136 unsigned long old_freq, freq; 135 unsigned long old_freq, freq;
137 unsigned long volt; 136 unsigned long volt;
138 137
@@ -144,8 +143,8 @@ static int exynos5_busfreq_int_target(struct device *dev, unsigned long *_freq,
144 return PTR_ERR(opp); 143 return PTR_ERR(opp);
145 } 144 }
146 145
147 freq = opp_get_freq(opp); 146 freq = dev_pm_opp_get_freq(opp);
148 volt = opp_get_voltage(opp); 147 volt = dev_pm_opp_get_voltage(opp);
149 rcu_read_unlock(); 148 rcu_read_unlock();
150 149
151 old_freq = data->curr_freq; 150 old_freq = data->curr_freq;
@@ -246,7 +245,7 @@ static int exynos5250_init_int_tables(struct busfreq_data_int *data)
246 int i, err = 0; 245 int i, err = 0;
247 246
248 for (i = LV_0; i < _LV_END; i++) { 247 for (i = LV_0; i < _LV_END; i++) {
249 err = opp_add(data->dev, exynos5_int_opp_table[i].clk, 248 err = dev_pm_opp_add(data->dev, exynos5_int_opp_table[i].clk,
250 exynos5_int_opp_table[i].volt); 249 exynos5_int_opp_table[i].volt);
251 if (err) { 250 if (err) {
252 dev_err(data->dev, "Cannot add opp entries.\n"); 251 dev_err(data->dev, "Cannot add opp entries.\n");
@@ -262,7 +261,7 @@ static int exynos5_busfreq_int_pm_notifier_event(struct notifier_block *this,
262{ 261{
263 struct busfreq_data_int *data = container_of(this, 262 struct busfreq_data_int *data = container_of(this,
264 struct busfreq_data_int, pm_notifier); 263 struct busfreq_data_int, pm_notifier);
265 struct opp *opp; 264 struct dev_pm_opp *opp;
266 unsigned long maxfreq = ULONG_MAX; 265 unsigned long maxfreq = ULONG_MAX;
267 unsigned long freq; 266 unsigned long freq;
268 unsigned long volt; 267 unsigned long volt;
@@ -276,14 +275,14 @@ static int exynos5_busfreq_int_pm_notifier_event(struct notifier_block *this,
276 data->disabled = true; 275 data->disabled = true;
277 276
278 rcu_read_lock(); 277 rcu_read_lock();
279 opp = opp_find_freq_floor(data->dev, &maxfreq); 278 opp = dev_pm_opp_find_freq_floor(data->dev, &maxfreq);
280 if (IS_ERR(opp)) { 279 if (IS_ERR(opp)) {
281 rcu_read_unlock(); 280 rcu_read_unlock();
282 err = PTR_ERR(opp); 281 err = PTR_ERR(opp);
283 goto unlock; 282 goto unlock;
284 } 283 }
285 freq = opp_get_freq(opp); 284 freq = dev_pm_opp_get_freq(opp);
286 volt = opp_get_voltage(opp); 285 volt = dev_pm_opp_get_voltage(opp);
287 rcu_read_unlock(); 286 rcu_read_unlock();
288 287
289 err = exynos5_int_setvolt(data, volt); 288 err = exynos5_int_setvolt(data, volt);
@@ -316,7 +315,7 @@ unlock:
316static int exynos5_busfreq_int_probe(struct platform_device *pdev) 315static int exynos5_busfreq_int_probe(struct platform_device *pdev)
317{ 316{
318 struct busfreq_data_int *data; 317 struct busfreq_data_int *data;
319 struct opp *opp; 318 struct dev_pm_opp *opp;
320 struct device *dev = &pdev->dev; 319 struct device *dev = &pdev->dev;
321 struct device_node *np; 320 struct device_node *np;
322 unsigned long initial_freq; 321 unsigned long initial_freq;
@@ -351,46 +350,43 @@ static int exynos5_busfreq_int_probe(struct platform_device *pdev)
351 350
352 err = exynos5250_init_int_tables(data); 351 err = exynos5250_init_int_tables(data);
353 if (err) 352 if (err)
354 goto err_regulator; 353 return err;
355 354
356 data->vdd_int = regulator_get(dev, "vdd_int"); 355 data->vdd_int = devm_regulator_get(dev, "vdd_int");
357 if (IS_ERR(data->vdd_int)) { 356 if (IS_ERR(data->vdd_int)) {
358 dev_err(dev, "Cannot get the regulator \"vdd_int\"\n"); 357 dev_err(dev, "Cannot get the regulator \"vdd_int\"\n");
359 err = PTR_ERR(data->vdd_int); 358 return PTR_ERR(data->vdd_int);
360 goto err_regulator;
361 } 359 }
362 360
363 data->int_clk = clk_get(dev, "int_clk"); 361 data->int_clk = devm_clk_get(dev, "int_clk");
364 if (IS_ERR(data->int_clk)) { 362 if (IS_ERR(data->int_clk)) {
365 dev_err(dev, "Cannot get clock \"int_clk\"\n"); 363 dev_err(dev, "Cannot get clock \"int_clk\"\n");
366 err = PTR_ERR(data->int_clk); 364 return PTR_ERR(data->int_clk);
367 goto err_clock;
368 } 365 }
369 366
370 rcu_read_lock(); 367 rcu_read_lock();
371 opp = opp_find_freq_floor(dev, 368 opp = dev_pm_opp_find_freq_floor(dev,
372 &exynos5_devfreq_int_profile.initial_freq); 369 &exynos5_devfreq_int_profile.initial_freq);
373 if (IS_ERR(opp)) { 370 if (IS_ERR(opp)) {
374 rcu_read_unlock(); 371 rcu_read_unlock();
375 dev_err(dev, "Invalid initial frequency %lu kHz.\n", 372 dev_err(dev, "Invalid initial frequency %lu kHz.\n",
376 exynos5_devfreq_int_profile.initial_freq); 373 exynos5_devfreq_int_profile.initial_freq);
377 err = PTR_ERR(opp); 374 return PTR_ERR(opp);
378 goto err_opp_add;
379 } 375 }
380 initial_freq = opp_get_freq(opp); 376 initial_freq = dev_pm_opp_get_freq(opp);
381 initial_volt = opp_get_voltage(opp); 377 initial_volt = dev_pm_opp_get_voltage(opp);
382 rcu_read_unlock(); 378 rcu_read_unlock();
383 data->curr_freq = initial_freq; 379 data->curr_freq = initial_freq;
384 380
385 err = clk_set_rate(data->int_clk, initial_freq * 1000); 381 err = clk_set_rate(data->int_clk, initial_freq * 1000);
386 if (err) { 382 if (err) {
387 dev_err(dev, "Failed to set initial frequency\n"); 383 dev_err(dev, "Failed to set initial frequency\n");
388 goto err_opp_add; 384 return err;
389 } 385 }
390 386
391 err = exynos5_int_setvolt(data, initial_volt); 387 err = exynos5_int_setvolt(data, initial_volt);
392 if (err) 388 if (err)
393 goto err_opp_add; 389 return err;
394 390
395 platform_set_drvdata(pdev, data); 391 platform_set_drvdata(pdev, data);
396 392
@@ -419,12 +415,6 @@ static int exynos5_busfreq_int_probe(struct platform_device *pdev)
419 415
420err_devfreq_add: 416err_devfreq_add:
421 devfreq_remove_device(data->devfreq); 417 devfreq_remove_device(data->devfreq);
422 platform_set_drvdata(pdev, NULL);
423err_opp_add:
424 clk_put(data->int_clk);
425err_clock:
426 regulator_put(data->vdd_int);
427err_regulator:
428 return err; 418 return err;
429} 419}
430 420
@@ -435,9 +425,6 @@ static int exynos5_busfreq_int_remove(struct platform_device *pdev)
435 pm_qos_remove_request(&data->int_req); 425 pm_qos_remove_request(&data->int_req);
436 unregister_pm_notifier(&data->pm_notifier); 426 unregister_pm_notifier(&data->pm_notifier);
437 devfreq_remove_device(data->devfreq); 427 devfreq_remove_device(data->devfreq);
438 regulator_put(data->vdd_int);
439 clk_put(data->int_clk);
440 platform_set_drvdata(pdev, NULL);
441 428
442 return 0; 429 return 0;
443} 430}
@@ -479,7 +466,7 @@ static int __init exynos5_busfreq_int_init(void)
479 466
480 exynos5_devfreq_pdev = 467 exynos5_devfreq_pdev =
481 platform_device_register_simple("exynos5-bus-int", -1, NULL, 0); 468 platform_device_register_simple("exynos5-bus-int", -1, NULL, 0);
482 if (IS_ERR_OR_NULL(exynos5_devfreq_pdev)) { 469 if (IS_ERR(exynos5_devfreq_pdev)) {
483 ret = PTR_ERR(exynos5_devfreq_pdev); 470 ret = PTR_ERR(exynos5_devfreq_pdev);
484 goto out1; 471 goto out1;
485 } 472 }