summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>2015-04-10 19:58:57 +0200
committerSeung-Woo Kim <sw0312.kim@samsung.com>2015-05-14 14:42:52 +0900
commita46ee8d29e5ac61b3c0fc4c9162bc12f61716772 (patch)
treee410ad9915cd941bbac05f47fd5651760f120f0c
parent917b649199d115b1a23807d1a19be86e658c0f59 (diff)
downloadlinux-exynos-a46ee8d29e5ac61b3c0fc4c9162bc12f61716772.tar.gz
linux-exynos-a46ee8d29e5ac61b3c0fc4c9162bc12f61716772.tar.bz2
linux-exynos-a46ee8d29e5ac61b3c0fc4c9162bc12f61716772.zip
cpufreq / OPP: allow allocation of extra table entries in freq_table
Prefix dev_pm_opp_init_cpufreq_table() with "__" and add a wrapper for it to keep current users unchanged. Then add an extra_opps parameter to __dev_pm_opp_init_cpufreq_table() to allow allocation of extra table entries in freq_table. This patch is a preparation for adding 'boost' mode frequencies support to cpufreq-dt driver. Cc: Tomasz Figa <tomasz.figa@gmail.com> Cc: Mike Turquette <mturquette@linaro.org> Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Cc: Thomas Abraham <thomas.ab@samsung.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
-rw-r--r--drivers/cpufreq/cpufreq_opp.c18
-rw-r--r--include/linux/cpufreq.h3
2 files changed, 17 insertions, 4 deletions
diff --git a/drivers/cpufreq/cpufreq_opp.c b/drivers/cpufreq/cpufreq_opp.c
index 773bcde893c0..773164ba41dc 100644
--- a/drivers/cpufreq/cpufreq_opp.c
+++ b/drivers/cpufreq/cpufreq_opp.c
@@ -21,9 +21,10 @@
#include <linux/slab.h>
/**
- * dev_pm_opp_init_cpufreq_table() - create a cpufreq table for a device
+ * __dev_pm_opp_init_cpufreq_table() - create a cpufreq table for a device
* @dev: device for which we do this operation
* @table: Cpufreq table returned back to caller
+ * @extra_opps: Number of extra table entries to allocate
*
* Generate a cpufreq table for a provided device- this assumes that the
* opp list is already initialized and ready for usage.
@@ -44,8 +45,9 @@
* structures, we use RCU read lock inside this function. As a result, users of
* this function DONOT need to use explicit locks for invoking.
*/
-int dev_pm_opp_init_cpufreq_table(struct device *dev,
- struct cpufreq_frequency_table **table)
+int __dev_pm_opp_init_cpufreq_table(struct device *dev,
+ struct cpufreq_frequency_table **table,
+ unsigned int extra_opps)
{
struct dev_pm_opp *opp;
struct cpufreq_frequency_table *freq_table = NULL;
@@ -60,7 +62,8 @@ int dev_pm_opp_init_cpufreq_table(struct device *dev,
goto out;
}
- freq_table = kcalloc((max_opps + 1), sizeof(*freq_table), GFP_ATOMIC);
+ freq_table = kcalloc((max_opps + extra_opps + 1), sizeof(*freq_table),
+ GFP_ATOMIC);
if (!freq_table) {
ret = -ENOMEM;
goto out;
@@ -89,6 +92,13 @@ out:
return ret;
}
+EXPORT_SYMBOL_GPL(__dev_pm_opp_init_cpufreq_table);
+
+int dev_pm_opp_init_cpufreq_table(struct device *dev,
+ struct cpufreq_frequency_table **table)
+{
+ return __dev_pm_opp_init_cpufreq_table(dev, table, 0);
+}
EXPORT_SYMBOL_GPL(dev_pm_opp_init_cpufreq_table);
/**
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 2ee4888c1f47..e46feed9f068 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -505,6 +505,9 @@ struct cpufreq_frequency_table {
};
#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP)
+int __dev_pm_opp_init_cpufreq_table(struct device *dev,
+ struct cpufreq_frequency_table **table,
+ unsigned int extra_opps);
int dev_pm_opp_init_cpufreq_table(struct device *dev,
struct cpufreq_frequency_table **table);
void dev_pm_opp_free_cpufreq_table(struct device *dev,