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