summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-09-09 02:21:06 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-09-09 02:21:06 +0200
commitd9df93ec8eb751f96c8070f104fa2a588b5ad345 (patch)
tree569e09bcdb6dd9656f278ec0320a242252ff9694 /drivers
parent63431f789c957cebcffeb51953dfaeb7f1ddd827 (diff)
parent4eafbd15b6c84cd3f6c76022c8a6c27f7cc076e1 (diff)
downloadlinux-d9df93ec8eb751f96c8070f104fa2a588b5ad345.tar.gz
linux-d9df93ec8eb751f96c8070f104fa2a588b5ad345.tar.bz2
linux-d9df93ec8eb751f96c8070f104fa2a588b5ad345.zip
Merge branch 'pm-opp' into pm-cpufreq
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/power/opp.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
index bb703b5ebaff..3df62dbcec3a 100644
--- a/drivers/base/power/opp.c
+++ b/drivers/base/power/opp.c
@@ -341,6 +341,36 @@ unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev)
EXPORT_SYMBOL_GPL(dev_pm_opp_get_max_clock_latency);
/**
+ * dev_pm_opp_get_suspend_opp() - Get suspend opp
+ * @dev: device for which we do this operation
+ *
+ * Return: This function returns pointer to the suspend opp if it is
+ * defined, otherwise it returns NULL.
+ *
+ * Locking: This function must be called under rcu_read_lock(). opp is a rcu
+ * protected pointer. The reason for the same is that the opp pointer which is
+ * returned will remain valid for use with opp_get_{voltage, freq} only while
+ * under the locked area. The pointer returned must be used prior to unlocking
+ * with rcu_read_unlock() to maintain the integrity of the pointer.
+ */
+struct dev_pm_opp *dev_pm_opp_get_suspend_opp(struct device *dev)
+{
+ struct device_opp *dev_opp;
+ struct dev_pm_opp *opp;
+
+ opp_rcu_lockdep_assert();
+
+ dev_opp = _find_device_opp(dev);
+ if (IS_ERR(dev_opp))
+ opp = NULL;
+ else
+ opp = dev_opp->suspend_opp;
+
+ return opp;
+}
+EXPORT_SYMBOL_GPL(dev_pm_opp_get_suspend_opp);
+
+/**
* dev_pm_opp_get_opp_count() - Get number of opps available in the opp list
* @dev: device for which we do this operation
*