|
@@ -1890,8 +1890,18 @@ EXPORT_SYMBOL_GPL(regulator_list_voltage);
|
|
|
int regulator_is_supported_voltage(struct regulator *regulator,
|
|
|
int min_uV, int max_uV)
|
|
|
{
|
|
|
+ struct regulator_dev *rdev = regulator->rdev;
|
|
|
int i, voltages, ret;
|
|
|
|
|
|
+ /* If we can't change voltage check the current voltage */
|
|
|
+ if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) {
|
|
|
+ ret = regulator_get_voltage(regulator);
|
|
|
+ if (ret >= 0)
|
|
|
+ return (min_uV >= ret && ret <= max_uV);
|
|
|
+ else
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
ret = regulator_count_voltages(regulator);
|
|
|
if (ret < 0)
|
|
|
return ret;
|