summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPer Fransson <per.xx.fransson@stericsson.com>2011-03-15 14:49:05 +0100
committerUlf Hansson <ulf.hansson@stericsson.com>2011-09-19 15:14:59 +0200
commit4f218b1e9d4c46120c704efa395c4b1bcca5655f (patch)
tree8c61440d66a41b4ee10a2c9ed6c0d0b297837a5b
parent616a7c9fe03dc24ba62830c0b4d1c9e28771174a (diff)
ARM: ux500: Add debugfs file to change cpufreq->QoS delay
cat /debugfs/prcmu/opp_cpufreq_delay echo <delay in jiffies> > /debugfs/prcmu/opp_cpufreq_delay ST-Ericsson ID: CR 323730 Change-Id: I5c3b976c63342d49b2d6c198510197757867c70b Signed-off-by: Per Fransson <per.xx.fransson@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/18363 Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com> Reviewed-by: Martin PERSSON <martin.persson@stericsson.com>
-rw-r--r--arch/arm/mach-ux500/prcmu-debug.c50
-rw-r--r--arch/arm/mach-ux500/prcmu-qos-power.c18
2 files changed, 66 insertions, 2 deletions
diff --git a/arch/arm/mach-ux500/prcmu-debug.c b/arch/arm/mach-ux500/prcmu-debug.c
index e39baa3a21f..942740b4a23 100644
--- a/arch/arm/mach-ux500/prcmu-debug.c
+++ b/arch/arm/mach-ux500/prcmu-debug.c
@@ -280,6 +280,37 @@ static int ddr_opp_read(struct seq_file *s, void *p)
"unknown", opp);
}
+static int cpufreq_delay_read(struct seq_file *s, void *p)
+{
+ return seq_printf(s, "%lu\n", prcmu_qos_get_cpufreq_opp_delay());
+}
+
+static ssize_t cpufreq_delay_write(struct file *file,
+ const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+
+ char buf[32];
+ ssize_t buf_size;
+ long unsigned int i;
+
+ /* Get userspace string and assure termination */
+ buf_size = min(count, (sizeof(buf)-1));
+ if (copy_from_user(buf, user_buf, buf_size))
+ return -EFAULT;
+ buf[buf_size] = 0;
+
+ if (strict_strtoul(buf, 0, &i) != 0)
+ return buf_size;
+
+ prcmu_qos_set_cpufreq_opp_delay(i);
+
+ pr_info("prcmu debug: changed delay between cpufreq change and QoS "
+ "requirement to %lu.\n", i);
+
+ return buf_size;
+}
+
static int arm_opp_open_file(struct inode *inode, struct file *file)
{
return single_open(file, arm_opp_read, inode->i_private);
@@ -305,6 +336,11 @@ static int ddr_stats_open_file(struct inode *inode, struct file *file)
return single_open(file, ddr_stats_print, inode->i_private);
}
+static int cpufreq_delay_open_file(struct inode *inode, struct file *file)
+{
+ return single_open(file, cpufreq_delay_read, inode->i_private);
+}
+
static const struct file_operations arm_opp_fops = {
.open = arm_opp_open_file,
.read = seq_read,
@@ -347,6 +383,15 @@ static const struct file_operations ddr_stats_fops = {
.owner = THIS_MODULE,
};
+static const struct file_operations cpufreq_delay_fops = {
+ .open = cpufreq_delay_open_file,
+ .write = cpufreq_delay_write,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+ .owner = THIS_MODULE,
+};
+
static int setup_debugfs(void)
{
struct dentry *dir;
@@ -381,6 +426,11 @@ static int setup_debugfs(void)
if (IS_ERR_OR_NULL(file))
goto fail;
+ file = debugfs_create_file("opp_cpufreq_delay", (S_IRUGO),
+ dir, NULL, &cpufreq_delay_fops);
+ if (IS_ERR_OR_NULL(file))
+ goto fail;
+
return 0;
fail:
if ((file == NULL) && (dir != NULL))
diff --git a/arch/arm/mach-ux500/prcmu-qos-power.c b/arch/arm/mach-ux500/prcmu-qos-power.c
index 1cd19d99975..a1fba3ffc38 100644
--- a/arch/arm/mach-ux500/prcmu-qos-power.c
+++ b/arch/arm/mach-ux500/prcmu-qos-power.c
@@ -92,6 +92,18 @@ static struct prcmu_qos_object *prcmu_qos_array[] = {
static DEFINE_SPINLOCK(prcmu_qos_lock);
+static unsigned long cpufreq_opp_delay = HZ / 5;
+
+unsigned long prcmu_qos_get_cpufreq_opp_delay()
+{
+ return cpufreq_opp_delay;
+}
+
+void prcmu_qos_set_cpufreq_opp_delay(unsigned long n)
+{
+ cpufreq_opp_delay = n;
+}
+
/* static helper function */
static s32 max_compare(s32 v1, s32 v2)
{
@@ -470,7 +482,8 @@ static int qos_delayed_cpufreq_notifier(struct notifier_block *nb,
* one.
*/
if (new_ddr_target != cpufreq_requirement_set)
- schedule_delayed_work(&qos_delayed_work_up, HZ/5);
+ schedule_delayed_work(&qos_delayed_work_up,
+ cpufreq_opp_delay);
} else {
cancel_delayed_work_sync(&qos_delayed_work_up);
/*
@@ -478,7 +491,8 @@ static int qos_delayed_cpufreq_notifier(struct notifier_block *nb,
* one.
*/
if (new_ddr_target != cpufreq_requirement_set)
- schedule_delayed_work(&qos_delayed_work_down, HZ/5);
+ schedule_delayed_work(&qos_delayed_work_down,
+ cpufreq_opp_delay);
}
return 0;