aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Moll <pawel.moll@arm.com>2012-09-24 13:56:53 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-10-14 22:56:08 -0400
commitbd7a2b600ace90c8819495b639a744c8f5c68feb (patch)
treed4853e6a5bd7e3bbdf54808c37358870bfd33336
parentddffeb8c4d0331609ef2581d84de4d763607bd37 (diff)
regulator: core: Support for continuous voltage range
Some regulators can set any voltage within the constraints range, not being limited to specified operating points. This patch makes it possible to describe such regulator and makes the regulator_is_supported_voltage() function behave correctly. Signed-off-by: Pawel Moll <pawel.moll@arm.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--drivers/regulator/core.c5
-rw-r--r--include/linux/regulator/driver.h3
2 files changed, 8 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 5c4829cba6a6..f7c74db7465c 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1979,6 +1979,11 @@ int regulator_is_supported_voltage(struct regulator *regulator,
1979 return ret; 1979 return ret;
1980 } 1980 }
1981 1981
1982 /* Any voltage within constrains range is fine? */
1983 if (rdev->desc->continuous_voltage_range)
1984 return min_uV >= rdev->constraints->min_uV &&
1985 max_uV <= rdev->constraints->max_uV;
1986
1982 ret = regulator_count_voltages(regulator); 1987 ret = regulator_count_voltages(regulator);
1983 if (ret < 0) 1988 if (ret < 0)
1984 return ret; 1989 return ret;
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 7932a3bf21bd..f2b72b230b9b 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -181,6 +181,8 @@ enum regulator_type {
181 * @type: Indicates if the regulator is a voltage or current regulator. 181 * @type: Indicates if the regulator is a voltage or current regulator.
182 * @owner: Module providing the regulator, used for refcounting. 182 * @owner: Module providing the regulator, used for refcounting.
183 * 183 *
184 * @continuous_voltage_range: Indicates if the regulator can set any
185 * voltage within constrains range.
184 * @n_voltages: Number of selectors available for ops.list_voltage(). 186 * @n_voltages: Number of selectors available for ops.list_voltage().
185 * 187 *
186 * @min_uV: Voltage given by the lowest selector (if linear mapping) 188 * @min_uV: Voltage given by the lowest selector (if linear mapping)
@@ -199,6 +201,7 @@ struct regulator_desc {
199 const char *name; 201 const char *name;
200 const char *supply_name; 202 const char *supply_name;
201 int id; 203 int id;
204 bool continuous_voltage_range;
202 unsigned n_voltages; 205 unsigned n_voltages;
203 struct regulator_ops *ops; 206 struct regulator_ops *ops;
204 int irq; 207 int irq;