rpm.txt 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. Introduction
  2. ============
  3. Resource Power Manager (RPM)
  4. RPM is a dedicated hardware engine for managing shared SoC resources,
  5. which includes buses, clocks, power rails, etc. The goal of RPM is
  6. to achieve the maximum power savings while satisfying the SoC's
  7. operational and performance requirements. RPM accepts resource
  8. requests from multiple RPM masters. It arbitrates and aggregates the
  9. requests, and configures the shared resources. The RPM masters are
  10. the application processor, the modem processor, as well as some
  11. hardware accelerators.
  12. The RPM driver provides an API for interacting with RPM. Kernel code
  13. calls the RPM driver to request RPM-managed, shared resources.
  14. Kernel code can also register with the driver for RPM notifications,
  15. which are sent when the status of shared resources change.
  16. Hardware description
  17. ====================
  18. RPM exposes a separate region of registers to each of the RPM masters.
  19. In general, each register represents some shared resource(s). At a
  20. very basic level, a master requests resources by writing to the
  21. registers, then generating an interrupt to RPM. RPM processes the
  22. request, writes acknowledgement to the registers, then generates an
  23. interrupt to the master.
  24. In addition to the master-specific regions, RPM also exposes a shared
  25. region that contains the current status of the shared resources. Only
  26. RPM can write to the status region, but every master can read from it.
  27. RPM contains internal logics that aggregate and arbitrate among
  28. requests from the various RPM masters. It interfaces with the PMIC,
  29. the bus arbitration block, and the clock controller block in order to
  30. configure the shared resources.
  31. Software description
  32. ====================
  33. The RPM driver encapsulates the low level RPM interactions, which
  34. rely on reading/writing registers and generating/processing
  35. interrupts, and provides a higher level synchronuous set/clear/get
  36. interface. Most functions take an array of id-value pairs.
  37. The ids identify the RPM registers which would correspond to some
  38. RPM resources, the values specify the new resource values.
  39. The RPM driver synchronizes accesses to RPM. It protects against
  40. simultaneous accesses from multiple tasks, on SMP cores, in task
  41. contexts, and in atomic contexts.
  42. Design
  43. ======
  44. Design goals:
  45. - Encapsulate low level RPM interactions.
  46. - Provide a synchronuous set/clear/get interface.
  47. - Synchronize simultaneous software accesses to RPM.
  48. Power Management
  49. ================
  50. RPM is part of the power management architecture for MSM 8660. RPM
  51. manages shared system resources to lower system power.
  52. SMP/multi-core
  53. ==============
  54. The RPM driver uses mutex to synchronize client accesses among tasks.
  55. It uses spinlocks to synchronize accesses from atomic contexts and
  56. SMP cores.
  57. Security
  58. ========
  59. None.
  60. Performance
  61. ===========
  62. None.
  63. Interface
  64. =========
  65. msm_rpm_get_status():
  66. The function reads the shared status region and returns the current
  67. resource values, which are the arbitrated/aggregated results across
  68. all RPM masters.
  69. msm_rpm_set():
  70. The function makes a resource request to RPM.
  71. msm_rpm_set_noirq():
  72. The function is similar to msm_rpm_set() except that it must be
  73. called with interrupts masked. If possible, use msm_rpm_set()
  74. instead, to maximize CPU throughput.
  75. msm_rpm_clear():
  76. The function makes a resource request to RPM to clear resource values.
  77. Once the values are cleared, the resources revert back to their default
  78. values for this RPM master. RPM internally uses the default values as
  79. the requests from this RPM master when arbitrating and aggregating with
  80. requests from other RPM masters.
  81. msm_rpm_clear_noirq():
  82. The function is similar to msm_rpm_clear() except that it must be
  83. called with interrupts masked. If possible, use msm_rpm_clear()
  84. instead, to maximize CPU throughput.
  85. msm_rpm_register_notification():
  86. The function registers for RPM notification. When the specified
  87. resources change their status on RPM, RPM sends out notifications
  88. and the driver will "up" the semaphore in struct
  89. msm_rpm_notification.
  90. msm_rpm_unregister_notification():
  91. The function unregisters a notification.
  92. msm_rpm_init():
  93. The function initializes the RPM driver with platform specific data.
  94. Driver parameters
  95. =================
  96. None.
  97. Config options
  98. ==============
  99. MSM_RPM
  100. Dependencies
  101. ============
  102. None.
  103. User space utilities
  104. ====================
  105. None.
  106. Other
  107. =====
  108. None.
  109. Known issues
  110. ============
  111. None.
  112. To do
  113. =====
  114. None.