aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2012-12-04 09:01:01 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-06 01:13:34 -0500
commitd1e7de3007c6e34c5e6d5e1b707b5aba4a1cd57f (patch)
tree120c74589f1b69477d1568c07057bdc0ded426e1 /drivers/regulator/core.c
parent9489e9dcae718d5fde988e4a684a0f55b5f94d17 (diff)
regulators: add regulator_can_change_voltage() function
Introduce a regulator_can_change_voltage() function for the subsytems or drivers which might check if applying voltage change is possible and use special workaround code when the driver is used with fixed regulators or regulators with disabled ability to change the voltage. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r--drivers/regulator/core.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index e872c8be080e..59e08633372a 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1867,6 +1867,28 @@ int regulator_is_enabled(struct regulator *regulator)
1867EXPORT_SYMBOL_GPL(regulator_is_enabled); 1867EXPORT_SYMBOL_GPL(regulator_is_enabled);
1868 1868
1869/** 1869/**
1870 * regulator_can_change_voltage - check if regulator can change voltage
1871 * @regulator: regulator source
1872 *
1873 * Returns positive if the regulator driver backing the source/client
1874 * can change its voltage, false otherwise. Usefull for detecting fixed
1875 * or dummy regulators and disabling voltage change logic in the client
1876 * driver.
1877 */
1878int regulator_can_change_voltage(struct regulator *regulator)
1879{
1880 struct regulator_dev *rdev = regulator->rdev;
1881
1882 if (rdev->constraints &&
1883 rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE &&
1884 rdev->desc->n_voltages > 1)
1885 return 1;
1886
1887 return 0;
1888}
1889EXPORT_SYMBOL_GPL(regulator_can_change_voltage);
1890
1891/**
1870 * regulator_count_voltages - count regulator_list_voltage() selectors 1892 * regulator_count_voltages - count regulator_list_voltage() selectors
1871 * @regulator: regulator source 1893 * @regulator: regulator source
1872 * 1894 *