omap-pm.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /*
  2. * omap-pm.h - OMAP power management interface
  3. *
  4. * Copyright (C) 2008-2010 Texas Instruments, Inc.
  5. * Copyright (C) 2008-2010 Nokia Corporation
  6. * Paul Walmsley
  7. *
  8. * Interface developed by (in alphabetical order): Karthik Dasu, Jouni
  9. * Högander, Tony Lindgren, Rajendra Nayak, Sakari Poussa,
  10. * Veeramanikandan Raju, Anand Sawant, Igor Stoppa, Paul Walmsley,
  11. * Richard Woodruff
  12. */
  13. #ifndef ASM_ARM_ARCH_OMAP_OMAP_PM_H
  14. #define ASM_ARM_ARCH_OMAP_OMAP_PM_H
  15. #include <linux/device.h>
  16. #include <linux/cpufreq.h>
  17. #include <linux/clk.h>
  18. #include <linux/pm_opp.h>
  19. /*
  20. * agent_id values for use with omap_pm_set_min_bus_tput():
  21. *
  22. * OCP_INITIATOR_AGENT is only valid for devices that can act as
  23. * initiators -- it represents the device's L3 interconnect
  24. * connection. OCP_TARGET_AGENT represents the device's L4
  25. * interconnect connection.
  26. */
  27. #define OCP_TARGET_AGENT 1
  28. #define OCP_INITIATOR_AGENT 2
  29. /**
  30. * omap_pm_if_early_init - OMAP PM init code called before clock fw init
  31. * @mpu_opp_table: array ptr to struct omap_opp for MPU
  32. * @dsp_opp_table: array ptr to struct omap_opp for DSP
  33. * @l3_opp_table : array ptr to struct omap_opp for CORE
  34. *
  35. * Initialize anything that must be configured before the clock
  36. * framework starts. The "_if_" is to avoid name collisions with the
  37. * PM idle-loop code.
  38. */
  39. int __init omap_pm_if_early_init(void);
  40. /**
  41. * omap_pm_if_init - OMAP PM init code called after clock fw init
  42. *
  43. * The main initialization code. OPP tables are passed in here. The
  44. * "_if_" is to avoid name collisions with the PM idle-loop code.
  45. */
  46. int __init omap_pm_if_init(void);
  47. /*
  48. * Device-driver-originated constraints (via board-*.c files, platform_data)
  49. */
  50. /**
  51. * omap_pm_set_max_mpu_wakeup_lat - set the maximum MPU wakeup latency
  52. * @dev: struct device * requesting the constraint
  53. * @t: maximum MPU wakeup latency in microseconds
  54. *
  55. * Request that the maximum interrupt latency for the MPU to be no
  56. * greater than @t microseconds. "Interrupt latency" in this case is
  57. * defined as the elapsed time from the occurrence of a hardware or
  58. * timer interrupt to the time when the device driver's interrupt
  59. * service routine has been entered by the MPU.
  60. *
  61. * It is intended that underlying PM code will use this information to
  62. * determine what power state to put the MPU powerdomain into, and
  63. * possibly the CORE powerdomain as well, since interrupt handling
  64. * code currently runs from SDRAM. Advanced PM or board*.c code may
  65. * also configure interrupt controller priorities, OCP bus priorities,
  66. * CPU speed(s), etc.
  67. *
  68. * This function will not affect device wakeup latency, e.g., time
  69. * elapsed from when a device driver enables a hardware device with
  70. * clk_enable(), to when the device is ready for register access or
  71. * other use. To control this device wakeup latency, use
  72. * omap_pm_set_max_dev_wakeup_lat()
  73. *
  74. * Multiple calls to omap_pm_set_max_mpu_wakeup_lat() will replace the
  75. * previous t value. To remove the latency target for the MPU, call
  76. * with t = -1.
  77. *
  78. * XXX This constraint will be deprecated soon in favor of the more
  79. * general omap_pm_set_max_dev_wakeup_lat()
  80. *
  81. * Returns -EINVAL for an invalid argument, -ERANGE if the constraint
  82. * is not satisfiable, or 0 upon success.
  83. */
  84. int omap_pm_set_max_mpu_wakeup_lat(struct device *dev, long t);
  85. /**
  86. * omap_pm_set_min_bus_tput - set minimum bus throughput needed by device
  87. * @dev: struct device * requesting the constraint
  88. * @tbus_id: interconnect to operate on (OCP_{INITIATOR,TARGET}_AGENT)
  89. * @r: minimum throughput (in KiB/s)
  90. *
  91. * Request that the minimum data throughput on the OCP interconnect
  92. * attached to device @dev interconnect agent @tbus_id be no less
  93. * than @r KiB/s.
  94. *
  95. * It is expected that the OMAP PM or bus code will use this
  96. * information to set the interconnect clock to run at the lowest
  97. * possible speed that satisfies all current system users. The PM or
  98. * bus code will adjust the estimate based on its model of the bus, so
  99. * device driver authors should attempt to specify an accurate
  100. * quantity for their device use case, and let the PM or bus code
  101. * overestimate the numbers as necessary to handle request/response
  102. * latency, other competing users on the system, etc. On OMAP2/3, if
  103. * a driver requests a minimum L4 interconnect speed constraint, the
  104. * code will also need to add an minimum L3 interconnect speed
  105. * constraint,
  106. *
  107. * Multiple calls to omap_pm_set_min_bus_tput() will replace the
  108. * previous rate value for this device. To remove the interconnect
  109. * throughput restriction for this device, call with r = 0.
  110. *
  111. * Returns -EINVAL for an invalid argument, -ERANGE if the constraint
  112. * is not satisfiable, or 0 upon success.
  113. */
  114. int omap_pm_set_min_bus_tput(struct device *dev, u8 agent_id, unsigned long r);
  115. /*
  116. * CPUFreq-originated constraint
  117. *
  118. * In the future, this should be handled by custom OPP clocktype
  119. * functions.
  120. */
  121. /*
  122. * Device context loss tracking
  123. */
  124. /**
  125. * omap_pm_get_dev_context_loss_count - return count of times dev has lost ctx
  126. * @dev: struct device *
  127. *
  128. * This function returns the number of times that the device @dev has
  129. * lost its internal context. This generally occurs on a powerdomain
  130. * transition to OFF. Drivers use this as an optimization to avoid restoring
  131. * context if the device hasn't lost it. To use, drivers should initially
  132. * call this in their context save functions and store the result. Early in
  133. * the driver's context restore function, the driver should call this function
  134. * again, and compare the result to the stored counter. If they differ, the
  135. * driver must restore device context. If the number of context losses
  136. * exceeds the maximum positive integer, the function will wrap to 0 and
  137. * continue counting. Returns the number of context losses for this device,
  138. * or negative value upon error.
  139. */
  140. int omap_pm_get_dev_context_loss_count(struct device *dev);
  141. void omap_pm_enable_off_mode(void);
  142. void omap_pm_disable_off_mode(void);
  143. #endif