1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * pm_clock.h - Definitions and headers related to device clocks.
5 * Copyright (C) 2011 Rafael J. Wysocki <rjw@sisk.pl>, Renesas Electronics Corp.
8 #ifndef _LINUX_PM_CLOCK_H
9 #define _LINUX_PM_CLOCK_H
11 #include <linux/device.h>
12 #include <linux/notifier.h>
14 struct pm_clk_notifier_block
{
15 struct notifier_block nb
;
16 struct dev_pm_domain
*pm_domain
;
23 extern int pm_clk_runtime_suspend(struct device
*dev
);
24 extern int pm_clk_runtime_resume(struct device
*dev
);
25 #define USE_PM_CLK_RUNTIME_OPS \
26 .runtime_suspend = pm_clk_runtime_suspend, \
27 .runtime_resume = pm_clk_runtime_resume,
29 #define USE_PM_CLK_RUNTIME_OPS
33 static inline bool pm_clk_no_clocks(struct device
*dev
)
35 return dev
&& dev
->power
.subsys_data
36 && list_empty(&dev
->power
.subsys_data
->clock_list
);
39 extern void pm_clk_init(struct device
*dev
);
40 extern int pm_clk_create(struct device
*dev
);
41 extern void pm_clk_destroy(struct device
*dev
);
42 extern int pm_clk_add(struct device
*dev
, const char *con_id
);
43 extern int pm_clk_add_clk(struct device
*dev
, struct clk
*clk
);
44 extern int of_pm_clk_add_clk(struct device
*dev
, const char *name
);
45 extern int of_pm_clk_add_clks(struct device
*dev
);
46 extern void pm_clk_remove(struct device
*dev
, const char *con_id
);
47 extern void pm_clk_remove_clk(struct device
*dev
, struct clk
*clk
);
48 extern int pm_clk_suspend(struct device
*dev
);
49 extern int pm_clk_resume(struct device
*dev
);
50 extern int devm_pm_clk_create(struct device
*dev
);
52 static inline bool pm_clk_no_clocks(struct device
*dev
)
56 static inline void pm_clk_init(struct device
*dev
)
59 static inline int pm_clk_create(struct device
*dev
)
63 static inline void pm_clk_destroy(struct device
*dev
)
66 static inline int pm_clk_add(struct device
*dev
, const char *con_id
)
71 static inline int pm_clk_add_clk(struct device
*dev
, struct clk
*clk
)
75 static inline int of_pm_clk_add_clks(struct device
*dev
)
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 static inline int devm_pm_clk_create(struct device
*dev
)
93 #ifdef CONFIG_HAVE_CLK
94 extern void pm_clk_add_notifier(const struct bus_type
*bus
,
95 struct pm_clk_notifier_block
*clknb
);
97 static inline void pm_clk_add_notifier(const struct bus_type
*bus
,
98 struct pm_clk_notifier_block
*clknb
)