summaryrefslogtreecommitdiff
path: root/include/power
diff options
context:
space:
mode:
authorPrzemyslaw Marczak <p.marczak@samsung.com>2015-10-27 13:07:59 +0100
committerMinkyu Kang <mk7.kang@samsung.com>2015-11-02 10:38:00 +0900
commit7c816e24a4e980e2717e5c83090dec73bc4eac57 (patch)
tree74c43945c673449ce4a91adb1d4a596202aa8036 /include/power
parent35d460fbc8ced954fe23812e706d3eebc1dd2b4d (diff)
dm: regulator: add function device_get_supply_regulator()
Some devices are supplied by configurable regulator's output. But there was no function for getting it. This commit adds function, that allows for getting the supply device by it's phandle. The returned regulator device can be used with regulator uclass's API. Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
Diffstat (limited to 'include/power')
-rw-r--r--include/power/regulator.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/power/regulator.h b/include/power/regulator.h
index 1a51c3f07b..63c0814fe8 100644
--- a/include/power/regulator.h
+++ b/include/power/regulator.h
@@ -419,4 +419,20 @@ int regulator_get_by_devname(const char *devname, struct udevice **devp);
*/
int regulator_get_by_platname(const char *platname, struct udevice **devp);
+/**
+ * device_get_supply_regulator: returns the pointer to the supply regulator.
+ * Search by phandle, found in device's node.
+ *
+ * Note: Please pay attention to proper order of device bind sequence.
+ * The regulator device searched by the phandle, must be binded before
+ * this function call.
+ *
+ * @dev - device with supply phandle
+ * @supply_name - phandle name of regulator
+ * @devp - returned pointer to the supply device
+ * @return 0 on success or negative value of errno.
+ */
+int device_get_supply_regulator(struct udevice *dev, const char *supply_name,
+ struct udevice **devp);
+
#endif /* _INCLUDE_REGULATOR_H_ */