blob: 0b0039634410c158a22c3667b142856dfa4a66a1 [file] [log] [blame]
Rafael J. Wysockib5e8d262011-08-25 15:34:19 +02001/*
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
Geert Uytterhoeven245bd6f2014-11-06 15:51:00 +020021struct clk;
22
Rafael J. Wysockib5e8d262011-08-25 15:34:19 +020023#ifdef CONFIG_PM_CLK
24static inline bool pm_clk_no_clocks(struct device *dev)
25{
26 return dev && dev->power.subsys_data
27 && list_empty(&dev->power.subsys_data->clock_list);
28}
29
30extern void pm_clk_init(struct device *dev);
31extern int pm_clk_create(struct device *dev);
32extern void pm_clk_destroy(struct device *dev);
33extern int pm_clk_add(struct device *dev, const char *con_id);
Geert Uytterhoeven245bd6f2014-11-06 15:51:00 +020034extern int pm_clk_add_clk(struct device *dev, struct clk *clk);
Rafael J. Wysockib5e8d262011-08-25 15:34:19 +020035extern void pm_clk_remove(struct device *dev, const char *con_id);
36extern int pm_clk_suspend(struct device *dev);
37extern int pm_clk_resume(struct device *dev);
38#else
39static inline bool pm_clk_no_clocks(struct device *dev)
40{
41 return true;
42}
43static inline void pm_clk_init(struct device *dev)
44{
45}
46static inline int pm_clk_create(struct device *dev)
47{
48 return -EINVAL;
49}
50static inline void pm_clk_destroy(struct device *dev)
51{
52}
53static inline int pm_clk_add(struct device *dev, const char *con_id)
54{
55 return -EINVAL;
56}
Geert Uytterhoeven245bd6f2014-11-06 15:51:00 +020057
58static inline int pm_clk_add_clk(struct device *dev, struct clk *clk)
59{
60 return -EINVAL;
61}
Rafael J. Wysockib5e8d262011-08-25 15:34:19 +020062static inline void pm_clk_remove(struct device *dev, const char *con_id)
63{
64}
65#define pm_clk_suspend NULL
66#define pm_clk_resume NULL
67#endif
68
69#ifdef CONFIG_HAVE_CLK
70extern void pm_clk_add_notifier(struct bus_type *bus,
71 struct pm_clk_notifier_block *clknb);
72#else
73static inline void pm_clk_add_notifier(struct bus_type *bus,
74 struct pm_clk_notifier_block *clknb)
75{
76}
77#endif
78
79#endif