summaryrefslogtreecommitdiff
path: root/include/linux/regulator
diff options
context:
space:
mode:
authorDavid Lechner <dlechner@baylibre.com>2024-04-30 02:40:09 +0300
committerMark Brown <broonie@kernel.org>2024-05-03 05:08:12 +0300
commitb250c20b64290808aa4b5cc6d68819a7ee28237f (patch)
tree95f6ddc9481edc67258cf16f10392324d495f13f /include/linux/regulator
parentfec50db7033ea478773b159e0e2efb135270e3b7 (diff)
downloadlinux-b250c20b64290808aa4b5cc6d68819a7ee28237f.tar.xz
regulator: devres: add API for reference voltage supplies
A common use case for regulators is to supply a reference voltage to an analog input or output device. This adds a new devres API to get, enable, and get the voltage in a single call. This allows eliminating boilerplate code in drivers that use reference supplies in this way. Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://lore.kernel.org/r/20240429-regulator-get-enable-get-votlage-v2-1-b1f11ab766c1@baylibre.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include/linux/regulator')
-rw-r--r--include/linux/regulator/consumer.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 4660582a3302..6f41a11c92e7 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -164,6 +164,7 @@ struct regulator *__must_check devm_regulator_get_optional(struct device *dev,
const char *id);
int devm_regulator_get_enable(struct device *dev, const char *id);
int devm_regulator_get_enable_optional(struct device *dev, const char *id);
+int devm_regulator_get_enable_read_voltage(struct device *dev, const char *id);
void regulator_put(struct regulator *regulator);
void devm_regulator_put(struct regulator *regulator);
@@ -329,6 +330,12 @@ static inline int devm_regulator_get_enable_optional(struct device *dev,
return -ENODEV;
}
+static inline int devm_regulator_get_enable_read_voltage(struct device *dev,
+ const char *id)
+{
+ return -ENODEV;
+}
+
static inline struct regulator *__must_check
regulator_get_optional(struct device *dev, const char *id)
{