Merge branch 'pm-cpufreq-arm' into pm-cpufreq

* pm-cpufreq-arm:
  cpufreq: tegra: call CPUFREQ_POSTCHANGE notfier in error cases
  cpufreq: s3c64xx: call CPUFREQ_POSTCHANGE notfier in error cases
  cpufreq: omap: call CPUFREQ_POSTCHANGE notfier in error cases
  cpufreq: imx6q: call CPUFREQ_POSTCHANGE notfier in error cases
  cpufreq: exynos: call CPUFREQ_POSTCHANGE notfier in error cases
  cpufreq: dbx500: call CPUFREQ_POSTCHANGE notfier in error cases
  cpufreq: davinci: call CPUFREQ_POSTCHANGE notfier in error cases
  cpufreq: arm-big-little: call CPUFREQ_POSTCHANGE notfier in error cases
  cpufreq: s3c2416: fix forgotten driver_data conversions
This commit is contained in:
Rafael J. Wysocki 2013-06-27 21:47:03 +02:00
commit e11158c0c9
9 changed files with 38 additions and 22 deletions

View File

@ -84,11 +84,9 @@ static int bL_cpufreq_set_target(struct cpufreq_policy *policy,
ret = clk_set_rate(clk[cur_cluster], freqs.new * 1000); ret = clk_set_rate(clk[cur_cluster], freqs.new * 1000);
if (ret) { if (ret) {
pr_err("clk_set_rate failed: %d\n", ret); pr_err("clk_set_rate failed: %d\n", ret);
return ret; freqs.new = freqs.old;
} }
policy->cur = freqs.new;
cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
return ret; return ret;

View File

@ -114,6 +114,9 @@ static int davinci_target(struct cpufreq_policy *policy,
pdata->set_voltage(idx); pdata->set_voltage(idx);
out: out:
if (ret)
freqs.new = freqs.old;
cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
return ret; return ret;

View File

@ -57,13 +57,13 @@ static int dbx500_cpufreq_target(struct cpufreq_policy *policy,
if (ret) { if (ret) {
pr_err("dbx500-cpufreq: Failed to set armss_clk to %d Hz: error %d\n", pr_err("dbx500-cpufreq: Failed to set armss_clk to %d Hz: error %d\n",
freqs.new * 1000, ret); freqs.new * 1000, ret);
return ret; freqs.new = freqs.old;
} }
/* post change notification */ /* post change notification */
cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
return 0; return ret;
} }
static unsigned int dbx500_cpufreq_getspeed(unsigned int cpu) static unsigned int dbx500_cpufreq_getspeed(unsigned int cpu)

View File

@ -113,7 +113,8 @@ static int exynos_cpufreq_scale(unsigned int target_freq)
if (ret) { if (ret) {
pr_err("%s: failed to set cpu voltage to %d\n", pr_err("%s: failed to set cpu voltage to %d\n",
__func__, arm_volt); __func__, arm_volt);
goto out; freqs.new = freqs.old;
goto post_notify;
} }
} }
@ -123,14 +124,19 @@ static int exynos_cpufreq_scale(unsigned int target_freq)
if (ret) { if (ret) {
pr_err("%s: failed to set cpu voltage to %d\n", pr_err("%s: failed to set cpu voltage to %d\n",
__func__, safe_arm_volt); __func__, safe_arm_volt);
goto out; freqs.new = freqs.old;
goto post_notify;
} }
} }
exynos_info->set_freq(old_index, index); exynos_info->set_freq(old_index, index);
post_notify:
cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
if (ret)
goto out;
/* When the new frequency is lower than current frequency */ /* When the new frequency is lower than current frequency */
if ((freqs.new < freqs.old) || if ((freqs.new < freqs.old) ||
((freqs.new > freqs.old) && safe_arm_volt)) { ((freqs.new > freqs.old) && safe_arm_volt)) {

View File

@ -68,8 +68,6 @@ static int imx6q_set_target(struct cpufreq_policy *policy,
if (freqs.old == freqs.new) if (freqs.old == freqs.new)
return 0; return 0;
cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
rcu_read_lock(); rcu_read_lock();
opp = opp_find_freq_ceil(cpu_dev, &freq_hz); opp = opp_find_freq_ceil(cpu_dev, &freq_hz);
if (IS_ERR(opp)) { if (IS_ERR(opp)) {
@ -86,13 +84,16 @@ static int imx6q_set_target(struct cpufreq_policy *policy,
freqs.old / 1000, volt_old / 1000, freqs.old / 1000, volt_old / 1000,
freqs.new / 1000, volt / 1000); freqs.new / 1000, volt / 1000);
cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
/* scaling up? scale voltage before frequency */ /* scaling up? scale voltage before frequency */
if (freqs.new > freqs.old) { if (freqs.new > freqs.old) {
ret = regulator_set_voltage_tol(arm_reg, volt, 0); ret = regulator_set_voltage_tol(arm_reg, volt, 0);
if (ret) { if (ret) {
dev_err(cpu_dev, dev_err(cpu_dev,
"failed to scale vddarm up: %d\n", ret); "failed to scale vddarm up: %d\n", ret);
return ret; freqs.new = freqs.old;
goto post_notify;
} }
/* /*
@ -145,15 +146,18 @@ static int imx6q_set_target(struct cpufreq_policy *policy,
if (ret) { if (ret) {
dev_err(cpu_dev, "failed to set clock rate: %d\n", ret); dev_err(cpu_dev, "failed to set clock rate: %d\n", ret);
regulator_set_voltage_tol(arm_reg, volt_old, 0); regulator_set_voltage_tol(arm_reg, volt_old, 0);
return ret; freqs.new = freqs.old;
goto post_notify;
} }
/* scaling down? scale voltage after frequency */ /* scaling down? scale voltage after frequency */
if (freqs.new < freqs.old) { if (freqs.new < freqs.old) {
ret = regulator_set_voltage_tol(arm_reg, volt, 0); ret = regulator_set_voltage_tol(arm_reg, volt, 0);
if (ret) if (ret) {
dev_warn(cpu_dev, dev_warn(cpu_dev,
"failed to scale vddarm down: %d\n", ret); "failed to scale vddarm down: %d\n", ret);
ret = 0;
}
if (freqs.old == FREQ_1P2_GHZ / 1000) { if (freqs.old == FREQ_1P2_GHZ / 1000) {
regulator_set_voltage_tol(pu_reg, regulator_set_voltage_tol(pu_reg,
@ -163,9 +167,10 @@ static int imx6q_set_target(struct cpufreq_policy *policy,
} }
} }
post_notify:
cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
return 0; return ret;
} }
static int imx6q_cpufreq_init(struct cpufreq_policy *policy) static int imx6q_cpufreq_init(struct cpufreq_policy *policy)

View File

@ -93,9 +93,6 @@ static int omap_target(struct cpufreq_policy *policy,
if (freqs.old == freqs.new && policy->cur == freqs.new) if (freqs.old == freqs.new && policy->cur == freqs.new)
return ret; return ret;
/* notifiers */
cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
freq = freqs.new * 1000; freq = freqs.new * 1000;
ret = clk_round_rate(mpu_clk, freq); ret = clk_round_rate(mpu_clk, freq);
if (IS_ERR_VALUE(ret)) { if (IS_ERR_VALUE(ret)) {
@ -125,6 +122,9 @@ static int omap_target(struct cpufreq_policy *policy,
freqs.old / 1000, volt_old ? volt_old / 1000 : -1, freqs.old / 1000, volt_old ? volt_old / 1000 : -1,
freqs.new / 1000, volt ? volt / 1000 : -1); freqs.new / 1000, volt ? volt / 1000 : -1);
/* notifiers */
cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
/* scaling up? scale voltage before frequency */ /* scaling up? scale voltage before frequency */
if (mpu_reg && (freqs.new > freqs.old)) { if (mpu_reg && (freqs.new > freqs.old)) {
r = regulator_set_voltage(mpu_reg, volt - tol, volt + tol); r = regulator_set_voltage(mpu_reg, volt - tol, volt + tol);

View File

@ -312,7 +312,7 @@ static void __init s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq)
if (freq->frequency == CPUFREQ_ENTRY_INVALID) if (freq->frequency == CPUFREQ_ENTRY_INVALID)
continue; continue;
dvfs = &s3c2416_dvfs_table[freq->index]; dvfs = &s3c2416_dvfs_table[freq->driver_data];
found = 0; found = 0;
/* Check only the min-voltage, more is always ok on S3C2416 */ /* Check only the min-voltage, more is always ok on S3C2416 */
@ -462,7 +462,7 @@ static int __init s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy)
freq = s3c_freq->freq_table; freq = s3c_freq->freq_table;
while (freq->frequency != CPUFREQ_TABLE_END) { while (freq->frequency != CPUFREQ_TABLE_END) {
/* special handling for dvs mode */ /* special handling for dvs mode */
if (freq->index == 0) { if (freq->driver_data == 0) {
if (!s3c_freq->hclk) { if (!s3c_freq->hclk) {
pr_debug("cpufreq: %dkHz unsupported as it would need unavailable dvs mode\n", pr_debug("cpufreq: %dkHz unsupported as it would need unavailable dvs mode\n",
freq->frequency); freq->frequency);

View File

@ -104,7 +104,8 @@ static int s3c64xx_cpufreq_set_target(struct cpufreq_policy *policy,
if (ret != 0) { if (ret != 0) {
pr_err("Failed to set VDDARM for %dkHz: %d\n", pr_err("Failed to set VDDARM for %dkHz: %d\n",
freqs.new, ret); freqs.new, ret);
goto err; freqs.new = freqs.old;
goto post_notify;
} }
} }
#endif #endif
@ -113,10 +114,13 @@ static int s3c64xx_cpufreq_set_target(struct cpufreq_policy *policy,
if (ret < 0) { if (ret < 0) {
pr_err("Failed to set rate %dkHz: %d\n", pr_err("Failed to set rate %dkHz: %d\n",
freqs.new, ret); freqs.new, ret);
goto err; freqs.new = freqs.old;
} }
post_notify:
cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
if (ret)
goto err;
#ifdef CONFIG_REGULATOR #ifdef CONFIG_REGULATOR
if (vddarm && freqs.new < freqs.old) { if (vddarm && freqs.new < freqs.old) {

View File

@ -137,12 +137,12 @@ static int tegra_update_cpu_speed(struct cpufreq_policy *policy,
if (ret) { if (ret) {
pr_err("cpu-tegra: Failed to set cpu frequency to %d kHz\n", pr_err("cpu-tegra: Failed to set cpu frequency to %d kHz\n",
freqs.new); freqs.new);
return ret; freqs.new = freqs.old;
} }
cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
return 0; return ret;
} }
static unsigned long tegra_cpu_highest_speed(void) static unsigned long tegra_cpu_highest_speed(void)