@@ -19,6 +19,7 @@
#include <linux/pm_opp.h>
#include <linux/rcupdate.h>
#include <linux/slab.h>
+#include <linux/of.h>
/**
* dev_pm_opp_init_cpufreq_table() - create a cpufreq table for a device
@@ -51,6 +52,11 @@ int dev_pm_opp_init_cpufreq_table(struct device *dev,
struct cpufreq_frequency_table *freq_table = NULL;
int i, max_opps, ret = 0;
unsigned long rate;
+#ifdef CONFIG_CPU_FREQ_BOOST_SW
+ struct cpufreq_frequency_table *ft;
+ int len, count;
+ u32 *boost_freqs = NULL;
+#endif
rcu_read_lock();
@@ -82,6 +88,45 @@ int dev_pm_opp_init_cpufreq_table(struct device *dev,
*table = &freq_table[0];
+#ifdef CONFIG_CPU_FREQ_BOOST_SW
+ if (!of_find_property(dev->of_node, "boost-frequencies", &len))
+ goto out;
+
+ if (!len || !IS_ALIGNED(len, sizeof(u32))) {
+ dev_err(dev, "%s: invalid boost frequency\n", __func__);
+ ret = -EINVAL;
+ goto out;
+ }
+
+ boost_freqs = kmalloc(len, GFP_KERNEL);
+ if (!boost_freqs) {
+ dev_err(dev, "%s: no memory for boost freq table\n", __func__);
+ ret = -ENOMEM;
+ goto out;
+ }
+
+ count = len / sizeof(u32);
+ of_property_read_u32_array(dev->of_node, "boost-frequencies",
+ boost_freqs, count);
+
+ for (i = 0; i < count; i++) {
+ cpufreq_for_each_valid_entry(ft, *table) {
+ if (boost_freqs[i] == ft->frequency) {
+ ft->flags |= CPUFREQ_BOOST_FREQ;
+ pr_debug("%s: marked %d as boost frequency\n",
+ __func__, boost_freqs[i]);
+ break;
+ }
+ }
+
+ if (ft->frequency == CPUFREQ_TABLE_END)
+ dev_err(dev, "%s: invalid boost frequency %d\n",
+ __func__, boost_freqs[i]);
+ }
+
+ kfree(boost_freqs);
+#endif
+
out:
rcu_read_unlock();
if (ret)