Skip to content

Commit

Permalink
Merge remote-tracking branch 'regulator/topic/change' into regulator-…
Browse files Browse the repository at this point in the history
…next
  • Loading branch information
Mark Brown committed Dec 10, 2012
2 parents b0e5997 + d1e7de3 commit 6234427
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1866,6 +1866,28 @@ int regulator_is_enabled(struct regulator *regulator)
}
EXPORT_SYMBOL_GPL(regulator_is_enabled);

/**
* regulator_can_change_voltage - check if regulator can change voltage
* @regulator: regulator source
*
* Returns positive if the regulator driver backing the source/client
* can change its voltage, false otherwise. Usefull for detecting fixed
* or dummy regulators and disabling voltage change logic in the client
* driver.
*/
int regulator_can_change_voltage(struct regulator *regulator)
{
struct regulator_dev *rdev = regulator->rdev;

if (rdev->constraints &&
rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE &&
rdev->desc->n_voltages > 1)
return 1;

return 0;
}
EXPORT_SYMBOL_GPL(regulator_can_change_voltage);

/**
* regulator_count_voltages - count regulator_list_voltage() selectors
* @regulator: regulator source
Expand Down
1 change: 1 addition & 0 deletions include/linux/regulator/consumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ int regulator_bulk_force_disable(int num_consumers,
void regulator_bulk_free(int num_consumers,
struct regulator_bulk_data *consumers);

int regulator_can_change_voltage(struct regulator *regulator);
int regulator_count_voltages(struct regulator *regulator);
int regulator_list_voltage(struct regulator *regulator, unsigned selector);
int regulator_is_supported_voltage(struct regulator *regulator,
Expand Down

0 comments on commit 6234427

Please sign in to comment.