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

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

msm: thermal: Retry hotplug when exiting from suspend



Update thermal driver to retry hotplug, when
device exits from suspend. This will ensure that
any failure to offline/online the cores during
suspend will be re-applied, when device exits
suspend.

CRs-Fixed: 823919
Change-Id: Ifc25ad61288d88f984b18fe51b9dd5776f650cf5
Signed-off-by: default avatarRam Chandrasekar <rkumbako@codeaurora.org>
parent 9bb9688e
Loading
Loading
Loading
Loading
+28 −6
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@
#include <linux/sched/rt.h>
#include <linux/notifier.h>
#include <linux/reboot.h>
#include <linux/suspend.h>
#include <soc/qcom/msm-core.h>
#include <linux/cpumask.h>

@@ -468,6 +469,25 @@ static int msm_thermal_reboot_callback(
	return NOTIFY_DONE;
}

static int msm_thermal_suspend_callback(
	struct notifier_block *nfb, unsigned long action, void *data)
{
	switch (action) {
	case PM_POST_HIBERNATION:
	case PM_POST_SUSPEND:
		if (hotplug_task)
			complete(&hotplug_notify_complete);
		else
			pr_debug("Hotplug task not initialized\n");
		break;

	default:
		return NOTIFY_DONE;
	}

	return NOTIFY_OK;
}

static struct notifier_block msm_thermal_reboot_notifier = {
	.notifier_call = msm_thermal_reboot_callback,
};
@@ -2439,13 +2459,15 @@ static int __ref update_offline_cores(int val)
				continue;
			trace_thermal_pre_core_online(cpu);
			ret = cpu_up(cpu);
			if (ret && ret == notifier_to_errno(NOTIFY_BAD))
			if (ret && ret == notifier_to_errno(NOTIFY_BAD)) {
				pr_debug("Onlining CPU%d is vetoed\n", cpu);
			else if (ret)
			} else if (ret) {
				cpus_offlined |= BIT(cpu);
				pr_err("Unable to online CPU%d. err:%d\n",
					cpu, ret);
			else
			} else {
				pr_debug("Onlined CPU%d\n", cpu);
			}
			trace_thermal_post_core_online(cpu,
				cpumask_test_cpu(cpu, cpu_online_mask));
		}
@@ -2496,7 +2518,6 @@ static __ref int do_hotplug(void *data)
				mask |= BIT(cpu);
			mutex_unlock(&devices->hotplug_dev->clnt_lock);
		}
		if (mask != cpus_offlined)
		update_offline_cores(mask);
		mutex_unlock(&core_control_mutex);

@@ -4521,6 +4542,7 @@ int msm_thermal_init(struct msm_thermal_data *pdata)
		pr_err("cannot register cpufreq notifier. err:%d\n", ret);

	register_reboot_notifier(&msm_thermal_reboot_notifier);
	pm_notifier(msm_thermal_suspend_callback, 0);
	INIT_DELAYED_WORK(&check_temp_work, check_temp);
	schedule_delayed_work(&check_temp_work, 0);