Skip to content

Commit

Permalink
regulator: core: Support for continuous voltage range
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Pawel Moll authored and Mark Brown committed Oct 15, 2012
1 parent ddffeb8 commit bd7a2b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions include/linux/regulator/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand Down

0 comments on commit bd7a2b6

Please sign in to comment.