@@ -462,7 +462,8 @@ static int regulator_check_states(suspend_state_t state)
*/
int regulator_check_consumers(struct regulator_dev *rdev,
int *min_uV, int *max_uV,
- suspend_state_t state)
+ suspend_state_t state,
+ bool skip_disabled_regulators)
{
struct regulator *regulator;
struct regulator_voltage *voltage;
@@ -476,6 +477,9 @@ int regulator_check_consumers(struct regulator_dev *rdev,
if (!voltage->min_uV && !voltage->max_uV)
continue;
+ if (skip_disabled_regulators && !regulator->enable_count)
+ continue;
+
if (*max_uV > voltage->max_uV)
*max_uV = voltage->max_uV;
if (*min_uV < voltage->min_uV)
@@ -3662,7 +3666,7 @@ static int regulator_get_optimal_voltage(struct regulator_dev *rdev,
ret = regulator_check_consumers(rdev,
&desired_min_uV,
- &desired_max_uV, state);
+ &desired_max_uV, state, false);
if (ret < 0)
return ret;
@@ -3681,7 +3685,7 @@ static int regulator_get_optimal_voltage(struct regulator_dev *rdev,
ret = regulator_check_consumers(c_rdevs[i],
&tmp_min,
- &tmp_max, state);
+ &tmp_max, state, false);
if (ret < 0)
return ret;
@@ -4119,7 +4123,7 @@ int regulator_sync_voltage(struct regulator *regulator)
if (ret < 0)
goto out;
- ret = regulator_check_consumers(rdev, &min_uV, &max_uV, 0);
+ ret = regulator_check_consumers(rdev, &min_uV, &max_uV, 0, false);
if (ret < 0)
goto out;
@@ -41,7 +41,7 @@ static int regulator_get_optimal_voltage(struct regulator_dev *rdev,
ret = regulator_check_consumers(c_rdevs[i],
&tmp_min,
- &tmp_max, state);
+ &tmp_max, state, false);
if (ret < 0)
return ret;
@@ -136,7 +136,7 @@ static int tegra20_core_rtc_update(struct tegra_regulator_coupler *tegra,
return err;
err = regulator_check_consumers(core_rdev, &core_min_uV, &core_max_uV,
- PM_SUSPEND_ON);
+ PM_SUSPEND_ON, true);
if (err)
return err;
@@ -246,12 +246,12 @@ static int tegra20_cpu_voltage_update(struct tegra_regulator_coupler *tegra,
return err;
err = regulator_check_consumers(cpu_rdev, &cpu_min_uV, &cpu_max_uV,
- PM_SUSPEND_ON);
+ PM_SUSPEND_ON, false);
if (err)
return err;
err = regulator_check_consumers(cpu_rdev, &cpu_min_uV_consumers,
- &cpu_max_uV, PM_SUSPEND_ON);
+ &cpu_max_uV, PM_SUSPEND_ON, false);
if (err)
return err;
@@ -164,7 +164,7 @@ static int tegra30_voltage_update(struct tegra_regulator_coupler *tegra,
return err;
err = regulator_check_consumers(core_rdev, &core_min_uV, &core_max_uV,
- PM_SUSPEND_ON);
+ PM_SUSPEND_ON, true);
if (err)
return err;
@@ -175,12 +175,12 @@ static int tegra30_voltage_update(struct tegra_regulator_coupler *tegra,
cpu_min_uV = core_min_uV - max_spread;
err = regulator_check_consumers(cpu_rdev, &cpu_min_uV, &cpu_max_uV,
- PM_SUSPEND_ON);
+ PM_SUSPEND_ON, false);
if (err)
return err;
err = regulator_check_consumers(cpu_rdev, &cpu_min_uV_consumers,
- &cpu_max_uV, PM_SUSPEND_ON);
+ &cpu_max_uV, PM_SUSPEND_ON, false);
if (err)
return err;
@@ -55,7 +55,8 @@ int regulator_coupler_register(struct regulator_coupler *coupler);
const char *rdev_get_name(struct regulator_dev *rdev);
int regulator_check_consumers(struct regulator_dev *rdev,
int *min_uV, int *max_uV,
- suspend_state_t state);
+ suspend_state_t state,
+ bool skip_disabled_regulators);
int regulator_check_voltage(struct regulator_dev *rdev,
int *min_uV, int *max_uV);
int regulator_get_voltage_rdev(struct regulator_dev *rdev);
@@ -75,7 +76,8 @@ static inline const char *rdev_get_name(struct regulator_dev *rdev)
}
static inline int regulator_check_consumers(struct regulator_dev *rdev,
int *min_uV, int *max_uV,
- suspend_state_t state)
+ suspend_state_t state,
+ bool skip_disabled_regulators))
{
return -EINVAL;
}