mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
Merge OPP material for v4.11 to satisfy dependencies.
This commit is contained in:
commit
40e993aa04
21 changed files with 591 additions and 977 deletions
|
|
@ -148,7 +148,6 @@ static int cpufreq_init(struct cpufreq_policy *policy)
|
|||
struct private_data *priv;
|
||||
struct device *cpu_dev;
|
||||
struct clk *cpu_clk;
|
||||
struct dev_pm_opp *suspend_opp;
|
||||
unsigned int transition_latency;
|
||||
bool fallback = false;
|
||||
const char *name;
|
||||
|
|
@ -252,11 +251,7 @@ static int cpufreq_init(struct cpufreq_policy *policy)
|
|||
policy->driver_data = priv;
|
||||
policy->clk = cpu_clk;
|
||||
|
||||
rcu_read_lock();
|
||||
suspend_opp = dev_pm_opp_get_suspend_opp(cpu_dev);
|
||||
if (suspend_opp)
|
||||
policy->suspend_freq = dev_pm_opp_get_freq(suspend_opp) / 1000;
|
||||
rcu_read_unlock();
|
||||
policy->suspend_freq = dev_pm_opp_get_suspend_opp_freq(cpu_dev) / 1000;
|
||||
|
||||
ret = cpufreq_table_validate_and_show(policy, freq_table);
|
||||
if (ret) {
|
||||
|
|
|
|||
|
|
@ -118,12 +118,10 @@ static int init_div_table(void)
|
|||
unsigned int tmp, clk_div, ema_div, freq, volt_id;
|
||||
struct dev_pm_opp *opp;
|
||||
|
||||
rcu_read_lock();
|
||||
cpufreq_for_each_entry(pos, freq_tbl) {
|
||||
opp = dev_pm_opp_find_freq_exact(dvfs_info->dev,
|
||||
pos->frequency * 1000, true);
|
||||
if (IS_ERR(opp)) {
|
||||
rcu_read_unlock();
|
||||
dev_err(dvfs_info->dev,
|
||||
"failed to find valid OPP for %u KHZ\n",
|
||||
pos->frequency);
|
||||
|
|
@ -140,6 +138,7 @@ static int init_div_table(void)
|
|||
|
||||
/* Calculate EMA */
|
||||
volt_id = dev_pm_opp_get_voltage(opp);
|
||||
|
||||
volt_id = (MAX_VOLTAGE - volt_id) / VOLTAGE_STEP;
|
||||
if (volt_id < PMIC_HIGH_VOLT) {
|
||||
ema_div = (CPUEMA_HIGH << P0_7_CPUEMA_SHIFT) |
|
||||
|
|
@ -157,9 +156,9 @@ static int init_div_table(void)
|
|||
|
||||
__raw_writel(tmp, dvfs_info->base + XMU_PMU_P0_7 + 4 *
|
||||
(pos - freq_tbl));
|
||||
dev_pm_opp_put(opp);
|
||||
}
|
||||
|
||||
rcu_read_unlock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,16 +53,15 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index)
|
|||
freq_hz = new_freq * 1000;
|
||||
old_freq = clk_get_rate(arm_clk) / 1000;
|
||||
|
||||
rcu_read_lock();
|
||||
opp = dev_pm_opp_find_freq_ceil(cpu_dev, &freq_hz);
|
||||
if (IS_ERR(opp)) {
|
||||
rcu_read_unlock();
|
||||
dev_err(cpu_dev, "failed to find OPP for %ld\n", freq_hz);
|
||||
return PTR_ERR(opp);
|
||||
}
|
||||
|
||||
volt = dev_pm_opp_get_voltage(opp);
|
||||
rcu_read_unlock();
|
||||
dev_pm_opp_put(opp);
|
||||
|
||||
volt_old = regulator_get_voltage(arm_reg);
|
||||
|
||||
dev_dbg(cpu_dev, "%u MHz, %ld mV --> %u MHz, %ld mV\n",
|
||||
|
|
@ -321,14 +320,15 @@ soc_opp_out:
|
|||
* freq_table initialised from OPP is therefore sorted in the
|
||||
* same order.
|
||||
*/
|
||||
rcu_read_lock();
|
||||
opp = dev_pm_opp_find_freq_exact(cpu_dev,
|
||||
freq_table[0].frequency * 1000, true);
|
||||
min_volt = dev_pm_opp_get_voltage(opp);
|
||||
dev_pm_opp_put(opp);
|
||||
opp = dev_pm_opp_find_freq_exact(cpu_dev,
|
||||
freq_table[--num].frequency * 1000, true);
|
||||
max_volt = dev_pm_opp_get_voltage(opp);
|
||||
rcu_read_unlock();
|
||||
dev_pm_opp_put(opp);
|
||||
|
||||
ret = regulator_set_voltage_time(arm_reg, min_volt, max_volt);
|
||||
if (ret > 0)
|
||||
transition_latency += ret * 1000;
|
||||
|
|
|
|||
|
|
@ -232,16 +232,14 @@ static int mtk_cpufreq_set_target(struct cpufreq_policy *policy,
|
|||
|
||||
freq_hz = freq_table[index].frequency * 1000;
|
||||
|
||||
rcu_read_lock();
|
||||
opp = dev_pm_opp_find_freq_ceil(cpu_dev, &freq_hz);
|
||||
if (IS_ERR(opp)) {
|
||||
rcu_read_unlock();
|
||||
pr_err("cpu%d: failed to find OPP for %ld\n",
|
||||
policy->cpu, freq_hz);
|
||||
return PTR_ERR(opp);
|
||||
}
|
||||
vproc = dev_pm_opp_get_voltage(opp);
|
||||
rcu_read_unlock();
|
||||
dev_pm_opp_put(opp);
|
||||
|
||||
/*
|
||||
* If the new voltage or the intermediate voltage is higher than the
|
||||
|
|
@ -411,16 +409,14 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu)
|
|||
|
||||
/* Search a safe voltage for intermediate frequency. */
|
||||
rate = clk_get_rate(inter_clk);
|
||||
rcu_read_lock();
|
||||
opp = dev_pm_opp_find_freq_ceil(cpu_dev, &rate);
|
||||
if (IS_ERR(opp)) {
|
||||
rcu_read_unlock();
|
||||
pr_err("failed to get intermediate opp for cpu%d\n", cpu);
|
||||
ret = PTR_ERR(opp);
|
||||
goto out_free_opp_table;
|
||||
}
|
||||
info->intermediate_voltage = dev_pm_opp_get_voltage(opp);
|
||||
rcu_read_unlock();
|
||||
dev_pm_opp_put(opp);
|
||||
|
||||
info->cpu_dev = cpu_dev;
|
||||
info->proc_reg = proc_reg;
|
||||
|
|
|
|||
|
|
@ -63,16 +63,14 @@ static int omap_target(struct cpufreq_policy *policy, unsigned int index)
|
|||
freq = ret;
|
||||
|
||||
if (mpu_reg) {
|
||||
rcu_read_lock();
|
||||
opp = dev_pm_opp_find_freq_ceil(mpu_dev, &freq);
|
||||
if (IS_ERR(opp)) {
|
||||
rcu_read_unlock();
|
||||
dev_err(mpu_dev, "%s: unable to find MPU OPP for %d\n",
|
||||
__func__, new_freq);
|
||||
return -EINVAL;
|
||||
}
|
||||
volt = dev_pm_opp_get_voltage(opp);
|
||||
rcu_read_unlock();
|
||||
dev_pm_opp_put(opp);
|
||||
tol = volt * OPP_TOLERANCE / 100;
|
||||
volt_old = regulator_get_voltage(mpu_reg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@ static int sti_cpufreq_set_opp_info(void)
|
|||
int pcode, substrate, major, minor;
|
||||
int ret;
|
||||
char name[MAX_PCODE_NAME_LEN];
|
||||
struct opp_table *opp_table;
|
||||
|
||||
reg_fields = sti_cpufreq_match();
|
||||
if (!reg_fields) {
|
||||
|
|
@ -211,20 +212,20 @@ use_defaults:
|
|||
|
||||
snprintf(name, MAX_PCODE_NAME_LEN, "pcode%d", pcode);
|
||||
|
||||
ret = dev_pm_opp_set_prop_name(dev, name);
|
||||
if (ret) {
|
||||
opp_table = dev_pm_opp_set_prop_name(dev, name);
|
||||
if (IS_ERR(opp_table)) {
|
||||
dev_err(dev, "Failed to set prop name\n");
|
||||
return ret;
|
||||
return PTR_ERR(opp_table);
|
||||
}
|
||||
|
||||
version[0] = BIT(major);
|
||||
version[1] = BIT(minor);
|
||||
version[2] = BIT(substrate);
|
||||
|
||||
ret = dev_pm_opp_set_supported_hw(dev, version, VERSION_ELEMENTS);
|
||||
if (ret) {
|
||||
opp_table = dev_pm_opp_set_supported_hw(dev, version, VERSION_ELEMENTS);
|
||||
if (IS_ERR(opp_table)) {
|
||||
dev_err(dev, "Failed to set supported hardware\n");
|
||||
return ret;
|
||||
return PTR_ERR(opp_table);
|
||||
}
|
||||
|
||||
dev_dbg(dev, "pcode: %d major: %d minor: %d substrate: %d\n",
|
||||
|
|
|
|||
Loading…
Reference in a new issue