pm_clock.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. #ifndef _LINUX_PM_CLOCK_H
  9. #define _LINUX_PM_CLOCK_H
  10. #include <linux/device.h>
  11. #include <linux/notifier.h>
  12. struct pm_clk_notifier_block {
  13. struct notifier_block nb;
  14. struct dev_pm_domain *pm_domain;
  15. char *con_ids[];
  16. };
  17. struct clk;
  18. #ifdef CONFIG_PM
  19. extern int pm_clk_runtime_suspend(struct device *dev);
  20. extern int pm_clk_runtime_resume(struct device *dev);
  21. #define USE_PM_CLK_RUNTIME_OPS \
  22. .runtime_suspend = pm_clk_runtime_suspend, \
  23. .runtime_resume = pm_clk_runtime_resume,
  24. #else
  25. #define USE_PM_CLK_RUNTIME_OPS
  26. #endif
  27. #ifdef CONFIG_PM_CLK
  28. static inline bool pm_clk_no_clocks(struct device *dev)
  29. {
  30. return dev && dev->power.subsys_data
  31. && list_empty(&dev->power.subsys_data->clock_list);
  32. }
  33. extern void pm_clk_init(struct device *dev);
  34. extern int pm_clk_create(struct device *dev);
  35. extern void pm_clk_destroy(struct device *dev);
  36. extern int pm_clk_add(struct device *dev, const char *con_id);
  37. extern int pm_clk_add_clk(struct device *dev, struct clk *clk);
  38. extern void pm_clk_remove(struct device *dev, const char *con_id);
  39. extern int pm_clk_suspend(struct device *dev);
  40. extern int pm_clk_resume(struct device *dev);
  41. #else
  42. static inline bool pm_clk_no_clocks(struct device *dev)
  43. {
  44. return true;
  45. }
  46. static inline void pm_clk_init(struct device *dev)
  47. {
  48. }
  49. static inline int pm_clk_create(struct device *dev)
  50. {
  51. return -EINVAL;
  52. }
  53. static inline void pm_clk_destroy(struct device *dev)
  54. {
  55. }
  56. static inline int pm_clk_add(struct device *dev, const char *con_id)
  57. {
  58. return -EINVAL;
  59. }
  60. static inline int pm_clk_add_clk(struct device *dev, struct clk *clk)
  61. {
  62. return -EINVAL;
  63. }
  64. static inline void pm_clk_remove(struct device *dev, const char *con_id)
  65. {
  66. }
  67. #define pm_clk_suspend NULL
  68. #define pm_clk_resume NULL
  69. #endif
  70. #ifdef CONFIG_HAVE_CLK
  71. extern void pm_clk_add_notifier(struct bus_type *bus,
  72. struct pm_clk_notifier_block *clknb);
  73. #else
  74. static inline void pm_clk_add_notifier(struct bus_type *bus,
  75. struct pm_clk_notifier_block *clknb)
  76. {
  77. }
  78. #endif
  79. #endif