File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -340,6 +340,34 @@ unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev)
340340}
341341EXPORT_SYMBOL_GPL (dev_pm_opp_get_max_clock_latency );
342342
343+ /**
344+ * dev_pm_opp_get_suspend_opp() - Get suspend opp
345+ * @dev: device for which we do this operation
346+ *
347+ * Return: This function returns pointer to the suspend opp if it is
348+ * defined and available, otherwise it returns NULL.
349+ *
350+ * Locking: This function must be called under rcu_read_lock(). opp is a rcu
351+ * protected pointer. The reason for the same is that the opp pointer which is
352+ * returned will remain valid for use with opp_get_{voltage, freq} only while
353+ * under the locked area. The pointer returned must be used prior to unlocking
354+ * with rcu_read_unlock() to maintain the integrity of the pointer.
355+ */
356+ struct dev_pm_opp * dev_pm_opp_get_suspend_opp (struct device * dev )
357+ {
358+ struct device_opp * dev_opp ;
359+
360+ opp_rcu_lockdep_assert ();
361+
362+ dev_opp = _find_device_opp (dev );
363+ if (IS_ERR (dev_opp ) || !dev_opp -> suspend_opp ||
364+ !dev_opp -> suspend_opp -> available )
365+ return NULL ;
366+
367+ return dev_opp -> suspend_opp ;
368+ }
369+ EXPORT_SYMBOL_GPL (dev_pm_opp_get_suspend_opp );
370+
343371/**
344372 * dev_pm_opp_get_opp_count() - Get number of opps available in the opp list
345373 * @dev: device for which we do this operation
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ bool dev_pm_opp_is_turbo(struct dev_pm_opp *opp);
3434
3535int dev_pm_opp_get_opp_count (struct device * dev );
3636unsigned long dev_pm_opp_get_max_clock_latency (struct device * dev );
37+ struct dev_pm_opp * dev_pm_opp_get_suspend_opp (struct device * dev );
3738
3839struct dev_pm_opp * dev_pm_opp_find_freq_exact (struct device * dev ,
3940 unsigned long freq ,
@@ -80,6 +81,11 @@ static inline unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev)
8081 return 0 ;
8182}
8283
84+ static inline struct dev_pm_opp * dev_pm_opp_get_suspend_opp (struct device * dev )
85+ {
86+ return NULL ;
87+ }
88+
8389static inline struct dev_pm_opp * dev_pm_opp_find_freq_exact (struct device * dev ,
8490 unsigned long freq , bool available )
8591{
You can’t perform that action at this time.
0 commit comments