msm_thermal.txt 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. MSM thermal driver (MSM_THERMAL)
  2. MSM_THERMAL is a kernel platform driver which regulates thermal conditions
  3. on the device during kernel boot. The goal of MSM_THERMAL is to prevent the
  4. temperature of the system from exceeding a thermal limit at which it cannot
  5. operate. Examples are CPU junction thermal limit, or POP memory thermal limit.
  6. The MSM_THERMAL driver polls the TSENS sensor hardware during boot, and
  7. reduces the maximum CPU frequency allowed in steps, to limit power/thermal
  8. output when a threshold temperature is crossed. It restores the maximum CPU
  9. frequency allowed in the same stepwise fashion when the threshold temperature
  10. (with hysteresis gap) is cleared.
  11. The devicetree representation of the MSM_THERMAL block should be:
  12. Required properties
  13. - compatible: "qcom,msm-thermal"
  14. - qcom,sensor-id: The id of the TSENS sensor polled for temperature.
  15. Typically the sensor closest to CPU0.
  16. - qcom,poll-ms: Sampling interval to read sensor, in ms.
  17. - qcom,limit-temp: Threshold temperature to start stepping CPU down, in degC.
  18. - qcom,temp-hysteresis: Degrees C below threshold temperature to step CPU up.
  19. - qcom,freq-step: Number of frequency steps to take on each CPU mitigation.
  20. Optional properties
  21. - qcom,freq-control-mask: The cpu mask that will be used to determine if a
  22. core can be used for freq control.
  23. - qcom,core-limit-temp: Threshold temperature to start shutting down cores
  24. in degC
  25. - qcom,core-temp-hysteresis: Degrees C below which the cores will be brought
  26. online in sequence.
  27. - qcom,core-control-mask: The cpu mask that will be used to determine if a
  28. core can be controlled or not. A mask of 0 indicates
  29. the feature is disabled.
  30. - qcom,hotplug-temp: Threshold temperature to start shutting down cores
  31. in degC. This will be used when polling based
  32. core control is disabled. The difference between hotplug-temp
  33. and core-limit-temp is that core-limit-temp is used during
  34. early boot prior to thermal_sys being available for hotplug.
  35. - qcom,hotplug-temp-hysteresis: Degrees C below which thermal will not force the
  36. cores to be offlined. Cores can be brought online if needed.
  37. - qcpm,cpu-sensors: List of type names in thermal zone device struct which maps
  38. to cpu0, cpu1, cpu2, cpu3 in sequence depending on how many
  39. cpus there are.
  40. - qcom,freq-mitigation-temp: Threshold temperature to mitigate
  41. the CPU max frequency in degC. This will be
  42. used when polling based frequency control is disabled.
  43. The difference between freq-mitigation-temp
  44. and limit-temp is that limit-temp is used during
  45. early boot prior to thermal_sys being available for registering
  46. temperature thresholds. Also, this emergency frequency
  47. mitigation is a single step frequency mitigation to a predefined value
  48. as opposed to the step by step frequency mitigation during boot-up.
  49. - qcom,freq-mitigation-temp-hysteresis: Degrees C below which thermal will not mitigate the
  50. cpu max frequency.
  51. - qcom,freq-mitigation-value: The frequency value (in kHz) to which the thermal
  52. should mitigate the CPU, when the freq-mitigation-temp
  53. threshold is reached.
  54. - qcom,freq-mitigation-control-mask: The frequency mitigation bitmask that will be
  55. used to determine if KTM should do emergency frequency
  56. mitigation for a core or not. A mask of 0x00 indicates the
  57. mitigation is disabled for all the cores and a mask of 0x05
  58. indicates this mitigation is enabled for cpu-0 and cpu-2.
  59. Note: For KTM's frequency mitigation to work, the data for all the
  60. above four properties (qcom,freq-mitigation-temp; qcom,
  61. freq-mitigation-temp-hysteresis; qcom,freq-mitigation-value and
  62. qcom,freq-mitigation-control-mask) should be populated.
  63. - qcom,vdd-restriction-temp: When temperature is below this threshold, will
  64. enable vdd restriction which will set higher voltage on
  65. key voltage rails, in degC.
  66. - qcom,vdd-restriction-temp-hysteresis: When temperature is above this threshold
  67. will disable vdd restriction on key rails, in degC.
  68. - qcom,pmic-sw-mode-temp: Threshold temperature to disable auto mode on the
  69. rail, in degC. If this property exists,
  70. qcom,pmic-sw-mode-temp-hysteresis and
  71. qcom,pmic-sw-mode-regs need to exist, otherwise return error.
  72. - qcom,pmic-sw-mode-temp-hysteresis: Degree below threshold temperature to
  73. enable auto mode on the rail, in degC. If this property exists,
  74. qcom,pmic-sw-mode-temp and qcom,pmic-sw-mode-regs need to
  75. exist, otherwise return error.
  76. - qcom,pmic-sw-mode-regs: Array of the regulator names that will want to
  77. disable/enable automode based on the threshold. If this
  78. property exists, qcom,pmic-sw-mode-temp and
  79. qcom,pmic-sw-mode-temp-hysteresis need to exist, otherwise
  80. return error. Also, if this property is defined, will have to
  81. define <consumer_supply_name>-supply = <&phandle_of_regulator>
  82. - <consumer_supply_name>-supply = <&phandle_of_regulator>: consumer_supply_name
  83. is the name that's defined in thermal driver.
  84. phandle_of_regulator is defined by reuglator device tree.
  85. - qcom,default-temp: Default cpu temperature limit for SoC. It is an optional
  86. property. Not defining this property requires a full truth
  87. table for qcom,efuse temperature map and valid efuse info for
  88. qcom,efuse-data otherwise feature will be disabled.
  89. - qcom,efuse-data: Efuse data for getting device parts info for cpu temperature
  90. limit recommendation for SoC. It expects below data in order to
  91. read target parts, efuse address, efuse size, row number to be
  92. read, starting bit number of the row for identifying device parts
  93. and number of bits to read from start bit as bit mask.
  94. - qcom,efuse-temperature-map: Truth table of efuse value temperature value pair for
  95. different parts. if qcom,default temp is defined, then it can
  96. specify only pairs which deviate from default temperature.
  97. - qcom,therm-reset-temp: Degree above which the KTM will initiate a secure watchdog reset.
  98. When this property is defined, KTM will monitor all the tsens from
  99. boot time and will initiate a secure watchdog reset if any of the
  100. tsens temperature reaches this threshold. This reset helps in
  101. generating more informative crash dumps opposed to the crash dump
  102. generated by the hardware reset.
  103. Optional child nodes
  104. - qti,pmic-opt-curr-temp: Threshold temperature for requesting optimum current (request
  105. dual phase) for rails with PMIC, in degC. If this property exists,
  106. then the properties, qti,pmic-opt-curr-temp-hysteresis and
  107. qti,pmic-opt-curr-regs should also be defined to enable this
  108. feature.
  109. - qti,pmic-opt-curr-temp-hysteresis: Degree below the threshold to disable the optimum
  110. current request for a rail, in degC. If this property exists,
  111. then the properties, qti,pmic-opt-curr-temp and
  112. qti,pmic-opt-curr-regs should also be defined to enable
  113. this feature.
  114. - qti,pmic-opt-curr-regs: Name of the rails for which the optimum current should be
  115. requested. If this property exists, then the properties,
  116. qti,pmic-opt-curr-temp and qti,pmic-opt-curr-temp-hysteresis
  117. should also be defined to enable this feature.
  118. - qcom,<vdd restriction child node name>: Define the name of the child node.
  119. If this property exisits, qcom,vdd-rstr-reg, qcom,levels
  120. need to exist. qcom,min-level is optional if qcom,freq-req
  121. exists, otherwise it's required.
  122. - qcom,vdd-rstr-reg: Name of the rail
  123. - qcom,levels: Array of the level values. Unit is corner voltage for voltage request
  124. or kHz for frequency request.
  125. - qcom,min-level: Request this level as minimum level when disabling voltage
  126. restriction. Unit is corner voltage for voltage request.
  127. This will not be required if qcom,freq-req exists.
  128. - qcom,freq-req: Flag to determine if we should restrict frequency on this rail
  129. instead of voltage.
  130. Example:
  131. qcom,msm-thermal {
  132. compatible = "qcom,msm-thermal";
  133. qcom,sensor-id = <0>;
  134. qcom,poll-ms = <250>;
  135. qcom,limit-temp = <60>;
  136. qcom,temp-hysteresis = <10>;
  137. qcom,freq-step = <2>;
  138. qcom,freq-control-mask = <0xf>
  139. qcom,therm-reset-temp = <115>;
  140. qcom,core-limit-temp = <90>;
  141. qcom,core-temp-hysteresis = <10>;
  142. qcom,core-control-mask = <7>;
  143. qcom,hotplug-temp = <110>;
  144. qcom,hotplug-temp-hysteresis = <20>;
  145. qcom,cpu-sensors = "tsens_tz_sensor5", "tsens_tz_sensor6",
  146. "tsens_tz_sensor7", "tsens_tz_sensor8";
  147. qcom,freq-mitigation-temp = <110>;
  148. qcom,freq-mitigation-temp-hysteresis = <20>;
  149. qcom,freq-mitigation-value = <960000>;
  150. qcom,freq-mitigation-control-mask = <0x01>;
  151. qcom,pmic-sw-mode-temp = <90>;
  152. qcom,pmic-sw-mode-temp-hysteresis = <80>;
  153. qcom,pmic-sw-mode-regs = "vdd-dig";
  154. qcom,vdd-restriction-temp = <5>;
  155. qcom,vdd-restriction-temp-hysteresis = <10>;
  156. qti,pmic-opt-curr-temp = <85>;
  157. qti,pmic-opt-curr-temp-hysteresis = <10>;
  158. qti,pmic-opt-curr-regs = "vdd-dig";
  159. vdd-dig-supply=<&pm8841_s2_floor_corner>
  160. qcom,default-temp = <80>;
  161. qcom,efuse-data = <0xfc4b8000 0x1000 23 30 0x3>;
  162. qcom,efuse-temperature-map = <0x0 80>, <0x1 70>, <0x2 80>, <0x3 80>;
  163. qcom,vdd-dig-rstr{
  164. qcom,vdd-rstr-reg = "vdd-dig";
  165. qcom,levels = <5 7 7>; /* Nominal, Super Turbo, Super Turbo */
  166. qcom,min-level = <1>; /* No Request */
  167. };
  168. qcom,vdd-apps-rstr{
  169. qcom,vdd-rstr-reg = "vdd-apps";
  170. qcom,levels = <1881600 1958400 2265600>;
  171. qcom,freq-req;
  172. };
  173. };