Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 165380
b: refs/heads/master
c: a7a1ad9
h: refs/heads/master
v: v3
  • Loading branch information
Mark Brown authored and Liam Girdwood committed Sep 22, 2009
1 parent 906e6a7 commit 1fd531e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5ffbd136e6c51c8d1eec7a4a0c5d2180c81aea30
refs/heads/master: a7a1ad9066e0266c8a4357ba3dbaeebfb80f531d
29 changes: 29 additions & 0 deletions trunk/drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1441,6 +1441,35 @@ int regulator_list_voltage(struct regulator *regulator, unsigned selector)
}
EXPORT_SYMBOL_GPL(regulator_list_voltage);

/**
* regulator_is_supported_voltage - check if a voltage range can be supported
*
* @regulator: Regulator to check.
* @min_uV: Minimum required voltage in uV.
* @max_uV: Maximum required voltage in uV.
*
* Returns a boolean or a negative error code.
*/
int regulator_is_supported_voltage(struct regulator *regulator,
int min_uV, int max_uV)
{
int i, voltages, ret;

ret = regulator_count_voltages(regulator);
if (ret < 0)
return ret;
voltages = ret;

for (i = 0; i < voltages; i++) {
ret = regulator_list_voltage(regulator, i);

if (ret >= min_uV && ret <= max_uV)
return 1;
}

return 0;
}

/**
* regulator_set_voltage - set regulator output voltage
* @regulator: regulator source
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/regulator/consumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ void regulator_bulk_free(int num_consumers,

int regulator_count_voltages(struct regulator *regulator);
int regulator_list_voltage(struct regulator *regulator, unsigned selector);
int regulator_is_supported_voltage(struct regulator *regulator,
int min_uV, int max_uV);
int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
int regulator_get_voltage(struct regulator *regulator);
int regulator_set_current_limit(struct regulator *regulator,
Expand Down

0 comments on commit 1fd531e

Please sign in to comment.