|
@@ -2484,7 +2484,7 @@ static int _regulator_list_voltage(struct regulator *regulator,
|
|
ret = ops->list_voltage(rdev, selector);
|
|
ret = ops->list_voltage(rdev, selector);
|
|
if (lock)
|
|
if (lock)
|
|
mutex_unlock(&rdev->mutex);
|
|
mutex_unlock(&rdev->mutex);
|
|
- } else if (rdev->supply) {
|
|
|
|
|
|
+ } else if (rdev->is_switch && rdev->supply) {
|
|
ret = _regulator_list_voltage(rdev->supply, selector, lock);
|
|
ret = _regulator_list_voltage(rdev->supply, selector, lock);
|
|
} else {
|
|
} else {
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
@@ -2542,7 +2542,7 @@ int regulator_count_voltages(struct regulator *regulator)
|
|
if (rdev->desc->n_voltages)
|
|
if (rdev->desc->n_voltages)
|
|
return rdev->desc->n_voltages;
|
|
return rdev->desc->n_voltages;
|
|
|
|
|
|
- if (!rdev->supply)
|
|
|
|
|
|
+ if (!rdev->is_switch || !rdev->supply)
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
|
|
|
return regulator_count_voltages(rdev->supply);
|
|
return regulator_count_voltages(rdev->supply);
|
|
@@ -4097,6 +4097,11 @@ regulator_register(const struct regulator_desc *regulator_desc,
|
|
mutex_unlock(®ulator_list_mutex);
|
|
mutex_unlock(®ulator_list_mutex);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (!rdev->desc->ops->get_voltage &&
|
|
|
|
+ !rdev->desc->ops->list_voltage &&
|
|
|
|
+ !rdev->desc->fixed_uV)
|
|
|
|
+ rdev->is_switch = true;
|
|
|
|
+
|
|
ret = device_register(&rdev->dev);
|
|
ret = device_register(&rdev->dev);
|
|
if (ret != 0) {
|
|
if (ret != 0) {
|
|
put_device(&rdev->dev);
|
|
put_device(&rdev->dev);
|