static int exynos_dm_hotplug_notifier(struct notifier_block *notifier, unsigned long pm_event, void *v) { switch (pm_event) { case PM_SUSPEND_PREPARE: in_suspend_prepared = true; if (dynamic_hotplug(CMD_LOW_POWER)) prev_cmd = CMD_LOW_POWER; exynos_dm_hotplug_disable(); kthread_stop(dm_hotplug_task); break; case PM_POST_SUSPEND: in_suspend_prepared = false; exynos_dm_hotplug_enable(); dm_hotplug_task = kthread_create(on_run, NULL, "thread_hotplug"); if (IS_ERR(dm_hotplug_task)) { pr_err("Failed in creation of thread.\n"); return -EINVAL; } wake_up_process(dm_hotplug_task); break; } return NOTIFY_OK; }
static int __ref exynos_dm_hotplug_notifier(struct notifier_block *notifier, unsigned long pm_event, void *v) { int i, j; switch (pm_event) { case PM_SUSPEND_PREPARE: mutex_lock(&thread_lock); in_suspend_prepared = true; if (!dynamic_hotplug(CMD_NORMAL)) prev_cmd = CMD_NORMAL; exynos_dm_hotplug_disable(); if (dm_hotplug_task) { kthread_stop(dm_hotplug_task); dm_hotplug_task = NULL; } for (i = 4; i < 11; i++) { j = i; if (j >= 8) j = 11 - j; if (!cpu_online(j)) { cpu_up(j); } } mutex_unlock(&thread_lock); break; case PM_POST_SUSPEND: mutex_lock(&thread_lock); exynos_dm_hotplug_enable(); dm_hotplug_task = kthread_create(on_run, NULL, "thread_hotplug"); if (IS_ERR(dm_hotplug_task)) { mutex_unlock(&thread_lock); pr_err("Failed in creation of thread.\n"); return -EINVAL; } in_suspend_prepared = false; wake_up_process(dm_hotplug_task); mutex_unlock(&thread_lock); break; } return NOTIFY_OK; }
static int exynos_dm_hotplug_notifier(struct notifier_block *notifier, unsigned long pm_event, void *v) { switch (pm_event) { case PM_SUSPEND_PREPARE: mutex_lock(&thread_lock); in_suspend_prepared = true; if(nr_sleep_prepare_cpus > 1) { pr_info("%s, %d : dynamic_hotplug CMD_SLEEP_PREPARE\n", __func__, __LINE__); if (!dynamic_hotplug(CMD_SLEEP_PREPARE)) prev_cmd = CMD_LOW_POWER; } else { if (!dynamic_hotplug(CMD_LOW_POWER)) prev_cmd = CMD_LOW_POWER; } exynos_dm_hotplug_disable(); if (dm_hotplug_task) { kthread_stop(dm_hotplug_task); dm_hotplug_task = NULL; } mutex_unlock(&thread_lock); break; case PM_POST_SUSPEND: mutex_lock(&thread_lock); exynos_dm_hotplug_enable(); dm_hotplug_task = kthread_create(on_run, NULL, "thread_hotplug"); if (IS_ERR(dm_hotplug_task)) { mutex_unlock(&thread_lock); pr_err("Failed in creation of thread.\n"); return -EINVAL; } in_suspend_prepared = false; wake_up_process(dm_hotplug_task); mutex_unlock(&thread_lock); break; } return NOTIFY_OK; }
static ssize_t store_enable_dm_hotplug(struct kobject *kobj, struct attribute *attr, const char *buf, size_t count) { int enable_input; if (!sscanf(buf, "%1d", &enable_input)) return -EINVAL; if (enable_input > 1 || enable_input < 0) { pr_err("%s: invalid value (%d)\n", __func__, enable_input); return -EINVAL; } if (enable_input) { do_enable_hotplug = true; if (exynos_dm_hotplug_disabled()) exynos_dm_hotplug_enable(); else pr_info("%s: dynamic hotplug already enabled\n", __func__); #if defined(CONFIG_SCHED_HMP) if (cluster1_hotplugged) { if (dynamic_hotplug(CMD_CLUST1_OUT)) { pr_err("%s: Cluster1 core hotplug_out is failed\n", __func__); do_enable_hotplug = false; return -EINVAL; } } #endif do_enable_hotplug = false; } else { do_disable_hotplug = true; if (!dynamic_hotplug(CMD_NORMAL)) prev_cmd = CMD_NORMAL; if (!exynos_dm_hotplug_disabled()) exynos_dm_hotplug_disable(); else pr_info("%s: dynamic hotplug already disabled\n", __func__); do_disable_hotplug = false; } return count; }
void argos_dm_hotplug_disable(void) { if (!dynamic_hotplug(CMD_NORMAL)) prev_cmd = CMD_NORMAL; exynos_dm_hotplug_disable(); }