at v4.6 2.4 kB view raw
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_clks(struct device *dev); 46extern void pm_clk_remove(struct device *dev, const char *con_id); 47extern void pm_clk_remove_clk(struct device *dev, struct clk *clk); 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} 69 70static inline int pm_clk_add_clk(struct device *dev, struct clk *clk) 71{ 72 return -EINVAL; 73} 74static inline int of_pm_clk_add_clks(struct device *dev) 75{ 76 return -EINVAL; 77} 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 83static inline void pm_clk_remove_clk(struct device *dev, struct clk *clk) 84{ 85} 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