Skip to content

Commit

Permalink
tegra: cpufreq: Don't enable if regulator is already on
Browse files Browse the repository at this point in the history
On the Ouya Console, the cpu/core regulators are already enabled at boot.
The device will hang if the regulators are enabled again.
  • Loading branch information
Decatf committed Feb 16, 2019
1 parent 3fee4a5 commit 85a251d
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions drivers/cpufreq/tegra20-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,18 +567,22 @@ static int tegra_cpu_enable_regulators(struct tegra_cpufreq *cpufreq)
}
}

err = regulator_enable(cpufreq->reg_core);
if (err) {
dev_err(cpufreq->dev,
"Failed to enable CORE regulator: %d\n", err);
goto err_reg_rtc_disable;
if (!regulator_is_enabled(cpufreq->reg_core)) {
err = regulator_enable(cpufreq->reg_core);
if (err) {
dev_err(cpufreq->dev,
"Failed to enable CORE regulator: %d\n", err);
goto err_reg_rtc_disable;
}
}

err = regulator_enable(cpufreq->reg_cpu);
if (err) {
dev_err(cpufreq->dev,
"Failed to enable CPU regulator: %d\n", err);
goto err_reg_core_disable;
if (!regulator_is_enabled(cpufreq->reg_cpu)) {
err = regulator_enable(cpufreq->reg_cpu);
if (err) {
dev_err(cpufreq->dev,
"Failed to enable CPU regulator: %d\n", err);
goto err_reg_core_disable;
}
}

return 0;
Expand Down

0 comments on commit 85a251d

Please sign in to comment.