regulator: core: Support for continuous voltage range
authorPawel Moll <pawel.moll@arm.com>
Mon, 24 Sep 2012 17:56:53 +0000 (18:56 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 15 Oct 2012 02:56:08 +0000 (11:56 +0900)
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>
drivers/regulator/core.c
include/linux/regulator/driver.h

index 5c4829cba6a62de6168c6bb3c4913812e5e8b4e1..f7c74db7465cefa6b375b19ab986f36eda0e7a1c 100644 (file)
@@ -1979,6 +1979,11 @@ int regulator_is_supported_voltage(struct regulator *regulator,
                        return ret;
        }
 
+       /* Any voltage within constrains range is fine? */
+       if (rdev->desc->continuous_voltage_range)
+               return min_uV >= rdev->constraints->min_uV &&
+                               max_uV <= rdev->constraints->max_uV;
+
        ret = regulator_count_voltages(regulator);
        if (ret < 0)
                return ret;
index 7932a3bf21bdba89f84275b7b990bcaa3a5773b0..f2b72b230b9ba495965c1b5fa4ddd1d619e10608 100644 (file)
@@ -181,6 +181,8 @@ enum regulator_type {
  * @type: Indicates if the regulator is a voltage or current regulator.
  * @owner: Module providing the regulator, used for refcounting.
  *
+ * @continuous_voltage_range: Indicates if the regulator can set any
+ *                            voltage within constrains range.
  * @n_voltages: Number of selectors available for ops.list_voltage().
  *
  * @min_uV: Voltage given by the lowest selector (if linear mapping)
@@ -199,6 +201,7 @@ struct regulator_desc {
        const char *name;
        const char *supply_name;
        int id;
+       bool continuous_voltage_range;
        unsigned n_voltages;
        struct regulator_ops *ops;
        int irq;