aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r--drivers/regulator/core.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 7584a74eec8a..333b7ebe7cae 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1883,6 +1883,31 @@ int regulator_list_voltage_linear(struct regulator_dev *rdev,
1883EXPORT_SYMBOL_GPL(regulator_list_voltage_linear); 1883EXPORT_SYMBOL_GPL(regulator_list_voltage_linear);
1884 1884
1885/** 1885/**
1886 * regulator_list_voltage_table - List voltages with table based mapping
1887 *
1888 * @rdev: Regulator device
1889 * @selector: Selector to convert into a voltage
1890 *
1891 * Regulators with table based mapping between voltages and
1892 * selectors can set volt_table in the regulator descriptor
1893 * and then use this function as their list_voltage() operation.
1894 */
1895int regulator_list_voltage_table(struct regulator_dev *rdev,
1896 unsigned int selector)
1897{
1898 if (!rdev->desc->volt_table) {
1899 BUG_ON(!rdev->desc->volt_table);
1900 return -EINVAL;
1901 }
1902
1903 if (selector >= rdev->desc->n_voltages)
1904 return -EINVAL;
1905
1906 return rdev->desc->volt_table[selector];
1907}
1908EXPORT_SYMBOL_GPL(regulator_list_voltage_table);
1909
1910/**
1886 * regulator_list_voltage - enumerate supported voltages 1911 * regulator_list_voltage - enumerate supported voltages
1887 * @regulator: regulator source 1912 * @regulator: regulator source
1888 * @selector: identify voltage to list 1913 * @selector: identify voltage to list