Merge tag 'linux-can-next-for-4.12-20170427' of git://git.kernel.org/pub/scm/linux...
[linux-2.6/btrfs-unstable.git] / include / linux / pm_clock.h
blob09779b0ae7206bd2e0364864774d50015da5589e
1 /*
2 * pm_clock.h - Definitions and headers related to device clocks.
4 * Copyright (C) 2011 Rafael J. Wysocki <rjw@sisk.pl>, Renesas Electronics Corp.
6 * This file is released under the GPLv2.
7 */
9 #ifndef _LINUX_PM_CLOCK_H
10 #define _LINUX_PM_CLOCK_H
12 #include <linux/device.h>
13 #include <linux/notifier.h>
15 struct pm_clk_notifier_block {
16 struct notifier_block nb;
17 struct dev_pm_domain *pm_domain;
18 char *con_ids[];
21 struct clk;
23 #ifdef CONFIG_PM
24 extern int pm_clk_runtime_suspend(struct device *dev);
25 extern int pm_clk_runtime_resume(struct device *dev);
26 #define USE_PM_CLK_RUNTIME_OPS \
27 .runtime_suspend = pm_clk_runtime_suspend, \
28 .runtime_resume = pm_clk_runtime_resume,
29 #else
30 #define USE_PM_CLK_RUNTIME_OPS
31 #endif
33 #ifdef CONFIG_PM_CLK
34 static inline bool pm_clk_no_clocks(struct device *dev)
36 return dev && dev->power.subsys_data
37 && list_empty(&dev->power.subsys_data->clock_list);
40 extern void pm_clk_init(struct device *dev);
41 extern int pm_clk_create(struct device *dev);
42 extern void pm_clk_destroy(struct device *dev);
43 extern int pm_clk_add(struct device *dev, const char *con_id);
44 extern int pm_clk_add_clk(struct device *dev, struct clk *clk);
45 extern int of_pm_clk_add_clk(struct device *dev, const char *name);
46 extern int of_pm_clk_add_clks(struct device *dev);
47 extern void pm_clk_remove(struct device *dev, const char *con_id);
48 extern void pm_clk_remove_clk(struct device *dev, struct clk *clk);
49 extern int pm_clk_suspend(struct device *dev);
50 extern int pm_clk_resume(struct device *dev);
51 #else
52 static inline bool pm_clk_no_clocks(struct device *dev)
54 return true;
56 static inline void pm_clk_init(struct device *dev)
59 static inline int pm_clk_create(struct device *dev)
61 return -EINVAL;
63 static inline void pm_clk_destroy(struct device *dev)
66 static inline int pm_clk_add(struct device *dev, const char *con_id)
68 return -EINVAL;
71 static inline int pm_clk_add_clk(struct device *dev, struct clk *clk)
73 return -EINVAL;
75 static inline int of_pm_clk_add_clks(struct device *dev)
77 return -EINVAL;
79 static inline void pm_clk_remove(struct device *dev, const char *con_id)
82 #define pm_clk_suspend NULL
83 #define pm_clk_resume NULL
84 static inline void pm_clk_remove_clk(struct device *dev, struct clk *clk)
87 #endif
89 #ifdef CONFIG_HAVE_CLK
90 extern void pm_clk_add_notifier(struct bus_type *bus,
91 struct pm_clk_notifier_block *clknb);
92 #else
93 static inline void pm_clk_add_notifier(struct bus_type *bus,
94 struct pm_clk_notifier_block *clknb)
97 #endif
99 #endif