--- a/arch/arm/mach-msm/Kconfig
+++ b/arch/arm/mach-msm/Kconfig
@@ -1549,6 +1549,22 @@ config MSM_MPDEC_IDLE_FREQ
default 384000
depends on MSM_MPDEC
+config MSM_MPDEC
+ bool "Enable kernel based mpdecision"
+ depends on MSM_SMP
+ default n
+ help
+ This enables kernel based multi core control.
+ (up/down hotplug based on load)
+
+config MSM_MPDEC
+ bool "Enable kernel based mpdecision"
+ depends on MSM_SMP
+ default n
+ help
+ This enables kernel based multi core control.
+ (up/down hotplug based on load)
+
if CPU_FREQ_MSM
config MSM_CPU_FREQ_SET_MIN_MAX
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -7,6 +7,7 @@ endif
obj-y += clock.o clock-voter.o clock-dummy.o
obj-y += modem_notifier.o subsystem_map.o
obj-$(CONFIG_CPU_FREQ_MSM) += cpufreq.o
+obj-$(CONFIG_MSM_MPDEC) += msm_mpdecision.o
obj-$(CONFIG_DEBUG_FS) += nohlt.o clock-debug.o
obj-$(CONFIG_KEXEC) += msm_kexec.o
--- a/arch/arm/mach-msm/msm_mpdecision.c
+++ b/arch/arm/mach-msm/msm_mpdecision.c
@@ -1,3 +1,26 @@
+/*
+ * arch/arm/mach-msm/msm_mpdecision.c
+ *
+ * cpu auto-hotplug/unplug based on system load for MSM dualcore cpus
+ * single core while screen is off
+ *
+ * Copyright (c) 2011, Chad Goodman <chad.goodman@gmail.com> - All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
#include <linux/earlysuspend.h>
#include <linux/init.h>
#include <linux/cpufreq.h>
@@ -10,9 +33,12 @@
#include <linux/delay.h>
#include "acpuclock.h"
-#include <mach/board_htc.h>
#define MPDEC_TAG "[AnthraX-MPD]: "
+#define MSM_MPDEC_STARTDELAY 70000
+#define MSM_MPDEC_DELAY 500
+#define MSM_MPDEC_PAUSE 10000
+#define MSM_MPDEC_IDLE_FREQ 486000
enum {
MSM_MPDEC_DISABLED = 0,
@@ -39,18 +65,17 @@ static struct msm_mpdec_tuners {
bool scroff_single_core;
unsigned long int idle_freq;
} msm_mpdec_tuners_ins = {
- .startdelay = CONFIG_MSM_MPDEC_STARTDELAY,
- .delay = CONFIG_MSM_MPDEC_DELAY,
- .pause = CONFIG_MSM_MPDEC_PAUSE,
+ .startdelay = MSM_MPDEC_STARTDELAY,
+ .delay = MSM_MPDEC_DELAY,
+ .pause = MSM_MPDEC_PAUSE,
.scroff_single_core = true,
- .idle_freq = CONFIG_MSM_MPDEC_IDLE_FREQ,
+ .idle_freq = MSM_MPDEC_IDLE_FREQ,
};
static unsigned int NwNs_Threshold[4] = {35, 0, 0, 5};
static unsigned int TwTs_Threshold[4] = {250, 0, 0, 250};
extern unsigned int get_rq_info(void);
-extern unsigned long acpuclk_get_rate(int);
unsigned int state = MSM_MPDEC_IDLE;
bool was_paused = false;
@@ -89,10 +114,10 @@ static int mp_decision(void)
if ((nr_cpu_online < 2) && (rq_depth >= NwNs_Threshold[index])) {
if (total_time >= TwTs_Threshold[index]) {
new_state = MSM_MPDEC_UP;
- if (acpuclk_get_rate((CONFIG_NR_CPUS - 2)) <=
+ if (acpuclk_get_rate((CONFIG_NR_CPUS - 2)) <=
msm_mpdec_tuners_ins.idle_freq)
new_state = MSM_MPDEC_IDLE;
- }
+ }
} else if (rq_depth <= NwNs_Threshold[index+1]) {
if (total_time >= TwTs_Threshold[index+1] ) {
new_state = MSM_MPDEC_DOWN;
@@ -129,7 +154,6 @@ static void msm_mpdec_work_thread(struct
if (!mutex_trylock(&msm_cpu_lock))
goto out;
- /* if sth messed with the cpus, update the check vars so we can proceed */
if (was_paused) {
for_each_possible_cpu(cpu) {
if (cpu_online(cpu))
@@ -214,9 +238,7 @@ static void msm_mpdec_late_resume(struct
for_each_possible_cpu(cpu) {
mutex_lock(&per_cpu(msm_mpdec_cpudata, cpu).suspend_mutex);
if ((cpu >= (CONFIG_NR_CPUS - 1)) && (num_online_cpus() < CONFIG_NR_CPUS)) {
- /* Always enable cpus when screen comes online.
- * This boosts the wakeup process.
- */
+ /* Enable cpus when screen comes online. */
cpu_up(cpu);
per_cpu(msm_mpdec_cpudata, cpu).on_time = ktime_to_ms(ktime_get());
per_cpu(msm_mpdec_cpudata, cpu).online = true;
@@ -248,9 +270,8 @@ show_one(startdelay, startdelay);
show_one(delay, delay);
show_one(pause, pause);
show_one(scroff_single_core, scroff_single_core);
-
static ssize_t show_idle_freq (struct kobject *kobj, struct attribute *attr,
- char *buf)
+ char *buf)
{
return sprintf(buf, "%lu\n", msm_mpdec_tuners_ins.idle_freq);
}
@@ -341,14 +362,14 @@ static ssize_t store_pause(struct kobjec
}
static ssize_t store_idle_freq(struct kobject *a, struct attribute *b,
- const char *buf, size_t count)
+ const char *buf, size_t count)
{
long unsigned int input;
int ret;
ret = sscanf(buf, "%lu", &input);
if (ret != 1)
return -EINVAL;
- msm_mpdec_tuners_ins.idle_freq = acpu_check_khz_value(input);
+ msm_mpdec_tuners_ins.idle_freq = input;
return count;
}
@@ -546,6 +567,6 @@ static int __init msm_mpdec(void)
late_initcall(msm_mpdec);
-MODULE_DESCRIPTION("Kernel based MPDECISION (C) 2011 Chad Goodman");
+MODULE_DESCRIPTION("Kernel based MPDECISION");
--- a/arch/arm/mach-msm/msm_rq_stats.c
+++ b/arch/arm/mach-msm/msm_rq_stats.c
@@ -37,6 +37,24 @@
#define DEFAULT_RQ_POLL_JIFFIES 1
#define DEFAULT_DEF_TIMER_JIFFIES 5
+#ifdef CONFIG_MSM_MPDEC
+unsigned int get_rq_info(void)
+{
+ unsigned long flags = 0;
+ unsigned int rq = 0;
+
+ spin_lock_irqsave(&rq_lock, flags);
+
+ rq = rq_info.rq_avg;
+ rq_info.rq_avg = 0;
+
+ spin_unlock_irqrestore(&rq_lock, flags);
+
+ return rq;
+}
+EXPORT_SYMBOL(get_rq_info);
+#endif
+
static void def_work_fn(struct work_struct *work)
{
int64_t diff;
--- /dev/null
+++ b/include/linux/anthrax.h
@@ -0,0 +1,21 @@
+/* include/linux/trinity.h
+ *
+ * Copyright (c) 2012 Chad Goodman <chad.goodman@gmail.com>
+ *
+ * AnThRaX aggregated includes
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __LINUX_ANTHRAX_H
+#define __LINUX_ANTHRAX_H
+
+#define ANTHRAX_BOOT_FREQ 1836000
+static int user_policy_max_freq = ANTHRAX_BOOT_FREQ;
+
+
+
+#endif /* __LINUX_ANTHRAX_H */
+