diff options
author | Alex Frid <afrid@nvidia.com> | 2014-01-30 20:15:09 -0800 |
---|---|---|
committer | Yu-Huan Hsu <yhsu@nvidia.com> | 2014-01-31 18:10:30 -0800 |
commit | 699df098b8c1b54a06d9c4a30a7514d9197029db (patch) | |
tree | 866e52a26a68a0f1882c90c467f390ac83693fbc /drivers/regulator | |
parent | 2c8cc68738be4f2ce1b217f229b4710867b5c151 (diff) |
regulator: Add regulator_can_set_mode() interface
Added a regulator_can_set_mode() interface so that the drivers are
able to differentiate between no support for mode control and set mode
interface failures.
Change-Id: I4c1715ad2580ac97fb4d8eff964cda8edfec21de
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/362272
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/core.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 09e7ea811791..eb38288a6959 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -3179,6 +3179,21 @@ int regulator_get_current_limit(struct regulator *regulator) EXPORT_SYMBOL_GPL(regulator_get_current_limit); /** + * regulator_can_set_mode - check if regulator can set mode + * @regulator: regulator source + * + * Returns positive if the regulator driver backing the source/client + * can control regulator mode, false otherwise. + */ +int regulator_can_set_mode(struct regulator *regulator) +{ + struct regulator_dev *rdev = regulator->rdev; + + return rdev->desc->ops->set_mode ? 1 : 0; +} +EXPORT_SYMBOL_GPL(regulator_can_set_mode); + +/** * regulator_set_mode - set regulator operating mode * @regulator: regulator source * @mode: operating mode - one of the REGULATOR_MODE constants |