diff options
author | Martin Persson <martin.persson@stericsson.com> | 2011-05-25 13:29:38 +0200 |
---|---|---|
committer | said m bagheri <ebgheri@steludxu2848.(none)> | 2011-06-17 13:42:06 +0200 |
commit | 10c98bb47756c7630a92d549c1387a53ec254ef5 (patch) | |
tree | 85aad339eee38a2adbaf2aa06bfa48cff1a3dbdf /arch | |
parent | 42fe960648f17ec88643fe0733bccd48665e614d (diff) |
ux500: prcmu: add debugfs for APE voltage
Request APE OPP 100% voltage
echo 1 > /debugfs/prcmu/ape_voltage
Remove request
echo 0 > /debugfs/prcmu/ape_voltage
ST-Ericsson Linux next: Not tested, ask SSM for ER
ST-Ericsson ID: -
ST-Ericsson FOSS-OUT ID: Trivial
Change-Id: I749568477e65d98f1314422652d23c721e6f6c4a
Signed-off-by: Martin Persson <martin.persson@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/23884
Reviewed-by: QATEST
Reviewed-by: Mattias NILSSON <mattias.i.nilsson@stericsson.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-ux500/prcmu-debug.c | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/arch/arm/mach-ux500/prcmu-debug.c b/arch/arm/mach-ux500/prcmu-debug.c index e41a93ccb84..8c2607b928f 100644 --- a/arch/arm/mach-ux500/prcmu-debug.c +++ b/arch/arm/mach-ux500/prcmu-debug.c @@ -49,6 +49,7 @@ struct ddr_state_history { static struct ape_state_history *ape_sh; static struct ddr_state_history *ddr_sh; +static int ape_voltage_count; void prcmu_debug_ape_opp_log(u8 opp) { @@ -323,6 +324,57 @@ static int cpufreq_delay_read(struct seq_file *s, void *p) return seq_printf(s, "%lu\n", prcmu_qos_get_cpufreq_opp_delay()); } +static int ape_voltage_read(struct seq_file *s, void *p) +{ + return seq_printf(s, "This reference count only includes " + "requests via debugfs.\nCount: %d\n", + ape_voltage_count); +} + +static ssize_t ape_voltage_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; + int err; + + /* 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; + + switch (i) { + case 0: + if (ape_voltage_count == 0) + pr_info("prcmu debug: reference count is already 0\n"); + else { + err = prcmu_request_ape_opp_100_voltage(false); + if (err) + pr_err("prcmu debug: drop request failed\n"); + else + ape_voltage_count--; + } + break; + case 1: + err = prcmu_request_ape_opp_100_voltage(true); + if (err) + pr_err("prcmu debug: request failed\n"); + else + ape_voltage_count++; + break; + default: + pr_info("prcmu debug: value not equal to 0 or 1\n"); + } + return buf_size; +} + static ssize_t cpufreq_delay_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) @@ -379,6 +431,11 @@ static int cpufreq_delay_open_file(struct inode *inode, struct file *file) return single_open(file, cpufreq_delay_read, inode->i_private); } +static int ape_voltage_open_file(struct inode *inode, struct file *file) +{ + return single_open(file, ape_voltage_read, inode->i_private); +} + static const struct file_operations arm_opp_fops = { .open = arm_opp_open_file, .read = seq_read, @@ -432,6 +489,15 @@ static const struct file_operations cpufreq_delay_fops = { .owner = THIS_MODULE, }; +static const struct file_operations ape_voltage_fops = { + .open = ape_voltage_open_file, + .write = ape_voltage_write, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, + .owner = THIS_MODULE, +}; + static int setup_debugfs(void) { struct dentry *dir; @@ -471,6 +537,11 @@ static int setup_debugfs(void) if (IS_ERR_OR_NULL(file)) goto fail; + file = debugfs_create_file("ape_voltage", (S_IRUGO), + dir, NULL, &ape_voltage_fops); + if (IS_ERR_OR_NULL(file)) + goto fail; + return 0; fail: if ((file == NULL) && (dir != NULL)) |