diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-08-04 14:09:52 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2009-09-17 03:47:05 -0400 |
commit | be721979dd6b335e4ab6f83abb5cc11c33662aa8 (patch) | |
tree | f08095efe3c60c0388f111611e57a9d873fca6a9 /drivers | |
parent | 0c73b992dd4c645f050344cb13142c0fd3496824 (diff) |
regulator: Provide mode to status conversion function
This is useful for implementing get_status() in terms of get_mode().
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/regulator/core.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 98c3a74e9949..91ba9bfaa706 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -1864,6 +1864,30 @@ int regulator_notifier_call_chain(struct regulator_dev *rdev, | |||
1864 | } | 1864 | } |
1865 | EXPORT_SYMBOL_GPL(regulator_notifier_call_chain); | 1865 | EXPORT_SYMBOL_GPL(regulator_notifier_call_chain); |
1866 | 1866 | ||
1867 | /** | ||
1868 | * regulator_mode_to_status - convert a regulator mode into a status | ||
1869 | * | ||
1870 | * @mode: Mode to convert | ||
1871 | * | ||
1872 | * Convert a regulator mode into a status. | ||
1873 | */ | ||
1874 | int regulator_mode_to_status(unsigned int mode) | ||
1875 | { | ||
1876 | switch (mode) { | ||
1877 | case REGULATOR_MODE_FAST: | ||
1878 | return REGULATOR_STATUS_FAST; | ||
1879 | case REGULATOR_MODE_NORMAL: | ||
1880 | return REGULATOR_STATUS_NORMAL; | ||
1881 | case REGULATOR_MODE_IDLE: | ||
1882 | return REGULATOR_STATUS_IDLE; | ||
1883 | case REGULATOR_STATUS_STANDBY: | ||
1884 | return REGULATOR_STATUS_STANDBY; | ||
1885 | default: | ||
1886 | return 0; | ||
1887 | } | ||
1888 | } | ||
1889 | EXPORT_SYMBOL_GPL(regulator_mode_to_status); | ||
1890 | |||
1867 | /* | 1891 | /* |
1868 | * To avoid cluttering sysfs (and memory) with useless state, only | 1892 | * To avoid cluttering sysfs (and memory) with useless state, only |
1869 | * create attributes that can be meaningfully displayed. | 1893 | * create attributes that can be meaningfully displayed. |