diff options
author | Thierry Reding <thierry.reding@avionic-design.de> | 2012-04-26 10:52:20 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-05-04 08:25:15 -0400 |
commit | 1c8fa58f4750e9ad722fbf899866c312ffabab67 (patch) | |
tree | bd7aa14a3d78d17da9eb7c7638a66562f78b6f9f /include/linux/regulator | |
parent | 82caa9780a85a97e45e4df6e1f228279707bdcfe (diff) |
regulator: Add generic DT parsing for regulators
Looking up init data for regulators found on chips is a common operation
that can be handled in a generic way. The new helper function introduced
by this patch looks up the children of a given node by names specified
in a match table and fills that match table with information parsed from
the DT.
This is based on work by Rhyland Klein <rklein@nvidia.com>.
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'include/linux/regulator')
-rw-r--r-- | include/linux/regulator/of_regulator.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/regulator/of_regulator.h b/include/linux/regulator/of_regulator.h index 769704f296e5..f9217965aaa3 100644 --- a/include/linux/regulator/of_regulator.h +++ b/include/linux/regulator/of_regulator.h | |||
@@ -6,10 +6,20 @@ | |||
6 | #ifndef __LINUX_OF_REG_H | 6 | #ifndef __LINUX_OF_REG_H |
7 | #define __LINUX_OF_REG_H | 7 | #define __LINUX_OF_REG_H |
8 | 8 | ||
9 | struct of_regulator_match { | ||
10 | const char *name; | ||
11 | void *driver_data; | ||
12 | struct regulator_init_data *init_data; | ||
13 | struct device_node *of_node; | ||
14 | }; | ||
15 | |||
9 | #if defined(CONFIG_OF) | 16 | #if defined(CONFIG_OF) |
10 | extern struct regulator_init_data | 17 | extern struct regulator_init_data |
11 | *of_get_regulator_init_data(struct device *dev, | 18 | *of_get_regulator_init_data(struct device *dev, |
12 | struct device_node *node); | 19 | struct device_node *node); |
20 | extern int of_regulator_match(struct device *dev, struct device_node *node, | ||
21 | struct of_regulator_match *matches, | ||
22 | unsigned int num_matches); | ||
13 | #else | 23 | #else |
14 | static inline struct regulator_init_data | 24 | static inline struct regulator_init_data |
15 | *of_get_regulator_init_data(struct device *dev, | 25 | *of_get_regulator_init_data(struct device *dev, |
@@ -17,6 +27,14 @@ static inline struct regulator_init_data | |||
17 | { | 27 | { |
18 | return NULL; | 28 | return NULL; |
19 | } | 29 | } |
30 | |||
31 | static inline int of_regulator_match(struct device *dev, | ||
32 | struct device_node *node, | ||
33 | struct of_regulator_match *matches, | ||
34 | unsigned int num_matches) | ||
35 | { | ||
36 | return 0; | ||
37 | } | ||
20 | #endif /* CONFIG_OF */ | 38 | #endif /* CONFIG_OF */ |
21 | 39 | ||
22 | #endif /* __LINUX_OF_REG_H */ | 40 | #endif /* __LINUX_OF_REG_H */ |