|
@@ -2761,33 +2761,14 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
-/**
|
|
|
|
- * regulator_set_voltage - set regulator output voltage
|
|
|
|
- * @regulator: regulator source
|
|
|
|
- * @min_uV: Minimum required voltage in uV
|
|
|
|
- * @max_uV: Maximum acceptable voltage in uV
|
|
|
|
- *
|
|
|
|
- * Sets a voltage regulator to the desired output voltage. This can be set
|
|
|
|
- * during any regulator state. IOW, regulator can be disabled or enabled.
|
|
|
|
- *
|
|
|
|
- * If the regulator is enabled then the voltage will change to the new value
|
|
|
|
- * immediately otherwise if the regulator is disabled the regulator will
|
|
|
|
- * output at the new voltage when enabled.
|
|
|
|
- *
|
|
|
|
- * NOTE: If the regulator is shared between several devices then the lowest
|
|
|
|
- * request voltage that meets the system constraints will be used.
|
|
|
|
- * Regulator system constraints must be set for this regulator before
|
|
|
|
- * calling this function otherwise this call will fail.
|
|
|
|
- */
|
|
|
|
-int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
|
|
|
|
|
|
+static int regulator_set_voltage_unlocked(struct regulator *regulator,
|
|
|
|
+ int min_uV, int max_uV)
|
|
{
|
|
{
|
|
struct regulator_dev *rdev = regulator->rdev;
|
|
struct regulator_dev *rdev = regulator->rdev;
|
|
int ret = 0;
|
|
int ret = 0;
|
|
int old_min_uV, old_max_uV;
|
|
int old_min_uV, old_max_uV;
|
|
int current_uV;
|
|
int current_uV;
|
|
|
|
|
|
- mutex_lock(&rdev->mutex);
|
|
|
|
-
|
|
|
|
/* If we're setting the same range as last time the change
|
|
/* If we're setting the same range as last time the change
|
|
* should be a noop (some cpufreq implementations use the same
|
|
* should be a noop (some cpufreq implementations use the same
|
|
* voltage for multiple frequencies, for example).
|
|
* voltage for multiple frequencies, for example).
|
|
@@ -2835,12 +2816,42 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
|
|
goto out2;
|
|
goto out2;
|
|
|
|
|
|
out:
|
|
out:
|
|
- mutex_unlock(&rdev->mutex);
|
|
|
|
return ret;
|
|
return ret;
|
|
out2:
|
|
out2:
|
|
regulator->min_uV = old_min_uV;
|
|
regulator->min_uV = old_min_uV;
|
|
regulator->max_uV = old_max_uV;
|
|
regulator->max_uV = old_max_uV;
|
|
- mutex_unlock(&rdev->mutex);
|
|
|
|
|
|
+
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * regulator_set_voltage - set regulator output voltage
|
|
|
|
+ * @regulator: regulator source
|
|
|
|
+ * @min_uV: Minimum required voltage in uV
|
|
|
|
+ * @max_uV: Maximum acceptable voltage in uV
|
|
|
|
+ *
|
|
|
|
+ * Sets a voltage regulator to the desired output voltage. This can be set
|
|
|
|
+ * during any regulator state. IOW, regulator can be disabled or enabled.
|
|
|
|
+ *
|
|
|
|
+ * If the regulator is enabled then the voltage will change to the new value
|
|
|
|
+ * immediately otherwise if the regulator is disabled the regulator will
|
|
|
|
+ * output at the new voltage when enabled.
|
|
|
|
+ *
|
|
|
|
+ * NOTE: If the regulator is shared between several devices then the lowest
|
|
|
|
+ * request voltage that meets the system constraints will be used.
|
|
|
|
+ * Regulator system constraints must be set for this regulator before
|
|
|
|
+ * calling this function otherwise this call will fail.
|
|
|
|
+ */
|
|
|
|
+int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
|
|
|
|
+{
|
|
|
|
+ int ret = 0;
|
|
|
|
+
|
|
|
|
+ mutex_lock(®ulator->rdev->mutex);
|
|
|
|
+
|
|
|
|
+ ret = regulator_set_voltage_unlocked(regulator, min_uV, max_uV);
|
|
|
|
+
|
|
|
|
+ mutex_unlock(®ulator->rdev->mutex);
|
|
|
|
+
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(regulator_set_voltage);
|
|
EXPORT_SYMBOL_GPL(regulator_set_voltage);
|