Merge "msm-core: debug: Update the number of supported pstates"

This commit is contained in:
Linux Build Service Account 2016-09-09 11:53:14 -07:00 committed by Gerrit - the friendly Code Review server
commit b4d91ec2d2

View file

@ -84,15 +84,28 @@ static struct debugfs_blob_wrapper help_msg = {
}; };
static void add_to_ptable(uint64_t *arg) static void add_to_ptable(unsigned int *arg)
{ {
struct core_debug *node; struct core_debug *node;
int i, cpu = arg[CPU_OFFSET]; int i, cpu = arg[CPU_OFFSET];
uint32_t freq = arg[FREQ_OFFSET];
uint32_t power = arg[POWER_OFFSET];
if (!cpu_possible(cpu)) if (!cpu_possible(cpu))
return; return;
if ((freq == 0) || (power == 0)) {
pr_warn("Incorrect power data\n");
return;
}
node = &per_cpu(c_dgfs, cpu); node = &per_cpu(c_dgfs, cpu);
if (node->len >= MAX_PSTATES) {
pr_warn("Dropped ptable update - no space left.\n");
return;
}
if (!node->head) { if (!node->head) {
node->head = kzalloc(sizeof(struct cpu_pstate_pwr) * node->head = kzalloc(sizeof(struct cpu_pstate_pwr) *
(MAX_PSTATES + 1), (MAX_PSTATES + 1),
@ -100,24 +113,18 @@ static void add_to_ptable(uint64_t *arg)
if (!node->head) if (!node->head)
return; return;
} }
for (i = 0; i < MAX_PSTATES; i++) {
if (node->head[i].freq == arg[FREQ_OFFSET]) { for (i = 0; i < node->len; i++) {
node->head[i].power = arg[POWER_OFFSET]; if (node->head[i].freq == freq) {
node->head[i].power = power;
return; return;
} }
if (node->head[i].freq == 0)
break;
}
if (i == MAX_PSTATES) {
pr_warn("Dropped ptable update - no space left.\n");
return;
} }
/* Insert a new frequency (may need to move things around to /* Insert a new frequency (may need to move things around to
keep in ascending order). */ keep in ascending order). */
for (i = MAX_PSTATES - 1; i > 0; i--) { for (i = MAX_PSTATES - 1; i > 0; i--) {
if (node->head[i-1].freq > arg[FREQ_OFFSET]) { if (node->head[i-1].freq > freq) {
node->head[i].freq = node->head[i-1].freq; node->head[i].freq = node->head[i-1].freq;
node->head[i].power = node->head[i-1].power; node->head[i].power = node->head[i-1].power;
} else if (node->head[i-1].freq != 0) { } else if (node->head[i-1].freq != 0) {
@ -125,15 +132,17 @@ static void add_to_ptable(uint64_t *arg)
} }
} }
node->head[i].freq = arg[FREQ_OFFSET]; if (node->len < MAX_PSTATES) {
node->head[i].power = arg[POWER_OFFSET]; node->head[i].freq = freq;
node->len++; node->head[i].power = power;
node->len++;
}
if (node->ptr) if (node->ptr)
node->ptr->len = node->len; node->ptr->len = node->len;
} }
static int split_ptable_args(char *line, uint64_t *arg, uint32_t n) static int split_ptable_args(char *line, unsigned int *arg, uint32_t n)
{ {
char *args; char *args;
int i; int i;
@ -143,7 +152,9 @@ static int split_ptable_args(char *line, uint64_t *arg, uint32_t n)
if (!line) if (!line)
break; break;
args = strsep(&line, " "); args = strsep(&line, " ");
ret = kstrtoull(args, 10, &arg[i]); ret = kstrtouint(args, 10, &arg[i]);
if (ret)
return ret;
} }
return ret; return ret;
} }
@ -153,7 +164,7 @@ static ssize_t msm_core_ptable_write(struct file *file,
{ {
char *kbuf; char *kbuf;
int ret; int ret;
uint64_t arg[3]; unsigned int arg[3];
if (len == 0) if (len == 0)
return 0; return 0;
@ -205,7 +216,7 @@ static int msm_core_ptable_read(struct seq_file *m, void *data)
seq_printf(m, "--- CPU%d - Live numbers at %ldC---\n", seq_printf(m, "--- CPU%d - Live numbers at %ldC---\n",
cpu, node->ptr->temp); cpu, node->ptr->temp);
print_table(m, msm_core_data[cpu].ptable, print_table(m, msm_core_data[cpu].ptable,
msm_core_data[cpu].len); node->driver_len);
} }
} }
return 0; return 0;
@ -216,7 +227,7 @@ static ssize_t msm_core_enable_write(struct file *file,
{ {
char *kbuf; char *kbuf;
int ret; int ret;
uint64_t arg[3]; unsigned int arg[3];
int cpu; int cpu;
if (len == 0) if (len == 0)