MSM thermal driver (MSM_THERMAL) MSM_THERMAL is a kernel platform driver which regulates thermal conditions on the device during kernel boot. The goal of MSM_THERMAL is to prevent the temperature of the system from exceeding a thermal limit at which it cannot operate. Examples are CPU junction thermal limit, or POP memory thermal limit. The MSM_THERMAL driver polls the TSENS sensor hardware during boot, and reduces the maximum CPU frequency allowed in steps, to limit power/thermal output when a threshold temperature is crossed. It restores the maximum CPU frequency allowed in the same stepwise fashion when the threshold temperature (with hysteresis gap) is cleared. The devicetree representation of the MSM_THERMAL block should be: Required properties - compatible: "qcom,msm-thermal" - qcom,sensor-id: The id of the TSENS sensor polled for temperature. Typically the sensor closest to CPU0. - qcom,poll-ms: Sampling interval to read sensor, in ms. - qcom,limit-temp: Threshold temperature to start stepping CPU down, in degC. - qcom,temp-hysteresis: Degrees C below threshold temperature to step CPU up. - qcom,freq-step: Number of frequency steps to take on each CPU mitigation. Optional properties - qcom,freq-control-mask: The cpu mask that will be used to determine if a core can be used for freq control. - qcom,core-limit-temp: Threshold temperature to start shutting down cores in degC - qcom,core-temp-hysterisis: Degrees C below which the cores will be brought online in sequence. - qcom,core-control-mask: The cpu mask that will be used to determine if a core can be controlled or not. A mask of 0 indicates the feature is disabled. - qcom,vdd-restriction-temp: When temperature is below this threshold, will enable vdd restriction which will set higher voltage on key voltage rails, in degC. - qcom,vdd-restriction-temp-hysteresis: When temperature is above this threshold will disable vdd restriction on key rails, in degC. - qcom,pmic-sw-mode-temp: Threshold temperature to disable auto mode on the rail, in degC. If this property exists, qcom,pmic-sw-mode-temp-hysteresis and qcom,pmic-sw-mode-regs need to exist, otherwise return error. - qcom,pmic-sw-mode-temp-hysteresis: Degree below threshold temperature to enable auto mode on the rail, in degC. If this property exists, qcom,pmic-sw-mode-temp and qcom,pmic-sw-mode-regs need to exist, otherwise return error. - qcom,pmic-sw-mode-regs: Array of the regulator names that will want to disable/enable automode based on the threshold. If this property exists, qcom,pmic-sw-mode-temp and qcom,pmic-sw-mode-temp-hysteresis need to exist, otherwise return error. Also, if this property is defined, will have to define -supply = <&phandle_of_regulator> - -supply = <&phandle_of_regulator>: consumer_supply_name is the name that's defined in thermal driver. phandle_of_regulator is defined by reuglator device tree. Optional child nodes - qcom,: Define the name of the child node. If this property exisits, qcom,vdd-rstr-reg, qcom,levels need to exist. qcom,min-level is optional if qcom,freq-req exists, otherwise it's required. - qcom,vdd-rstr-reg: Name of the rail - qcom,levels: Array of the level values. Unit is corner voltage for voltage request or kHz for frequency request. - qcom,min-level: Request this level as minimum level when disabling voltage restriction. Unit is corner voltage for voltage request. This will not be required if qcom,freq-req exists. - qcom,freq-req: Flag to determine if we should restrict frequency on this rail instead of voltage. Example: qcom,msm-thermal { compatible = "qcom,msm-thermal"; qcom,sensor-id = <0>; qcom,poll-ms = <250>; qcom,limit-temp = <60>; qcom,temp-hysteresis = <10>; qcom,freq-step = <2>; qcom,freq-control-mask = <0xf> qcom,core-limit-temp = <90>; qcom,core-temp-hysterisis = <10>; qcom,core-control-mask = <7>; qcom,pmic-sw-mode-temp = <90>; qcom,pmic-sw-mode-temp-hysteresis = <80>; qcom,pmic-sw-mode-regs = "vdd_dig"; qcom,vdd-restriction-temp = <5>; qcom,vdd-restriction-temp-hysteresis = <10>; vdd_dig-supply=<&pm8841_s2_floor_corner> qcom,vdd-dig-rstr{ qcom,vdd-rstr-reg = "vdd_dig"; qcom,levels = <5 7 7>; /* Nominal, Super Turbo, Super Turbo */ qcom,min-level = <1>; /* No Request */ }; qcom,vdd-apps-rstr{ qcom,vdd-rstr-reg = "vdd_apps"; qcom,levels = <1881600 1958400 2265600>; qcom,freq-req; }; };