Loading...
1/*
2 * pm_clock.h - Definitions and headers related to device clocks.
3 *
4 * Copyright (C) 2011 Rafael J. Wysocki <rjw@sisk.pl>, Renesas Electronics Corp.
5 *
6 * This file is released under the GPLv2.
7 */
8
9#ifndef _LINUX_PM_CLOCK_H
10#define _LINUX_PM_CLOCK_H
11
12#include <linux/device.h>
13#include <linux/notifier.h>
14
15struct pm_clk_notifier_block {
16 struct notifier_block nb;
17 struct dev_pm_domain *pm_domain;
18 char *con_ids[];
19};
20
21#ifdef CONFIG_PM_CLK
22static inline bool pm_clk_no_clocks(struct device *dev)
23{
24 return dev && dev->power.subsys_data
25 && list_empty(&dev->power.subsys_data->clock_list);
26}
27
28extern void pm_clk_init(struct device *dev);
29extern int pm_clk_create(struct device *dev);
30extern void pm_clk_destroy(struct device *dev);
31extern int pm_clk_add(struct device *dev, const char *con_id);
32extern void pm_clk_remove(struct device *dev, const char *con_id);
33extern int pm_clk_suspend(struct device *dev);
34extern int pm_clk_resume(struct device *dev);
35#else
36static inline bool pm_clk_no_clocks(struct device *dev)
37{
38 return true;
39}
40static inline void pm_clk_init(struct device *dev)
41{
42}
43static inline int pm_clk_create(struct device *dev)
44{
45 return -EINVAL;
46}
47static inline void pm_clk_destroy(struct device *dev)
48{
49}
50static inline int pm_clk_add(struct device *dev, const char *con_id)
51{
52 return -EINVAL;
53}
54static inline void pm_clk_remove(struct device *dev, const char *con_id)
55{
56}
57#define pm_clk_suspend NULL
58#define pm_clk_resume NULL
59#endif
60
61#ifdef CONFIG_HAVE_CLK
62extern void pm_clk_add_notifier(struct bus_type *bus,
63 struct pm_clk_notifier_block *clknb);
64#else
65static inline void pm_clk_add_notifier(struct bus_type *bus,
66 struct pm_clk_notifier_block *clknb)
67{
68}
69#endif
70
71#endif
1/*
2 * pm_clock.h - Definitions and headers related to device clocks.
3 *
4 * Copyright (C) 2011 Rafael J. Wysocki <rjw@sisk.pl>, Renesas Electronics Corp.
5 *
6 * This file is released under the GPLv2.
7 */
8
9#ifndef _LINUX_PM_CLOCK_H
10#define _LINUX_PM_CLOCK_H
11
12#include <linux/device.h>
13#include <linux/notifier.h>
14
15struct pm_clk_notifier_block {
16 struct notifier_block nb;
17 struct dev_pm_domain *pm_domain;
18 char *con_ids[];
19};
20
21struct clk;
22
23#ifdef CONFIG_PM
24extern int pm_clk_runtime_suspend(struct device *dev);
25extern 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
32
33#ifdef CONFIG_PM_CLK
34static inline bool pm_clk_no_clocks(struct device *dev)
35{
36 return dev && dev->power.subsys_data
37 && list_empty(&dev->power.subsys_data->clock_list);
38}
39
40extern void pm_clk_init(struct device *dev);
41extern int pm_clk_create(struct device *dev);
42extern void pm_clk_destroy(struct device *dev);
43extern int pm_clk_add(struct device *dev, const char *con_id);
44extern int pm_clk_add_clk(struct device *dev, struct clk *clk);
45extern int of_pm_clk_add_clk(struct device *dev, const char *name);
46extern int of_pm_clk_add_clks(struct device *dev);
47extern void pm_clk_remove(struct device *dev, const char *con_id);
48extern void pm_clk_remove_clk(struct device *dev, struct clk *clk);
49extern int pm_clk_suspend(struct device *dev);
50extern int pm_clk_resume(struct device *dev);
51#else
52static inline bool pm_clk_no_clocks(struct device *dev)
53{
54 return true;
55}
56static inline void pm_clk_init(struct device *dev)
57{
58}
59static inline int pm_clk_create(struct device *dev)
60{
61 return -EINVAL;
62}
63static inline void pm_clk_destroy(struct device *dev)
64{
65}
66static inline int pm_clk_add(struct device *dev, const char *con_id)
67{
68 return -EINVAL;
69}
70
71static inline int pm_clk_add_clk(struct device *dev, struct clk *clk)
72{
73 return -EINVAL;
74}
75static inline int of_pm_clk_add_clks(struct device *dev)
76{
77 return -EINVAL;
78}
79static inline void pm_clk_remove(struct device *dev, const char *con_id)
80{
81}
82#define pm_clk_suspend NULL
83#define pm_clk_resume NULL
84static inline void pm_clk_remove_clk(struct device *dev, struct clk *clk)
85{
86}
87#endif
88
89#ifdef CONFIG_HAVE_CLK
90extern void pm_clk_add_notifier(struct bus_type *bus,
91 struct pm_clk_notifier_block *clknb);
92#else
93static inline void pm_clk_add_notifier(struct bus_type *bus,
94 struct pm_clk_notifier_block *clknb)
95{
96}
97#endif
98
99#endif