aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-06-03 17:13:20 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-06-03 17:13:20 -0400
commit057beb1de54d33ecfd3397ed219b1f4518e3b470 (patch)
tree7c67e9d8c88093a3d551111e56401826a964ffba /drivers/base
parent42a09284fab8abc15c8554f2e2aa2368161c77c6 (diff)
parent5ece2399181a5abaf42a4cb607463770686778e6 (diff)
Merge branch 'pm-cpufreq'
* pm-cpufreq: (28 commits) cpufreq: handle calls to ->target_index() in separate routine cpufreq: s5pv210: drop check for CONFIG_PM_VERBOSE cpufreq: intel_pstate: Remove unused member name of cpudata cpufreq: Break out early when frequency equals target_freq cpufreq: Tegra: drop wrapper around tegra_update_cpu_speed() cpufreq: imx6q: Remove unused include cpufreq: imx6q: Drop devm_clk/regulator_get usage cpufreq: powernow-k8: Suppress checkpatch warnings cpufreq: powernv: make local function static cpufreq: Enable big.LITTLE cpufreq driver on arm64 cpufreq: nforce2: remove DEFINE_PCI_DEVICE_TABLE macro intel_pstate: Add CPU IDs for Broadwell processors cpufreq: Fix build error on some platforms that use cpufreq_for_each_* PM / OPP: Move cpufreq specific OPP functions out of generic OPP library PM / OPP: Remove cpufreq wrapper dependency on internal data organization cpufreq: Catch double invocations of cpufreq_freq_transition_begin/end intel_pstate: Remove sample parameter in intel_pstate_calc_busy cpufreq: Kconfig: Fix spelling errors cpufreq: Make linux-pm@vger.kernel.org official mailing list cpufreq: exynos: Use dev_err/info function instead of pr_err/info ...
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/power/opp.c91
1 files changed, 0 insertions, 91 deletions
diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
index 39412c15db70..89ced955fafa 100644
--- a/drivers/base/power/opp.c
+++ b/drivers/base/power/opp.c
@@ -15,7 +15,6 @@
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/err.h> 16#include <linux/err.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/cpufreq.h>
19#include <linux/device.h> 18#include <linux/device.h>
20#include <linux/list.h> 19#include <linux/list.h>
21#include <linux/rculist.h> 20#include <linux/rculist.h>
@@ -619,96 +618,6 @@ int dev_pm_opp_disable(struct device *dev, unsigned long freq)
619} 618}
620EXPORT_SYMBOL_GPL(dev_pm_opp_disable); 619EXPORT_SYMBOL_GPL(dev_pm_opp_disable);
621 620
622#ifdef CONFIG_CPU_FREQ
623/**
624 * dev_pm_opp_init_cpufreq_table() - create a cpufreq table for a device
625 * @dev: device for which we do this operation
626 * @table: Cpufreq table returned back to caller
627 *
628 * Generate a cpufreq table for a provided device- this assumes that the
629 * opp list is already initialized and ready for usage.
630 *
631 * This function allocates required memory for the cpufreq table. It is
632 * expected that the caller does the required maintenance such as freeing
633 * the table as required.
634 *
635 * Returns -EINVAL for bad pointers, -ENODEV if the device is not found, -ENOMEM
636 * if no memory available for the operation (table is not populated), returns 0
637 * if successful and table is populated.
638 *
639 * WARNING: It is important for the callers to ensure refreshing their copy of
640 * the table if any of the mentioned functions have been invoked in the interim.
641 *
642 * Locking: The internal device_opp and opp structures are RCU protected.
643 * To simplify the logic, we pretend we are updater and hold relevant mutex here
644 * Callers should ensure that this function is *NOT* called under RCU protection
645 * or in contexts where mutex locking cannot be used.
646 */
647int dev_pm_opp_init_cpufreq_table(struct device *dev,
648 struct cpufreq_frequency_table **table)
649{
650 struct device_opp *dev_opp;
651 struct dev_pm_opp *opp;
652 struct cpufreq_frequency_table *freq_table;
653 int i = 0;
654
655 /* Pretend as if I am an updater */
656 mutex_lock(&dev_opp_list_lock);
657
658 dev_opp = find_device_opp(dev);
659 if (IS_ERR(dev_opp)) {
660 int r = PTR_ERR(dev_opp);
661 mutex_unlock(&dev_opp_list_lock);
662 dev_err(dev, "%s: Device OPP not found (%d)\n", __func__, r);
663 return r;
664 }
665
666 freq_table = kzalloc(sizeof(struct cpufreq_frequency_table) *
667 (dev_pm_opp_get_opp_count(dev) + 1), GFP_KERNEL);
668 if (!freq_table) {
669 mutex_unlock(&dev_opp_list_lock);
670 dev_warn(dev, "%s: Unable to allocate frequency table\n",
671 __func__);
672 return -ENOMEM;
673 }
674
675 list_for_each_entry(opp, &dev_opp->opp_list, node) {
676 if (opp->available) {
677 freq_table[i].driver_data = i;
678 freq_table[i].frequency = opp->rate / 1000;
679 i++;
680 }
681 }
682 mutex_unlock(&dev_opp_list_lock);
683
684 freq_table[i].driver_data = i;
685 freq_table[i].frequency = CPUFREQ_TABLE_END;
686
687 *table = &freq_table[0];
688
689 return 0;
690}
691EXPORT_SYMBOL_GPL(dev_pm_opp_init_cpufreq_table);
692
693/**
694 * dev_pm_opp_free_cpufreq_table() - free the cpufreq table
695 * @dev: device for which we do this operation
696 * @table: table to free
697 *
698 * Free up the table allocated by dev_pm_opp_init_cpufreq_table
699 */
700void dev_pm_opp_free_cpufreq_table(struct device *dev,
701 struct cpufreq_frequency_table **table)
702{
703 if (!table)
704 return;
705
706 kfree(*table);
707 *table = NULL;
708}
709EXPORT_SYMBOL_GPL(dev_pm_opp_free_cpufreq_table);
710#endif /* CONFIG_CPU_FREQ */
711
712/** 621/**
713 * dev_pm_opp_get_notifier() - find notifier_head of the device with opp 622 * dev_pm_opp_get_notifier() - find notifier_head of the device with opp
714 * @dev: device pointer used to lookup device OPPs. 623 * @dev: device pointer used to lookup device OPPs.