Commit 5d4879cd authored by Nishanth Menon's avatar Nishanth Menon Committed by Rafael J. Wysocki

PM / OPP: rename functions to dev_pm_opp*

Since Operating Performance Points (OPP) functions are specific to
device specific power management, be specific and rename opp_*
accessors in OPP library with dev_pm_opp_* equivalent.

Affected functions are:
 opp_get_voltage
 opp_get_freq
 opp_get_opp_count
 opp_find_freq_exact
 opp_find_freq_floor
 opp_find_freq_ceil
 opp_add
 opp_enable
 opp_disable
 opp_get_notifier
 opp_init_cpufreq_table
 opp_free_cpufreq_table
Reported-by: default avatarRandy Dunlap <rdunlap@infradead.org>
Signed-off-by: default avatarNishanth Menon <nm@ti.com>
Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 31d141e3
This diff is collapsed.
...@@ -226,7 +226,7 @@ static void __init imx6q_opp_check_1p2ghz(struct device *cpu_dev) ...@@ -226,7 +226,7 @@ static void __init imx6q_opp_check_1p2ghz(struct device *cpu_dev)
val = readl_relaxed(base + OCOTP_CFG3); val = readl_relaxed(base + OCOTP_CFG3);
val >>= OCOTP_CFG3_SPEED_SHIFT; val >>= OCOTP_CFG3_SPEED_SHIFT;
if ((val & 0x3) != OCOTP_CFG3_SPEED_1P2GHZ) if ((val & 0x3) != OCOTP_CFG3_SPEED_1P2GHZ)
if (opp_disable(cpu_dev, 1200000000)) if (dev_pm_opp_disable(cpu_dev, 1200000000))
pr_warn("failed to disable 1.2 GHz OPP\n"); pr_warn("failed to disable 1.2 GHz OPP\n");
put_node: put_node:
......
...@@ -522,11 +522,11 @@ static int __init beagle_opp_init(void) ...@@ -522,11 +522,11 @@ static int __init beagle_opp_init(void)
return -ENODEV; return -ENODEV;
} }
/* Enable MPU 1GHz and lower opps */ /* Enable MPU 1GHz and lower opps */
r = opp_enable(mpu_dev, 800000000); r = dev_pm_opp_enable(mpu_dev, 800000000);
/* TODO: MPU 1GHz needs SR and ABB */ /* TODO: MPU 1GHz needs SR and ABB */
/* Enable IVA 800MHz and lower opps */ /* Enable IVA 800MHz and lower opps */
r |= opp_enable(iva_dev, 660000000); r |= dev_pm_opp_enable(iva_dev, 660000000);
/* TODO: DSP 800MHz needs SR and ABB */ /* TODO: DSP 800MHz needs SR and ABB */
if (r) { if (r) {
pr_err("%s: failed to enable higher opp %d\n", pr_err("%s: failed to enable higher opp %d\n",
...@@ -535,8 +535,8 @@ static int __init beagle_opp_init(void) ...@@ -535,8 +535,8 @@ static int __init beagle_opp_init(void)
* Cleanup - disable the higher freqs - we dont care * Cleanup - disable the higher freqs - we dont care
* about the results * about the results
*/ */
opp_disable(mpu_dev, 800000000); dev_pm_opp_disable(mpu_dev, 800000000);
opp_disable(iva_dev, 660000000); dev_pm_opp_disable(iva_dev, 660000000);
} }
} }
return 0; return 0;
......
...@@ -81,14 +81,14 @@ int __init omap_init_opp_table(struct omap_opp_def *opp_def, ...@@ -81,14 +81,14 @@ int __init omap_init_opp_table(struct omap_opp_def *opp_def,
dev = &oh->od->pdev->dev; dev = &oh->od->pdev->dev;
} }
r = opp_add(dev, opp_def->freq, opp_def->u_volt); r = dev_pm_opp_add(dev, opp_def->freq, opp_def->u_volt);
if (r) { if (r) {
dev_err(dev, "%s: add OPP %ld failed for %s [%d] result=%d\n", dev_err(dev, "%s: add OPP %ld failed for %s [%d] result=%d\n",
__func__, opp_def->freq, __func__, opp_def->freq,
opp_def->hwmod_name, i, r); opp_def->hwmod_name, i, r);
} else { } else {
if (!opp_def->default_available) if (!opp_def->default_available)
r = opp_disable(dev, opp_def->freq); r = dev_pm_opp_disable(dev, opp_def->freq);
if (r) if (r)
dev_err(dev, "%s: disable %ld failed for %s [%d] result=%d\n", dev_err(dev, "%s: disable %ld failed for %s [%d] result=%d\n",
__func__, opp_def->freq, __func__, opp_def->freq,
......
...@@ -172,7 +172,7 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name, ...@@ -172,7 +172,7 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
clk_put(clk); clk_put(clk);
rcu_read_lock(); rcu_read_lock();
opp = opp_find_freq_ceil(dev, &freq); opp = dev_pm_opp_find_freq_ceil(dev, &freq);
if (IS_ERR(opp)) { if (IS_ERR(opp)) {
rcu_read_unlock(); rcu_read_unlock();
pr_err("%s: unable to find boot up OPP for vdd_%s\n", pr_err("%s: unable to find boot up OPP for vdd_%s\n",
...@@ -180,7 +180,7 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name, ...@@ -180,7 +180,7 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
goto exit; goto exit;
} }
bootup_volt = opp_get_voltage(opp); bootup_volt = dev_pm_opp_get_voltage(opp);
rcu_read_unlock(); rcu_read_unlock();
if (!bootup_volt) { if (!bootup_volt) {
pr_err("%s: unable to find voltage corresponding to the bootup OPP for vdd_%s\n", pr_err("%s: unable to find voltage corresponding to the bootup OPP for vdd_%s\n",
......
This diff is collapsed.
...@@ -98,7 +98,7 @@ static void put_cluster_clk_and_freq_table(struct device *cpu_dev) ...@@ -98,7 +98,7 @@ static void put_cluster_clk_and_freq_table(struct device *cpu_dev)
if (!atomic_dec_return(&cluster_usage[cluster])) { if (!atomic_dec_return(&cluster_usage[cluster])) {
clk_put(clk[cluster]); clk_put(clk[cluster]);
opp_free_cpufreq_table(cpu_dev, &freq_table[cluster]); dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table[cluster]);
dev_dbg(cpu_dev, "%s: cluster: %d\n", __func__, cluster); dev_dbg(cpu_dev, "%s: cluster: %d\n", __func__, cluster);
} }
} }
...@@ -119,7 +119,7 @@ static int get_cluster_clk_and_freq_table(struct device *cpu_dev) ...@@ -119,7 +119,7 @@ static int get_cluster_clk_and_freq_table(struct device *cpu_dev)
goto atomic_dec; goto atomic_dec;
} }
ret = opp_init_cpufreq_table(cpu_dev, &freq_table[cluster]); ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table[cluster]);
if (ret) { if (ret) {
dev_err(cpu_dev, "%s: failed to init cpufreq table, cpu: %d, err: %d\n", dev_err(cpu_dev, "%s: failed to init cpufreq table, cpu: %d, err: %d\n",
__func__, cpu_dev->id, ret); __func__, cpu_dev->id, ret);
...@@ -138,7 +138,7 @@ static int get_cluster_clk_and_freq_table(struct device *cpu_dev) ...@@ -138,7 +138,7 @@ static int get_cluster_clk_and_freq_table(struct device *cpu_dev)
dev_err(cpu_dev, "%s: Failed to get clk for cpu: %d, cluster: %d\n", dev_err(cpu_dev, "%s: Failed to get clk for cpu: %d, cluster: %d\n",
__func__, cpu_dev->id, cluster); __func__, cpu_dev->id, cluster);
ret = PTR_ERR(clk[cluster]); ret = PTR_ERR(clk[cluster]);
opp_free_cpufreq_table(cpu_dev, &freq_table[cluster]); dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table[cluster]);
atomic_dec: atomic_dec:
atomic_dec(&cluster_usage[cluster]); atomic_dec(&cluster_usage[cluster]);
......
...@@ -72,7 +72,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy, ...@@ -72,7 +72,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
if (!IS_ERR(cpu_reg)) { if (!IS_ERR(cpu_reg)) {
rcu_read_lock(); rcu_read_lock();
opp = opp_find_freq_ceil(cpu_dev, &freq_Hz); opp = dev_pm_opp_find_freq_ceil(cpu_dev, &freq_Hz);
if (IS_ERR(opp)) { if (IS_ERR(opp)) {
rcu_read_unlock(); rcu_read_unlock();
pr_err("failed to find OPP for %ld\n", freq_Hz); pr_err("failed to find OPP for %ld\n", freq_Hz);
...@@ -80,7 +80,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy, ...@@ -80,7 +80,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
ret = PTR_ERR(opp); ret = PTR_ERR(opp);
goto post_notify; goto post_notify;
} }
volt = opp_get_voltage(opp); volt = dev_pm_opp_get_voltage(opp);
rcu_read_unlock(); rcu_read_unlock();
tol = volt * voltage_tolerance / 100; tol = volt * voltage_tolerance / 100;
volt_old = regulator_get_voltage(cpu_reg); volt_old = regulator_get_voltage(cpu_reg);
...@@ -218,7 +218,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) ...@@ -218,7 +218,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
goto out_put_node; goto out_put_node;
} }
ret = opp_init_cpufreq_table(cpu_dev, &freq_table); ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table);
if (ret) { if (ret) {
pr_err("failed to init cpufreq table: %d\n", ret); pr_err("failed to init cpufreq table: %d\n", ret);
goto out_put_node; goto out_put_node;
...@@ -242,12 +242,12 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) ...@@ -242,12 +242,12 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++)
; ;
rcu_read_lock(); rcu_read_lock();
opp = opp_find_freq_exact(cpu_dev, opp = dev_pm_opp_find_freq_exact(cpu_dev,
freq_table[0].frequency * 1000, true); freq_table[0].frequency * 1000, true);
min_uV = opp_get_voltage(opp); min_uV = dev_pm_opp_get_voltage(opp);
opp = opp_find_freq_exact(cpu_dev, opp = dev_pm_opp_find_freq_exact(cpu_dev,
freq_table[i-1].frequency * 1000, true); freq_table[i-1].frequency * 1000, true);
max_uV = opp_get_voltage(opp); max_uV = dev_pm_opp_get_voltage(opp);
rcu_read_unlock(); rcu_read_unlock();
ret = regulator_set_voltage_time(cpu_reg, min_uV, max_uV); ret = regulator_set_voltage_time(cpu_reg, min_uV, max_uV);
if (ret > 0) if (ret > 0)
...@@ -264,7 +264,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) ...@@ -264,7 +264,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
return 0; return 0;
out_free_table: out_free_table:
opp_free_cpufreq_table(cpu_dev, &freq_table); dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table);
out_put_node: out_put_node:
of_node_put(np); of_node_put(np);
return ret; return ret;
...@@ -273,7 +273,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) ...@@ -273,7 +273,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
static int cpu0_cpufreq_remove(struct platform_device *pdev) static int cpu0_cpufreq_remove(struct platform_device *pdev)
{ {
cpufreq_unregister_driver(&cpu0_cpufreq_driver); cpufreq_unregister_driver(&cpu0_cpufreq_driver);
opp_free_cpufreq_table(cpu_dev, &freq_table); dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table);
return 0; return 0;
} }
......
...@@ -123,7 +123,7 @@ static int init_div_table(void) ...@@ -123,7 +123,7 @@ static int init_div_table(void)
rcu_read_lock(); rcu_read_lock();
for (i = 0; freq_tbl[i].frequency != CPUFREQ_TABLE_END; i++) { for (i = 0; freq_tbl[i].frequency != CPUFREQ_TABLE_END; i++) {
opp = opp_find_freq_exact(dvfs_info->dev, opp = dev_pm_opp_find_freq_exact(dvfs_info->dev,
freq_tbl[i].frequency * 1000, true); freq_tbl[i].frequency * 1000, true);
if (IS_ERR(opp)) { if (IS_ERR(opp)) {
rcu_read_unlock(); rcu_read_unlock();
...@@ -142,7 +142,7 @@ static int init_div_table(void) ...@@ -142,7 +142,7 @@ static int init_div_table(void)
<< P0_7_CSCLKDEV_SHIFT; << P0_7_CSCLKDEV_SHIFT;
/* Calculate EMA */ /* Calculate EMA */
volt_id = opp_get_voltage(opp); volt_id = dev_pm_opp_get_voltage(opp);
volt_id = (MAX_VOLTAGE - volt_id) / VOLTAGE_STEP; volt_id = (MAX_VOLTAGE - volt_id) / VOLTAGE_STEP;
if (volt_id < PMIC_HIGH_VOLT) { if (volt_id < PMIC_HIGH_VOLT) {
ema_div = (CPUEMA_HIGH << P0_7_CPUEMA_SHIFT) | ema_div = (CPUEMA_HIGH << P0_7_CPUEMA_SHIFT) |
...@@ -399,13 +399,14 @@ static int exynos_cpufreq_probe(struct platform_device *pdev) ...@@ -399,13 +399,14 @@ static int exynos_cpufreq_probe(struct platform_device *pdev)
goto err_put_node; goto err_put_node;
} }
ret = opp_init_cpufreq_table(dvfs_info->dev, &dvfs_info->freq_table); ret = dev_pm_opp_init_cpufreq_table(dvfs_info->dev,
&dvfs_info->freq_table);
if (ret) { if (ret) {
dev_err(dvfs_info->dev, dev_err(dvfs_info->dev,
"failed to init cpufreq table: %d\n", ret); "failed to init cpufreq table: %d\n", ret);
goto err_put_node; goto err_put_node;
} }
dvfs_info->freq_count = opp_get_opp_count(dvfs_info->dev); dvfs_info->freq_count = dev_pm_opp_get_opp_count(dvfs_info->dev);
exynos_sort_descend_freq_table(); exynos_sort_descend_freq_table();
if (of_property_read_u32(np, "clock-latency", &dvfs_info->latency)) if (of_property_read_u32(np, "clock-latency", &dvfs_info->latency))
...@@ -454,7 +455,7 @@ static int exynos_cpufreq_probe(struct platform_device *pdev) ...@@ -454,7 +455,7 @@ static int exynos_cpufreq_probe(struct platform_device *pdev)
return 0; return 0;
err_free_table: err_free_table:
opp_free_cpufreq_table(dvfs_info->dev, &dvfs_info->freq_table); dev_pm_opp_free_cpufreq_table(dvfs_info->dev, &dvfs_info->freq_table);
err_put_node: err_put_node:
of_node_put(np); of_node_put(np);
dev_err(&pdev->dev, "%s: failed initialization\n", __func__); dev_err(&pdev->dev, "%s: failed initialization\n", __func__);
...@@ -464,7 +465,7 @@ static int exynos_cpufreq_probe(struct platform_device *pdev) ...@@ -464,7 +465,7 @@ static int exynos_cpufreq_probe(struct platform_device *pdev)
static int exynos_cpufreq_remove(struct platform_device *pdev) static int exynos_cpufreq_remove(struct platform_device *pdev)
{ {
cpufreq_unregister_driver(&exynos_driver); cpufreq_unregister_driver(&exynos_driver);
opp_free_cpufreq_table(dvfs_info->dev, &dvfs_info->freq_table); dev_pm_opp_free_cpufreq_table(dvfs_info->dev, &dvfs_info->freq_table);
return 0; return 0;
} }
......
...@@ -70,14 +70,14 @@ static int imx6q_set_target(struct cpufreq_policy *policy, ...@@ -70,14 +70,14 @@ static int imx6q_set_target(struct cpufreq_policy *policy,
return 0; return 0;
rcu_read_lock(); rcu_read_lock();
opp = opp_find_freq_ceil(cpu_dev, &freq_hz); opp = dev_pm_opp_find_freq_ceil(cpu_dev, &freq_hz);
if (IS_ERR(opp)) { if (IS_ERR(opp)) {
rcu_read_unlock(); rcu_read_unlock();
dev_err(cpu_dev, "failed to find OPP for %ld\n", freq_hz); dev_err(cpu_dev, "failed to find OPP for %ld\n", freq_hz);
return PTR_ERR(opp); return PTR_ERR(opp);
} }
volt = opp_get_voltage(opp); volt = dev_pm_opp_get_voltage(opp);
rcu_read_unlock(); rcu_read_unlock();
volt_old = regulator_get_voltage(arm_reg); volt_old = regulator_get_voltage(arm_reg);
...@@ -237,14 +237,14 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) ...@@ -237,14 +237,14 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
} }
/* We expect an OPP table supplied by platform */ /* We expect an OPP table supplied by platform */
num = opp_get_opp_count(cpu_dev); num = dev_pm_opp_get_opp_count(cpu_dev);
if (num < 0) { if (num < 0) {
ret = num; ret = num;
dev_err(cpu_dev, "no OPP table is found: %d\n", ret); dev_err(cpu_dev, "no OPP table is found: %d\n", ret);
goto put_node; goto put_node;
} }
ret = opp_init_cpufreq_table(cpu_dev, &freq_table); ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table);
if (ret) { if (ret) {
dev_err(cpu_dev, "failed to init cpufreq table: %d\n", ret); dev_err(cpu_dev, "failed to init cpufreq table: %d\n", ret);
goto put_node; goto put_node;
...@@ -259,12 +259,12 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) ...@@ -259,12 +259,12 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
* same order. * same order.
*/ */
rcu_read_lock(); rcu_read_lock();
opp = opp_find_freq_exact(cpu_dev, opp = dev_pm_opp_find_freq_exact(cpu_dev,
freq_table[0].frequency * 1000, true); freq_table[0].frequency * 1000, true);
min_volt = opp_get_voltage(opp); min_volt = dev_pm_opp_get_voltage(opp);
opp = opp_find_freq_exact(cpu_dev, opp = dev_pm_opp_find_freq_exact(cpu_dev,
freq_table[--num].frequency * 1000, true); freq_table[--num].frequency * 1000, true);
max_volt = opp_get_voltage(opp); max_volt = dev_pm_opp_get_voltage(opp);
rcu_read_unlock(); rcu_read_unlock();
ret = regulator_set_voltage_time(arm_reg, min_volt, max_volt); ret = regulator_set_voltage_time(arm_reg, min_volt, max_volt);
if (ret > 0) if (ret > 0)
...@@ -292,7 +292,7 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) ...@@ -292,7 +292,7 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
return 0; return 0;
free_freq_table: free_freq_table:
opp_free_cpufreq_table(cpu_dev, &freq_table); dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table);
put_node: put_node:
of_node_put(np); of_node_put(np);
return ret; return ret;
...@@ -301,7 +301,7 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) ...@@ -301,7 +301,7 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
static int imx6q_cpufreq_remove(struct platform_device *pdev) static int imx6q_cpufreq_remove(struct platform_device *pdev)
{ {
cpufreq_unregister_driver(&imx6q_cpufreq_driver); cpufreq_unregister_driver(&imx6q_cpufreq_driver);
opp_free_cpufreq_table(cpu_dev, &freq_table); dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table);
return 0; return 0;
} }
......
...@@ -105,14 +105,14 @@ static int omap_target(struct cpufreq_policy *policy, ...@@ -105,14 +105,14 @@ static int omap_target(struct cpufreq_policy *policy,
if (mpu_reg) { if (mpu_reg) {
rcu_read_lock(); rcu_read_lock();
opp = opp_find_freq_ceil(mpu_dev, &freq); opp = dev_pm_opp_find_freq_ceil(mpu_dev, &freq);
if (IS_ERR(opp)) { if (IS_ERR(opp)) {
rcu_read_unlock(); rcu_read_unlock();
dev_err(mpu_dev, "%s: unable to find MPU OPP for %d\n", dev_err(mpu_dev, "%s: unable to find MPU OPP for %d\n",
__func__, freqs.new); __func__, freqs.new);
return -EINVAL; return -EINVAL;
} }
volt = opp_get_voltage(opp); volt = dev_pm_opp_get_voltage(opp);
rcu_read_unlock(); rcu_read_unlock();
tol = volt * OPP_TOLERANCE / 100; tol = volt * OPP_TOLERANCE / 100;
volt_old = regulator_get_voltage(mpu_reg); volt_old = regulator_get_voltage(mpu_reg);
...@@ -162,7 +162,7 @@ static int omap_target(struct cpufreq_policy *policy, ...@@ -162,7 +162,7 @@ static int omap_target(struct cpufreq_policy *policy,
static inline void freq_table_free(void) static inline void freq_table_free(void)
{ {
if (atomic_dec_and_test(&freq_table_users)) if (atomic_dec_and_test(&freq_table_users))
opp_free_cpufreq_table(mpu_dev, &freq_table); dev_pm_opp_free_cpufreq_table(mpu_dev, &freq_table);
} }
static int omap_cpu_init(struct cpufreq_policy *policy) static int omap_cpu_init(struct cpufreq_policy *policy)
...@@ -181,7 +181,7 @@ static int omap_cpu_init(struct cpufreq_policy *policy) ...@@ -181,7 +181,7 @@ static int omap_cpu_init(struct cpufreq_policy *policy)
policy->cur = omap_getspeed(policy->cpu); policy->cur = omap_getspeed(policy->cpu);
if (!freq_table) if (!freq_table)
result = opp_init_cpufreq_table(mpu_dev, &freq_table); result = dev_pm_opp_init_cpufreq_table(mpu_dev, &freq_table);
if (result) { if (result) {
dev_err(mpu_dev, "%s: cpu%d: failed creating freq table[%d]\n", dev_err(mpu_dev, "%s: cpu%d: failed creating freq table[%d]\n",
......
...@@ -908,7 +908,7 @@ static ssize_t available_frequencies_show(struct device *d, ...@@ -908,7 +908,7 @@ static ssize_t available_frequencies_show(struct device *d,
rcu_read_lock(); rcu_read_lock();
do { do {
opp = opp_find_freq_ceil(dev, &freq); opp = dev_pm_opp_find_freq_ceil(dev, &freq);
if (IS_ERR(opp)) if (IS_ERR(opp))
break; break;
...@@ -1036,18 +1036,18 @@ struct opp *devfreq_recommended_opp(struct device *dev, unsigned long *freq, ...@@ -1036,18 +1036,18 @@ struct opp *devfreq_recommended_opp(struct device *dev, unsigned long *freq,
if (flags & DEVFREQ_FLAG_LEAST_UPPER_BOUND) { if (flags & DEVFREQ_FLAG_LEAST_UPPER_BOUND) {
/* The freq is an upper bound. opp should be lower */ /* The freq is an upper bound. opp should be lower */
opp = opp_find_freq_floor(dev, freq); opp = dev_pm_opp_find_freq_floor(dev, freq);
/* If not available, use the closest opp */ /* If not available, use the closest opp */
if (opp == ERR_PTR(-ERANGE)) if (opp == ERR_PTR(-ERANGE))
opp = opp_find_freq_ceil(dev, freq); opp = dev_pm_opp_find_freq_ceil(dev, freq);
} else { } else {
/* The freq is an lower bound. opp should be higher */ /* The freq is an lower bound. opp should be higher */
opp = opp_find_freq_ceil(dev, freq); opp = dev_pm_opp_find_freq_ceil(dev, freq);
/* If not available, use the closest opp */ /* If not available, use the closest opp */
if (opp == ERR_PTR(-ERANGE)) if (opp == ERR_PTR(-ERANGE))
opp = opp_find_freq_floor(dev, freq); opp = dev_pm_opp_find_freq_floor(dev, freq);
} }
return opp; return opp;
...@@ -1066,7 +1066,7 @@ int devfreq_register_opp_notifier(struct device *dev, struct devfreq *devfreq) ...@@ -1066,7 +1066,7 @@ int devfreq_register_opp_notifier(struct device *dev, struct devfreq *devfreq)
int ret = 0; int ret = 0;
rcu_read_lock(); rcu_read_lock();
nh = opp_get_notifier(dev); nh = dev_pm_opp_get_notifier(dev);
if (IS_ERR(nh)) if (IS_ERR(nh))
ret = PTR_ERR(nh); ret = PTR_ERR(nh);
rcu_read_unlock(); rcu_read_unlock();
...@@ -1092,7 +1092,7 @@ int devfreq_unregister_opp_notifier(struct device *dev, struct devfreq *devfreq) ...@@ -1092,7 +1092,7 @@ int devfreq_unregister_opp_notifier(struct device *dev, struct devfreq *devfreq)
int ret = 0; int ret = 0;
rcu_read_lock(); rcu_read_lock();
nh = opp_get_notifier(dev); nh = dev_pm_opp_get_notifier(dev);
if (IS_ERR(nh)) if (IS_ERR(nh))
ret = PTR_ERR(nh); ret = PTR_ERR(nh);
rcu_read_unlock(); rcu_read_unlock();
......
...@@ -650,8 +650,8 @@ static int exynos4_bus_target(struct device *dev, unsigned long *_freq, ...@@ -650,8 +650,8 @@ static int exynos4_bus_target(struct device *dev, unsigned long *_freq,
rcu_read_unlock(); rcu_read_unlock();
return PTR_ERR(opp); return PTR_ERR(opp);
} }
new_oppinfo.rate = opp_get_freq(opp); new_oppinfo.rate = dev_pm_opp_get_freq(opp);
new_oppinfo.volt = opp_get_voltage(opp); new_oppinfo.volt = dev_pm_opp_get_voltage(opp);
rcu_read_unlock(); rcu_read_unlock();
freq = new_oppinfo.rate; freq = new_oppinfo.rate;
...@@ -873,7 +873,7 @@ static int exynos4210_init_tables(struct busfreq_data *data) ...@@ -873,7 +873,7 @@ static int exynos4210_init_tables(struct busfreq_data *data)
exynos4210_busclk_table[i].volt = exynos4210_asv_volt[mgrp][i]; exynos4210_busclk_table[i].volt = exynos4210_asv_volt[mgrp][i];
for (i = LV_0; i < EX4210_LV_NUM; i++) { for (i = LV_0; i < EX4210_LV_NUM; i++) {
err = opp_add(data->dev, exynos4210_busclk_table[i].clk, err = dev_pm_opp_add(data->dev, exynos4210_busclk_table[i].clk,
exynos4210_busclk_table[i].volt); exynos4210_busclk_table[i].volt);
if (err) { if (err) {
dev_err(data->dev, "Cannot add opp entries.\n"); dev_err(data->dev, "Cannot add opp entries.\n");
...@@ -940,7 +940,7 @@ static int exynos4x12_init_tables(struct busfreq_data *data) ...@@ -940,7 +940,7 @@ static int exynos4x12_init_tables(struct busfreq_data *data)
} }
for (i = 0; i < EX4x12_LV_NUM; i++) { for (i = 0; i < EX4x12_LV_NUM; i++) {
ret = opp_add(data->dev, exynos4x12_mifclk_table[i].clk, ret = dev_pm_opp_add(data->dev, exynos4x12_mifclk_table[i].clk,
exynos4x12_mifclk_table[i].volt); exynos4x12_mifclk_table[i].volt);
if (ret) { if (ret) {
dev_err(data->dev, "Fail to add opp entries.\n"); dev_err(data->dev, "Fail to add opp entries.\n");
...@@ -969,7 +969,7 @@ static int exynos4_busfreq_pm_notifier_event(struct notifier_block *this, ...@@ -969,7 +969,7 @@ static int exynos4_busfreq_pm_notifier_event(struct notifier_block *this,
data->disabled = true; data->disabled = true;
rcu_read_lock(); rcu_read_lock();
opp = opp_find_freq_floor(data->dev, &maxfreq); opp = dev_pm_opp_find_freq_floor(data->dev, &maxfreq);
if (IS_ERR(opp)) { if (IS_ERR(opp)) {
rcu_read_unlock(); rcu_read_unlock();
dev_err(data->dev, "%s: unable to find a min freq\n", 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,8 +977,8 @@ static int exynos4_busfreq_pm_notifier_event(struct notifier_block *this,
mutex_unlock(&data->lock); mutex_unlock(&data->lock);
return PTR_ERR(opp); return PTR_ERR(opp);
} }
new_oppinfo.rate = opp_get_freq(opp); new_oppinfo.rate = dev_pm_opp_get_freq(opp);
new_oppinfo.volt = opp_get_voltage(opp); new_oppinfo.volt = dev_pm_opp_get_voltage(opp);
rcu_read_unlock(); rcu_read_unlock();
err = exynos4_bus_setvolt(data, &new_oppinfo, err = exynos4_bus_setvolt(data, &new_oppinfo,
...@@ -1065,15 +1065,16 @@ static int exynos4_busfreq_probe(struct platform_device *pdev) ...@@ -1065,15 +1065,16 @@ static int exynos4_busfreq_probe(struct platform_device *pdev)
} }
rcu_read_lock(); rcu_read_lock();
opp = opp_find_freq_floor(dev, &exynos4_devfreq_profile.initial_freq); opp = dev_pm_opp_find_freq_floor(dev,
&exynos4_devfreq_profile.initial_freq);
if (IS_ERR(opp)) { if (IS_ERR(opp)) {
rcu_read_unlock(); rcu_read_unlock();
dev_err(dev, "Invalid initial frequency %lu kHz.\n", dev_err(dev, "Invalid initial frequency %lu kHz.\n",
exynos4_devfreq_profile.initial_freq); exynos4_devfreq_profile.initial_freq);
return PTR_ERR(opp); return PTR_ERR(opp);
} }
data->curr_oppinfo.rate = opp_get_freq(opp); data->curr_oppinfo.rate = dev_pm_opp_get_freq(opp);
data->curr_oppinfo.volt = opp_get_voltage(opp); data->curr_oppinfo.volt = dev_pm_opp_get_voltage(opp);
rcu_read_unlock(); rcu_read_unlock();
platform_set_drvdata(pdev, data); platform_set_drvdata(pdev, data);
......
...@@ -144,8 +144,8 @@ static int exynos5_busfreq_int_target(struct device *dev, unsigned long *_freq, ...@@ -144,8 +144,8 @@ static int exynos5_busfreq_int_target(struct device *dev, unsigned long *_freq,
return PTR_ERR(opp); return PTR_ERR(opp);
} }
freq = opp_get_freq(opp); freq = dev_pm_opp_get_freq(opp);
volt = opp_get_voltage(opp); volt = dev_pm_opp_get_voltage(opp);
rcu_read_unlock(); rcu_read_unlock();
old_freq = data->curr_freq; old_freq = data->curr_freq;
...@@ -246,7 +246,7 @@ static int exynos5250_init_int_tables(struct busfreq_data_int *data) ...@@ -246,7 +246,7 @@ static int exynos5250_init_int_tables(struct busfreq_data_int *data)
int i, err = 0; int i, err = 0;
for (i = LV_0; i < _LV_END; i++) { for (i = LV_0; i < _LV_END; i++) {
err = opp_add(data->dev, exynos5_int_opp_table[i].clk, err = dev_pm_opp_add(data->dev, exynos5_int_opp_table[i].clk,
exynos5_int_opp_table[i].volt); exynos5_int_opp_table[i].volt);
if (err) { if (err) {
dev_err(data->dev, "Cannot add opp entries.\n"); dev_err(data->dev, "Cannot add opp entries.\n");
...@@ -276,14 +276,14 @@ static int exynos5_busfreq_int_pm_notifier_event(struct notifier_block *this, ...@@ -276,14 +276,14 @@ static int exynos5_busfreq_int_pm_notifier_event(struct notifier_block *this,
data->disabled = true; data->disabled = true;
rcu_read_lock(); rcu_read_lock();
opp = opp_find_freq_floor(data->dev, &maxfreq); opp = dev_pm_opp_find_freq_floor(data->dev, &maxfreq);
if (IS_ERR(opp)) { if (IS_ERR(opp)) {
rcu_read_unlock(); rcu_read_unlock();
err = PTR_ERR(opp); err = PTR_ERR(opp);
goto unlock; goto unlock;
} }
freq = opp_get_freq(opp); freq = dev_pm_opp_get_freq(opp);
volt = opp_get_voltage(opp); volt = dev_pm_opp_get_voltage(opp);
rcu_read_unlock(); rcu_read_unlock();
err = exynos5_int_setvolt(data, volt); err = exynos5_int_setvolt(data, volt);
...@@ -368,7 +368,7 @@ static int exynos5_busfreq_int_probe(struct platform_device *pdev) ...@@ -368,7 +368,7 @@ static int exynos5_busfreq_int_probe(struct platform_device *pdev)
} }
rcu_read_lock(); rcu_read_lock();
opp = opp_find_freq_floor(dev, opp = dev_pm_opp_find_freq_floor(dev,
&exynos5_devfreq_int_profile.initial_freq); &exynos5_devfreq_int_profile.initial_freq);
if (IS_ERR(opp)) { if (IS_ERR(opp)) {
rcu_read_unlock(); rcu_read_unlock();
...@@ -377,8 +377,8 @@ static int exynos5_busfreq_int_probe(struct platform_device *pdev) ...@@ -377,8 +377,8 @@ static int exynos5_busfreq_int_probe(struct platform_device *pdev)
err = PTR_ERR(opp); err = PTR_ERR(opp);
goto err_opp_add; goto err_opp_add;
} }
initial_freq = opp_get_freq(opp); initial_freq = dev_pm_opp_get_freq(opp);
initial_volt = opp_get_voltage(opp); initial_volt = dev_pm_opp_get_voltage(opp);
rcu_read_unlock(); rcu_read_unlock();
data->curr_freq = initial_freq; data->curr_freq = initial_freq;
......
...@@ -27,77 +27,79 @@ enum opp_event { ...@@ -27,77 +27,79 @@ enum opp_event {
#if defined(CONFIG_PM_OPP) #if defined(CONFIG_PM_OPP)
unsigned long opp_get_voltage(struct opp *opp); unsigned long dev_pm_opp_get_voltage(struct opp *opp);
unsigned long opp_get_freq(struct opp *opp); unsigned long dev_pm_opp_get_freq(struct opp *opp);
int opp_get_opp_count(struct device *dev); int dev_pm_opp_get_opp_count(struct device *dev);
struct opp *opp_find_freq_exact(struct device *dev, unsigned long freq, struct opp *dev_pm_opp_find_freq_exact(struct device *dev, unsigned long freq,
bool available); bool available);
struct opp *opp_find_freq_floor(struct device *dev, unsigned long *freq); struct opp *dev_pm_opp_find_freq_floor(struct device *dev, unsigned long *freq);
struct opp *opp_find_freq_ceil(struct device *dev, unsigned long *freq); struct opp *dev_pm_opp_find_freq_ceil(struct device *dev, unsigned long *freq);
int opp_add(struct device *dev, unsigned long freq, unsigned long u_volt); int dev_pm_opp_add(struct device *dev, unsigned long freq,
unsigned long u_volt);
int opp_enable(struct device *dev, unsigned long freq); int dev_pm_opp_enable(struct device *dev, unsigned long freq);
int opp_disable(struct device *dev, unsigned long freq); int dev_pm_opp_disable(struct device *dev, unsigned long freq);
struct srcu_notifier_head *opp_get_notifier(struct device *dev); struct srcu_notifier_head *dev_pm_opp_get_notifier(struct device *dev);
#else #else
static inline unsigned long opp_get_voltage(struct opp *opp) static inline unsigned long dev_pm_opp_get_voltage(struct opp *opp)
{ {
return 0; return 0;
} }
static inline unsigned long opp_get_freq(struct opp *opp) static inline unsigned long dev_pm_opp_get_freq(struct opp *opp)
{ {
return 0; return 0;
} }
static inline int opp_get_opp_count(struct device *dev) static inline int dev_pm_opp_get_opp_count(struct device *dev)
{ {
return 0; return 0;
} }
static inline struct opp *opp_find_freq_exact(struct device *dev, static inline struct opp *dev_pm_opp_find_freq_exact(struct device *dev,
unsigned long freq, bool available) unsigned long freq, bool available)
{ {
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
static inline struct opp *opp_find_freq_floor(struct device *dev, static inline struct opp *dev_pm_opp_find_freq_floor(struct device *dev,
unsigned long *freq) unsigned long *freq)
{ {
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
static inline struct opp *opp_find_freq_ceil(struct device *dev, static inline struct opp *dev_pm_opp_find_freq_ceil(struct device *dev,
unsigned long *freq) unsigned long *freq)
{ {
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
static inline int opp_add(struct device *dev, unsigned long freq, static inline int dev_pm_opp_add(struct device *dev, unsigned long freq,
unsigned long u_volt) unsigned long u_volt)
{ {
return -EINVAL; return -EINVAL;
} }
static inline int opp_enable(struct device *dev, unsigned long freq) static inline int dev_pm_opp_enable(struct device *dev, unsigned long freq)
{ {
return 0; return 0;
} }
static inline int opp_disable(struct device *dev, unsigned long freq) static inline int dev_pm_opp_disable(struct device *dev, unsigned long freq)
{ {
return 0; return 0;
} }
static inline struct srcu_notifier_head *opp_get_notifier(struct device *dev) static inline struct srcu_notifier_head *dev_pm_opp_get_notifier(
struct device *dev)
{ {
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
...@@ -113,19 +115,19 @@ static inline int of_init_opp_table(struct device *dev) ...@@ -113,19 +115,19 @@ static inline int of_init_opp_table(struct device *dev)
#endif #endif
#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP) #if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP)
int opp_init_cpufreq_table(struct device *dev, int dev_pm_opp_init_cpufreq_table(struct device *dev,
struct cpufreq_frequency_table **table); struct cpufreq_frequency_table **table);
void opp_free_cpufreq_table(struct device *dev, void dev_pm_opp_free_cpufreq_table(struct device *dev,
struct cpufreq_frequency_table **table); struct cpufreq_frequency_table **table);
#else #else
static inline int opp_init_cpufreq_table(struct device *dev, static inline int dev_pm_opp_init_cpufreq_table(struct device *dev,
struct cpufreq_frequency_table **table) struct cpufreq_frequency_table **table)
{ {
return -EINVAL; return -EINVAL;
} }
static inline static inline
void opp_free_cpufreq_table(struct device *dev, void dev_pm_opp_free_cpufreq_table(struct device *dev,
struct cpufreq_frequency_table **table) struct cpufreq_frequency_table **table)
{ {
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment