lkml.org 
[lkml]   [2012]   [Nov]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3] regulator: treat regulators with constant volatage as fixed
Date
Some drivers has additional logic for fixed regulators. Let regulator core
to treat regulators which cannot change their voltage due to applied
constraints as fixed.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
drivers/regulator/core.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 042c1ff..d07c240 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1872,7 +1872,14 @@ int regulator_count_voltages(struct regulator *regulator)
{
struct regulator_dev *rdev = regulator->rdev;

- return rdev->desc->n_voltages ? : -EINVAL;
+ if (rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE) {
+ if (rdev->desc->n_voltages)
+ return rdev->desc->n_voltages;
+ else
+ return -EINVAL;
+ } else {
+ return 1;
+ }
}
EXPORT_SYMBOL_GPL(regulator_count_voltages);

--
1.7.9.5


\
 
 \ /
  Last update: 2012-11-13 14:01    [W:0.104 / U:0.416 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site