diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2013-09-10 12:15:05 +0200 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-09-10 19:19:52 +0200 |
commit | 5a523605afa7d3b54b2e7041f8c9e6bc39872a7e (patch) | |
tree | bb8b579e660754e37ae11b68f11085d12dff7c71 /drivers | |
parent | Merge remote-tracking branch 'regulator/topic/tps65912' into regulator-next (diff) | |
download | linux-5a523605afa7d3b54b2e7041f8c9e6bc39872a7e.tar.xz linux-5a523605afa7d3b54b2e7041f8c9e6bc39872a7e.zip |
regulator: core: provide fixed voltage in desc for single voltage rail
If given rail has the single voltage (n_voltages = 1) then provide the
rail voltage through regulator descriptor so that core can use this
value for finding voltage.
This will avoid the implementation of the callback for get_voltage() or
list_voltage() callback on regulator driver.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/regulator/core.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index a01b8b3b70ca..abc899ed1ebf 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2489,6 +2489,8 @@ static int _regulator_get_voltage(struct regulator_dev *rdev) ret = rdev->desc->ops->get_voltage(rdev); } else if (rdev->desc->ops->list_voltage) { ret = rdev->desc->ops->list_voltage(rdev, 0); + } else if (rdev->desc->fixed_uV && (rdev->desc->n_voltages == 1)) { + ret = rdev->desc->fixed_uV; } else { return -EINVAL; } @@ -3170,7 +3172,8 @@ static int add_regulator_attributes(struct regulator_dev *rdev) /* some attributes need specific methods to be displayed */ if ((ops->get_voltage && ops->get_voltage(rdev) >= 0) || (ops->get_voltage_sel && ops->get_voltage_sel(rdev) >= 0) || - (ops->list_voltage && ops->list_voltage(rdev, 0) >= 0)) { + (ops->list_voltage && ops->list_voltage(rdev, 0) >= 0) || + (rdev->desc->fixed_uV && (rdev->desc->n_voltages == 1))) { status = device_create_file(dev, &dev_attr_microvolts); if (status < 0) return status; |