Skip to content

Commit

Permalink
msm8996: Overclocking with cmdline option
Browse files Browse the repository at this point in the history
  • Loading branch information
flar2 committed Mar 7, 2018
1 parent 5acc638 commit cb67550
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 8 deletions.
23 changes: 15 additions & 8 deletions arch/arm/boot/dts/qcom/msm8996-v3.dtsi
Expand Up @@ -482,7 +482,8 @@
< 1324800000 13 >,
< 1401600000 14 >,
< 1478400000 15 >,
< 1593600000 16 >;
< 1593600000 16 >,
< 1728000000 16 >;
qcom,pwrcl-speedbin1-v0 =
< 0 0 >,
< 307200000 1 >,
Expand Down Expand Up @@ -541,7 +542,8 @@
< 1920000000 22 >,
< 1996800000 23 >,
< 2073600000 24 >,
< 2150400000 25 >;
< 2150400000 25 >,
< 2265600000 25 >;
qcom,perfcl-speedbin1-v0 =
< 0 0 >,
< 307200000 1 >,
Expand Down Expand Up @@ -663,7 +665,8 @@
< 1324800 >,
< 1401600 >,
< 1478400 >,
< 1593600 >;
< 1593600 >,
< 1728000 >;
qcom,cpufreq-table-2 =
< 307200 >,
< 403200 >,
Expand All @@ -689,7 +692,8 @@
< 1920000 >,
< 1996800 >,
< 2073600 >,
< 2150400 >;
< 2150400 >,
< 2265600 >;
};

&m4m_cache {
Expand Down Expand Up @@ -733,7 +737,8 @@
< 1324800 1056000 >,
< 1401600 1132800 >,
< 1478400 1190400 >,
< 1593600 1382400 >;
< 1593600 1382400 >,
< 1728000 1382400 >;
cpu-to-dev-map-2 =
< 480000 307200 >,
< 556800 307200 >,
Expand All @@ -757,15 +762,17 @@
< 1920000 1459200 >,
< 1996800 1593600 >,
< 2073600 1593600 >,
< 2150400 1593600 >;
< 2150400 1593600 >,
< 2265600 1593600 >;
};

mincpubw-cpufreq {
cpu-to-dev-map-0 =
< 1593600 1525 >;
< 1728000 1525 >;
cpu-to-dev-map-2 =
< 2073600 1525 >,
< 2150400 5195 >;
< 2150400 5195 >,
< 2265600 5195 >;
};
};

Expand Down
43 changes: 43 additions & 0 deletions drivers/cpufreq/qcom-cpufreq.c
Expand Up @@ -35,6 +35,42 @@

static DEFINE_MUTEX(l2bw_lock);


static unsigned long arg_cpu_max_c1 = 1593600;

static int __init cpufreq_read_cpu_max_c1(char *cpu_max_c1)
{
unsigned long ui_khz;
int ret;

ret = kstrtoul(cpu_max_c1, 0, &ui_khz);
if (ret)
return -EINVAL;

arg_cpu_max_c1 = ui_khz;
printk("cpu_max_c1=%lu\n", arg_cpu_max_c1);
return ret;
}
__setup("cpu_max_c1=", cpufreq_read_cpu_max_c1);

static unsigned long arg_cpu_max_c2 = 2150400;

static int __init cpufreq_read_cpu_max_c2(char *cpu_max_c2)
{
unsigned long ui_khz;
int ret;

ret = kstrtoul(cpu_max_c2, 0, &ui_khz);
if (ret)
return -EINVAL;

arg_cpu_max_c2 = ui_khz;
printk("cpu_max_c2=%lu\n", arg_cpu_max_c2);
return ret;
}
__setup("cpu_max_c2=", cpufreq_read_cpu_max_c2);


static struct clk *cpu_clk[NR_CPUS];
static struct clk *l2_clk;
static DEFINE_PER_CPU(struct cpufreq_frequency_table *, freq_table);
Expand Down Expand Up @@ -400,6 +436,13 @@ static struct cpufreq_frequency_table *cpufreq_parse_dt(struct device *dev,
if (i > 0 && f <= ftbl[i-1].frequency)
break;

//Custom max freq
if ((cpu < 2 && f > arg_cpu_max_c1) ||
(cpu >= 2 && f > arg_cpu_max_c2)) {
nf = i;
break;
}

ftbl[i].driver_data = i;
ftbl[i].frequency = f;
}
Expand Down

0 comments on commit cb67550

Please sign in to comment.