aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pm_clock.h
diff options
context:
space:
mode:
authorJon Hunter <jonathanh@nvidia.com>2016-03-15 07:33:40 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-03-16 21:32:04 -0400
commit02113ba93ea414b7113d64e42b87dc0720e3e578 (patch)
treed4a1c34d81214dbd79695c80b90a621d0d2f364f /include/linux/pm_clock.h
parentb562e44f507e863c6792946e4e1b1449fbbac85d (diff)
PM / clk: Add support for obtaining clocks from device-tree
The PM clocks framework requires clients to pass either a con-id or a valid clk pointer in order to add a clock to a device. Add a new function of_pm_clk_add_clks() to allows device clocks to be retrieved from device-tree and populated for a given device. Note that it is not necessary to make the compilation of this new function dependent upon CONFIG_OF because there are stubs functions for the device-tree APIs used. In order to handle errors encountered when adding clocks from device-tree, add a function pm_clk_remove_clk() to remove any clocks (using a pointer to the clk structure) that have been added successfully before the error occurred. Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/linux/pm_clock.h')
-rw-r--r--include/linux/pm_clock.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/pm_clock.h b/include/linux/pm_clock.h
index 25266c600021..308d6044f153 100644
--- a/include/linux/pm_clock.h
+++ b/include/linux/pm_clock.h
@@ -42,7 +42,9 @@ extern int pm_clk_create(struct device *dev);
42extern void pm_clk_destroy(struct device *dev); 42extern void pm_clk_destroy(struct device *dev);
43extern int pm_clk_add(struct device *dev, const char *con_id); 43extern int pm_clk_add(struct device *dev, const char *con_id);
44extern int pm_clk_add_clk(struct device *dev, struct clk *clk); 44extern int pm_clk_add_clk(struct device *dev, struct clk *clk);
45extern int of_pm_clk_add_clks(struct device *dev);
45extern void pm_clk_remove(struct device *dev, const char *con_id); 46extern void pm_clk_remove(struct device *dev, const char *con_id);
47extern void pm_clk_remove_clk(struct device *dev, struct clk *clk);
46extern int pm_clk_suspend(struct device *dev); 48extern int pm_clk_suspend(struct device *dev);
47extern int pm_clk_resume(struct device *dev); 49extern int pm_clk_resume(struct device *dev);
48#else 50#else
@@ -69,11 +71,18 @@ static inline int pm_clk_add_clk(struct device *dev, struct clk *clk)
69{ 71{
70 return -EINVAL; 72 return -EINVAL;
71} 73}
74static inline int of_pm_clk_add_clks(struct device *dev)
75{
76 return -EINVAL;
77}
72static inline void pm_clk_remove(struct device *dev, const char *con_id) 78static inline void pm_clk_remove(struct device *dev, const char *con_id)
73{ 79{
74} 80}
75#define pm_clk_suspend NULL 81#define pm_clk_suspend NULL
76#define pm_clk_resume NULL 82#define pm_clk_resume NULL
83static inline void pm_clk_remove_clk(struct device *dev, struct clk *clk)
84{
85}
77#endif 86#endif
78 87
79#ifdef CONFIG_HAVE_CLK 88#ifdef CONFIG_HAVE_CLK