omap_pm 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. The OMAP PM interface
  2. =====================
  3. This document describes the temporary OMAP PM interface. Driver
  4. authors use these functions to communicate minimum latency or
  5. throughput constraints to the kernel power management code.
  6. Over time, the intention is to merge features from the OMAP PM
  7. interface into the Linux PM QoS code.
  8. Drivers need to express PM parameters which:
  9. - support the range of power management parameters present in the TI SRF;
  10. - separate the drivers from the underlying PM parameter
  11. implementation, whether it is the TI SRF or Linux PM QoS or Linux
  12. latency framework or something else;
  13. - specify PM parameters in terms of fundamental units, such as
  14. latency and throughput, rather than units which are specific to OMAP
  15. or to particular OMAP variants;
  16. - allow drivers which are shared with other architectures (e.g.,
  17. DaVinci) to add these constraints in a way which won't affect non-OMAP
  18. systems,
  19. - can be implemented immediately with minimal disruption of other
  20. architectures.
  21. This document proposes the OMAP PM interface, including the following
  22. five power management functions for driver code:
  23. 1. Set the maximum MPU wakeup latency:
  24. (*pdata->set_max_mpu_wakeup_lat)(struct device *dev, unsigned long t)
  25. 2. Set the maximum device wakeup latency:
  26. (*pdata->set_max_dev_wakeup_lat)(struct device *dev, unsigned long t)
  27. 3. Set the maximum system DMA transfer start latency (CORE pwrdm):
  28. (*pdata->set_max_sdma_lat)(struct device *dev, long t)
  29. 4. Set the minimum bus throughput needed by a device:
  30. (*pdata->set_min_bus_tput)(struct device *dev, u8 agent_id, unsigned long r)
  31. 5. Return the number of times the device has lost context
  32. (*pdata->get_dev_context_loss_count)(struct device *dev)
  33. Further documentation for all OMAP PM interface functions can be
  34. found in arch/arm/plat-omap/include/mach/omap-pm.h.
  35. The OMAP PM layer is intended to be temporary
  36. ---------------------------------------------
  37. The intention is that eventually the Linux PM QoS layer should support
  38. the range of power management features present in OMAP3. As this
  39. happens, existing drivers using the OMAP PM interface can be modified
  40. to use the Linux PM QoS code; and the OMAP PM interface can disappear.
  41. Driver usage of the OMAP PM functions
  42. -------------------------------------
  43. As the 'pdata' in the above examples indicates, these functions are
  44. exposed to drivers through function pointers in driver .platform_data
  45. structures. The function pointers are initialized by the board-*.c
  46. files to point to the corresponding OMAP PM functions:
  47. .set_max_dev_wakeup_lat will point to
  48. omap_pm_set_max_dev_wakeup_lat(), etc. Other architectures which do
  49. not support these functions should leave these function pointers set
  50. to NULL. Drivers should use the following idiom:
  51. if (pdata->set_max_dev_wakeup_lat)
  52. (*pdata->set_max_dev_wakeup_lat)(dev, t);
  53. The most common usage of these functions will probably be to specify
  54. the maximum time from when an interrupt occurs, to when the device
  55. becomes accessible. To accomplish this, driver writers should use the
  56. set_max_mpu_wakeup_lat() function to constrain the MPU wakeup
  57. latency, and the set_max_dev_wakeup_lat() function to constrain the
  58. device wakeup latency (from clk_enable() to accessibility). For
  59. example,
  60. /* Limit MPU wakeup latency */
  61. if (pdata->set_max_mpu_wakeup_lat)
  62. (*pdata->set_max_mpu_wakeup_lat)(dev, tc);
  63. /* Limit device powerdomain wakeup latency */
  64. if (pdata->set_max_dev_wakeup_lat)
  65. (*pdata->set_max_dev_wakeup_lat)(dev, td);
  66. /* total wakeup latency in this example: (tc + td) */
  67. The PM parameters can be overwritten by calling the function again
  68. with the new value. The settings can be removed by calling the
  69. function with a t argument of -1 (except in the case of
  70. set_max_bus_tput(), which should be called with an r argument of 0).
  71. The fifth function above, omap_pm_get_dev_context_loss_count(),
  72. is intended as an optimization to allow drivers to determine whether the
  73. device has lost its internal context. If context has been lost, the
  74. driver must restore its internal context before proceeding.
  75. Other specialized interface functions
  76. -------------------------------------
  77. The five functions listed above are intended to be usable by any
  78. device driver. DSPBridge and CPUFreq have a few special requirements.
  79. DSPBridge expresses target DSP performance levels in terms of OPP IDs.
  80. CPUFreq expresses target MPU performance levels in terms of MPU
  81. frequency. The OMAP PM interface contains functions for these
  82. specialized cases to convert that input information (OPPs/MPU
  83. frequency) into the form that the underlying power management
  84. implementation needs:
  85. 6. (*pdata->dsp_get_opp_table)(void)
  86. 7. (*pdata->dsp_set_min_opp)(u8 opp_id)
  87. 8. (*pdata->dsp_get_opp)(void)
  88. 9. (*pdata->cpu_get_freq_table)(void)
  89. 10. (*pdata->cpu_set_freq)(unsigned long f)
  90. 11. (*pdata->cpu_get_freq)(void)
  91. Customizing OPP for platform
  92. ============================
  93. Defining CONFIG_PM should enable OPP layer for the silicon
  94. and the registration of OPP table should take place automatically.
  95. However, in special cases, the default OPP table may need to be
  96. tweaked, for e.g.:
  97. * enable default OPPs which are disabled by default, but which
  98. could be enabled on a platform
  99. * Disable an unsupported OPP on the platform
  100. * Define and add a custom opp table entry
  101. in these cases, the board file needs to do additional steps as follows:
  102. arch/arm/mach-omapx/board-xyz.c
  103. #include "pm.h"
  104. ....
  105. static void __init omap_xyz_init_irq(void)
  106. {
  107. ....
  108. /* Initialize the default table */
  109. omapx_opp_init();
  110. /* Do customization to the defaults */
  111. ....
  112. }
  113. NOTE: omapx_opp_init will be omap3_opp_init or as required
  114. based on the omap family.