pm_clock.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. #ifdef CONFIG_PM_CLK
  18. static inline bool pm_clk_no_clocks(struct device *dev)
  19. {
  20. return dev && dev->power.subsys_data
  21. && list_empty(&dev->power.subsys_data->clock_list);
  22. }
  23. extern void pm_clk_init(struct device *dev);
  24. extern int pm_clk_create(struct device *dev);
  25. extern void pm_clk_destroy(struct device *dev);
  26. extern int pm_clk_add(struct device *dev, const char *con_id);
  27. extern void pm_clk_remove(struct device *dev, const char *con_id);
  28. extern int pm_clk_suspend(struct device *dev);
  29. extern int pm_clk_resume(struct device *dev);
  30. #else
  31. static inline bool pm_clk_no_clocks(struct device *dev)
  32. {
  33. return true;
  34. }
  35. static inline void pm_clk_init(struct device *dev)
  36. {
  37. }
  38. static inline int pm_clk_create(struct device *dev)
  39. {
  40. return -EINVAL;
  41. }
  42. static inline void pm_clk_destroy(struct device *dev)
  43. {
  44. }
  45. static inline int pm_clk_add(struct device *dev, const char *con_id)
  46. {
  47. return -EINVAL;
  48. }
  49. static inline void pm_clk_remove(struct device *dev, const char *con_id)
  50. {
  51. }
  52. #define pm_clk_suspend NULL
  53. #define pm_clk_resume NULL
  54. #endif
  55. #ifdef CONFIG_HAVE_CLK
  56. extern void pm_clk_add_notifier(struct bus_type *bus,
  57. struct pm_clk_notifier_block *clknb);
  58. #else
  59. static inline void pm_clk_add_notifier(struct bus_type *bus,
  60. struct pm_clk_notifier_block *clknb)
  61. {
  62. }
  63. #endif
  64. #endif