soc/tegra: regulators: Do nothing if voltage is unchanged

There is no need to re-apply the same voltage. This change is just a minor
cleanup.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
This commit is contained in:
Dmitry Osipenko 2019-12-18 21:55:35 +03:00 committed by Thierry Reding
parent 19d41e5e9c
commit 45f019a684
2 changed files with 13 additions and 1 deletions

View File

@ -162,6 +162,9 @@ static int tegra20_core_rtc_update(struct tegra_regulator_coupler *tegra,
core_target_uV = max(rtc_uV - max_spread, core_target_uV);
}
if (core_uV == core_target_uV)
goto update_rtc;
err = regulator_set_voltage_rdev(core_rdev,
core_target_uV,
core_max_uV,
@ -170,7 +173,7 @@ static int tegra20_core_rtc_update(struct tegra_regulator_coupler *tegra,
return err;
core_uV = core_target_uV;
update_rtc:
if (rtc_uV < rtc_min_uV) {
rtc_target_uV = min(rtc_uV + max_spread, rtc_min_uV);
rtc_target_uV = min(core_uV + max_spread, rtc_target_uV);
@ -179,6 +182,9 @@ static int tegra20_core_rtc_update(struct tegra_regulator_coupler *tegra,
rtc_target_uV = max(core_uV - max_spread, rtc_target_uV);
}
if (rtc_uV == rtc_target_uV)
continue;
err = regulator_set_voltage_rdev(rtc_rdev,
rtc_target_uV,
rtc_max_uV,

View File

@ -209,6 +209,9 @@ static int tegra30_voltage_update(struct tegra_regulator_coupler *tegra,
cpu_target_uV = max(core_uV - max_spread, cpu_target_uV);
}
if (cpu_uV == cpu_target_uV)
goto update_core;
err = regulator_set_voltage_rdev(cpu_rdev,
cpu_target_uV,
cpu_max_uV,
@ -231,6 +234,9 @@ static int tegra30_voltage_update(struct tegra_regulator_coupler *tegra,
core_target_uV = max(core_target_uV, core_uV - core_max_step);
}
if (core_uV == core_target_uV)
continue;
err = regulator_set_voltage_rdev(core_rdev,
core_target_uV,
core_max_uV,