Skip to content

Commit

Permalink
intelli_plug: remove powersuspend related bits
Browse files Browse the repository at this point in the history
  • Loading branch information
sultanqasim committed Apr 7, 2016
1 parent 05dc5f8 commit bcc3104
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 230 deletions.
221 changes: 1 addition & 220 deletions arch/arm/hotplug/intelli_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@
#include <linux/input.h>
#include <linux/cpufreq.h>

#ifdef CONFIG_POWERSUSPEND
#include <linux/powersuspend.h>
#endif

#ifdef CONFIG_HAS_EARLYSUSPEND
#include <linux/earlysuspend.h>
#endif

//#define DEBUG_INTELLI_PLUG
#undef DEBUG_INTELLI_PLUG

Expand Down Expand Up @@ -340,187 +332,6 @@ static void __ref intelli_plug_work_fn(struct work_struct *work)
}
}

#if defined(CONFIG_POWERSUSPEND) || defined(CONFIG_HAS_EARLYSUSPEND)
static void screen_off_limit(bool on)
{
unsigned int cpu;
struct cpufreq_policy *policy;
struct ip_cpu_info *l_ip_info;

/* not active, so exit */
if (screen_off_max == UINT_MAX)
return;

for_each_online_cpu(cpu) {
l_ip_info = &per_cpu(ip_info, cpu);
policy = cpufreq_cpu_get(0);

if (on) {
/* save current instance */
l_ip_info->cur_max = policy->max;
policy->max = screen_off_max;
policy->cpuinfo.max_freq = screen_off_max;
#ifdef DEBUG_INTELLI_PLUG
pr_info("cpuinfo max is (on): %u %u\n",
policy->cpuinfo.max_freq, l_ip_info->sys_max);
#endif
} else {
/* restore */
if (cpu != 0) {
l_ip_info = &per_cpu(ip_info, 0);
}
policy->cpuinfo.max_freq = l_ip_info->sys_max;
policy->max = l_ip_info->cur_max;
#ifdef DEBUG_INTELLI_PLUG
pr_info("cpuinfo max is (off): %u %u\n",
policy->cpuinfo.max_freq, l_ip_info->sys_max);
#endif
}
cpufreq_update_policy(cpu);
}
}

void __ref intelli_plug_perf_boost(bool on)
{
unsigned int cpu;

if (intelli_plug_active) {
flush_workqueue(intelliplug_wq);
if (on) {
for_each_possible_cpu(cpu) {
if (!cpu_online(cpu))
cpu_up(cpu);
}
} else {
queue_delayed_work_on(0, intelliplug_wq,
&intelli_plug_work,
msecs_to_jiffies(sampling_time));
}
}
}

/* sysfs interface for performance boost (BEGIN) */
static ssize_t intelli_plug_perf_boost_store(struct kobject *kobj,
struct kobj_attribute *attr, const char *buf,
size_t count)
{

int boost_req;

sscanf(buf, "%du", &boost_req);

switch(boost_req) {
case 0:
intelli_plug_perf_boost(0);
return count;
case 1:
intelli_plug_perf_boost(1);
return count;
default:
return -EINVAL;
}
}

static struct kobj_attribute intelli_plug_perf_boost_attribute =
__ATTR(perf_boost, 0220,
NULL,
intelli_plug_perf_boost_store);

static struct attribute *intelli_plug_perf_boost_attrs[] = {
&intelli_plug_perf_boost_attribute.attr,
NULL,
};

static struct attribute_group intelli_plug_perf_boost_attr_group = {
.attrs = intelli_plug_perf_boost_attrs,
};

static struct kobject *intelli_plug_perf_boost_kobj;
/* sysfs interface for performance boost (END) */

#ifdef CONFIG_POWERSUSPEND
static void intelli_plug_suspend(struct power_suspend *handler)
#else
static void intelli_plug_suspend(struct early_suspend *handler)
#endif
{
if (intelli_plug_active) {
int cpu;

flush_workqueue(intelliplug_wq);

mutex_lock(&intelli_plug_mutex);
suspended = true;
screen_off_limit(true);
mutex_unlock(&intelli_plug_mutex);

// put rest of the cores to sleep unconditionally!
for_each_online_cpu(cpu) {
if (cpu != 0)
cpu_down(cpu);
}
}
}

static void wakeup_boost(void)
{
unsigned int cpu;
struct cpufreq_policy *policy;
struct ip_cpu_info *l_ip_info;

for_each_online_cpu(cpu) {
policy = cpufreq_cpu_get(0);
l_ip_info = &per_cpu(ip_info, 0);
policy->cur = l_ip_info->cur_max;
cpufreq_update_policy(cpu);
}
}

#ifdef CONFIG_POWERSUSPEND
static void __ref intelli_plug_resume(struct power_suspend *handler)
#else
static void __ref intelli_plug_resume(struct early_suspend *handler)
#endif
{

if (intelli_plug_active) {
int cpu;

mutex_lock(&intelli_plug_mutex);
/* keep cores awake long enough for faster wake up */
persist_count = BUSY_PERSISTENCE;
suspended = false;
mutex_unlock(&intelli_plug_mutex);

for_each_possible_cpu(cpu) {
if (cpu == 0)
continue;
cpu_up(cpu);
}

wakeup_boost();
screen_off_limit(false);
}
queue_delayed_work_on(0, intelliplug_wq, &intelli_plug_work,
msecs_to_jiffies(10));
}
#endif

#ifdef CONFIG_POWERSUSPEND
static struct power_suspend intelli_plug_power_suspend_driver = {
.suspend = intelli_plug_suspend,
.resume = intelli_plug_resume,
};
#endif /* CONFIG_POWERSUSPEND */

#ifdef CONFIG_HAS_EARLYSUSPEND
static struct early_suspend intelli_plug_early_suspend_driver = {
.level = EARLY_SUSPEND_LEVEL_DISABLE_FB + 10,
.suspend = intelli_plug_suspend,
.resume = intelli_plug_resume,
};
#endif /* CONFIG_HAS_EARLYSUSPEND */

static void intelli_plug_input_event(struct input_handle *handle,
unsigned int type, unsigned int code, int value)
{
Expand Down Expand Up @@ -647,11 +458,6 @@ module_param_cb(intelli_plug_active, &param_ops_active,
int __init intelli_plug_init(void)
{
int rc;
#if defined (CONFIG_POWERSUSPEND) || defined(CONFIG_HAS_EARLYSUSPEND)
struct cpufreq_policy *policy;
struct ip_cpu_info *l_ip_info;
#endif

nr_possible_cores = num_possible_cpus();

pr_info("intelli_plug: version %d.%d by faux123\n",
Expand All @@ -666,20 +472,8 @@ int __init intelli_plug_init(void)
nr_run_profile_sel = NR_RUN_ECO_MODE_PROFILE;
}

#if defined (CONFIG_POWERSUSPEND) || defined(CONFIG_HAS_EARLYSUSPEND)
l_ip_info = &per_cpu(ip_info, 0);
policy = cpufreq_cpu_get(0);
l_ip_info->sys_max = policy->cpuinfo.max_freq;
l_ip_info->cur_max = policy->max;
#endif

rc = input_register_handler(&intelli_plug_input_handler);
#ifdef CONFIG_POWERSUSPEND
register_power_suspend(&intelli_plug_power_suspend_driver);
#endif
#ifdef CONFIG_HAS_EARLYSUSPEND
register_early_suspend(&intelli_plug_early_suspend_driver);
#endif

intelliplug_wq = alloc_workqueue("intelliplug",
WQ_HIGHPRI | WQ_UNBOUND, 1);
intelliplug_boost_wq = alloc_workqueue("iplug_boost",
Expand All @@ -689,19 +483,6 @@ int __init intelli_plug_init(void)
queue_delayed_work_on(0, intelliplug_wq, &intelli_plug_work,
msecs_to_jiffies(10));

intelli_plug_perf_boost_kobj
= kobject_create_and_add("intelli_plug", kernel_kobj);

if (!intelli_plug_perf_boost_kobj) {
return -ENOMEM;
}

rc = sysfs_create_group(intelli_plug_perf_boost_kobj,
&intelli_plug_perf_boost_attr_group);

if (rc)
kobject_put(intelli_plug_perf_boost_kobj);

return 0;
}

Expand Down
10 changes: 0 additions & 10 deletions drivers/md/dm-crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1010,10 +1010,6 @@ static void kcryptd_io_write(struct dm_crypt_io *io)
generic_make_request(clone);
}

#ifdef CONFIG_INTELLI_PLUG
extern void intelli_plug_perf_boost(bool);
#endif

static int dmcrypt_write(void *data)
{
struct crypt_config *cc = data;
Expand Down Expand Up @@ -1066,9 +1062,6 @@ static int dmcrypt_write(void *data)
kcryptd_io_write(io);
} while (!RB_EMPTY_ROOT(&write_tree));
blk_finish_plug(&plug);
#ifdef CONFIG_INTELLI_PLUG
intelli_plug_perf_boost(false);
#endif
}
return 0;
}
Expand Down Expand Up @@ -1685,9 +1678,6 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
ti->error = "Couldn't spawn write thread";
goto bad;
}
#ifdef CONFIG_INTELLI_PLUG
intelli_plug_perf_boost(true);
#endif
wake_up_process(cc->write_thread);

ti->num_flush_bios = 1;
Expand Down

0 comments on commit bcc3104

Please sign in to comment.