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

Commit 63ea252a authored by Mahesh Sivasubramanian's avatar Mahesh Sivasubramanian
Browse files

drivers: cpuidle: lpm-levels: Switch to new hotplug state callbacks



The hotplug framework has moved away from using the notifications for hotplug
events. With the new state based mechanism, the drivers are required to
register for explicit callbacks associated with driver specifics hotplug
states.

Switch to using new hotplug state callbacks.

Change-Id: Ic634a41b336decdbcfe5c4fd22ab2bd25c53b340
Signed-off-by: default avatarMahesh Sivasubramanian <msivasub@codeaurora.org>
parent 741a8ec5
Loading
Loading
Loading
Loading
+20 −19
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
#include <linux/moduleparam.h>
#include <linux/sched.h>
#include <linux/cpu_pm.h>
#include <linux/cpuhotplug.h>
#include <soc/qcom/spm.h>
#include <soc/qcom/pm.h>
#include <soc/qcom/event_timer.h>
@@ -313,25 +314,20 @@ static void update_debug_pc_event(enum debug_event event, uint32_t arg1,
	spin_unlock(&debug_lock);
}

static int lpm_cpu_callback(struct notifier_block *cpu_nb,
	unsigned long action, void *hcpu)
static int lpm_dying_cpu(unsigned int cpu)
{
	unsigned long cpu = (unsigned long) hcpu;
	struct lpm_cluster *cluster = per_cpu(cpu_cluster, (unsigned int) cpu);
	struct lpm_cluster *cluster = per_cpu(cpu_cluster, cpu);

	switch (action & ~CPU_TASKS_FROZEN) {
	case CPU_DYING:
		cluster_prepare(cluster, get_cpu_mask((unsigned int) cpu),
					NR_LPM_LEVELS, false, 0);
		break;
	case CPU_STARTING:
		cluster_unprepare(cluster, get_cpu_mask((unsigned int) cpu),
					NR_LPM_LEVELS, false, 0);
		break;
	default:
		break;
	cluster_prepare(cluster, get_cpu_mask(cpu), NR_LPM_LEVELS, false, 0);
	return 0;
}
	return NOTIFY_OK;

static int lpm_starting_cpu(unsigned int cpu)
{
	struct lpm_cluster *cluster = per_cpu(cpu_cluster, cpu);

	cluster_unprepare(cluster, get_cpu_mask(cpu), NR_LPM_LEVELS, false, 0);
	return 0;
}

static enum hrtimer_restart lpm_hrtimer_cb(struct hrtimer *h)
@@ -1759,7 +1755,12 @@ static int lpm_probe(struct platform_device *pdev)
				__func__);
		goto failed;
	}
	register_hotcpu_notifier(&lpm_cpu_nblk);
	ret = cpuhp_setup_state(CPUHP_AP_QCOM_SLEEP_STARTING,
			"AP_QCOM_SLEEP_STARTING",
			lpm_starting_cpu, lpm_dying_cpu);
	if (ret)
		goto failed;

	module_kobj = kset_find_obj(module_kset, KBUILD_MODNAME);
	if (!module_kobj) {
		pr_err("%s: cannot find kobject for module %s\n",
+1 −0
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ enum cpuhp_state {
	CPUHP_AP_ARM_TWD_STARTING,
	CPUHP_AP_METAG_TIMER_STARTING,
	CPUHP_AP_QCOM_TIMER_STARTING,
	CPUHP_AP_QCOM_SLEEP_STARTING,
	CPUHP_AP_ARMADA_TIMER_STARTING,
	CPUHP_AP_MARCO_TIMER_STARTING,
	CPUHP_AP_MIPS_GIC_TIMER_STARTING,