pm_qos.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef _LINUX_PM_QOS_H
  2. #define _LINUX_PM_QOS_H
  3. /* interface for the pm_qos_power infrastructure of the linux kernel.
  4. *
  5. * Mark Gross <mgross@linux.intel.com>
  6. */
  7. #include <linux/plist.h>
  8. #include <linux/notifier.h>
  9. #include <linux/miscdevice.h>
  10. #define PM_QOS_RESERVED 0
  11. #define PM_QOS_CPU_DMA_LATENCY 1
  12. #define PM_QOS_NETWORK_LATENCY 2
  13. #define PM_QOS_NETWORK_THROUGHPUT 3
  14. #define PM_QOS_NUM_CLASSES 4
  15. #define PM_QOS_DEFAULT_VALUE -1
  16. #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
  17. #define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
  18. #define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0
  19. struct pm_qos_request {
  20. struct plist_node node;
  21. int pm_qos_class;
  22. };
  23. #ifdef CONFIG_PM
  24. void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class,
  25. s32 value);
  26. void pm_qos_update_request(struct pm_qos_request *req,
  27. s32 new_value);
  28. void pm_qos_remove_request(struct pm_qos_request *req);
  29. int pm_qos_request(int pm_qos_class);
  30. int pm_qos_add_notifier(int pm_qos_class, struct notifier_block *notifier);
  31. int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier);
  32. int pm_qos_request_active(struct pm_qos_request *req);
  33. #else
  34. static inline void pm_qos_add_request(struct pm_qos_request *req,
  35. int pm_qos_class, s32 value)
  36. { return; }
  37. static inline void pm_qos_update_request(struct pm_qos_request *req,
  38. s32 new_value)
  39. { return; }
  40. static inline void pm_qos_remove_request(struct pm_qos_request *req)
  41. { return; }
  42. static inline int pm_qos_request(int pm_qos_class)
  43. { return 0; }
  44. static inline int pm_qos_add_notifier(int pm_qos_class,
  45. struct notifier_block *notifier)
  46. { return 0; }
  47. static inline int pm_qos_remove_notifier(int pm_qos_class,
  48. struct notifier_block *notifier)
  49. { return 0; }
  50. static inline int pm_qos_request_active(struct pm_qos_request *req)
  51. { return 0; }
  52. #endif
  53. #endif