Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 695728bb authored by Ram Chandrasekar's avatar Ram Chandrasekar Committed by Gerrit - the friendly Code Review server
Browse files

msm: thermal: Limit the emergency mitigation messages



Thermal can set tsens threshold even if the threshold
value is equal to the current temperature. This will
trigger a tsens notification immediately, which will
print a kernel message. If the temperature stays in
the current value then the emergency mitigation
messages will flood the kernel logs.

Use rate limit feature in printk to reduce the amount
of messages printed from thermal.

CRs-Fixed: 803110
Change-Id: I8fa62ac73421a80658e3696577c0086a27c1102a
Signed-off-by: default avatarRam Chandrasekar <rkumbako@codeaurora.org>
parent b0f900ce
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -2967,7 +2967,8 @@ static int hotplug_notify(enum thermal_trip_type type, int temp, void *data)
{
	struct cpu_info *cpu_node = (struct cpu_info *)data;

	pr_info("%s reach temp threshold: %d\n", cpu_node->sensor_type, temp);
	pr_info_ratelimited("%s reach temp threshold: %d\n",
			       cpu_node->sensor_type, temp);

	if (!(msm_thermal_info.core_control_mask & BIT(cpu_node->cpu)))
		return 0;
@@ -3176,16 +3177,17 @@ static int freq_mitigation_notify(enum thermal_trip_type type,
	switch (type) {
	case THERMAL_TRIP_CONFIGURABLE_HI:
		if (!cpu_node->max_freq) {
			pr_info("Mitigating CPU%d frequency to %d\n",
				cpu_node->cpu,
				msm_thermal_info.freq_limit);
			pr_info_ratelimited(
				"Mitigating CPU%d frequency to %d\n",
				cpu_node->cpu, msm_thermal_info.freq_limit);

			cpu_node->max_freq = true;
		}
		break;
	case THERMAL_TRIP_CONFIGURABLE_LOW:
		if (cpu_node->max_freq) {
			pr_info("Removing frequency mitigation for CPU%d\n",
			pr_info_ratelimited(
				"Removing frequency mitigation for CPU%d\n",
				cpu_node->cpu);

			cpu_node->max_freq = false;