diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2019-11-06 08:11:49 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-11-06 11:22:36 +0100 |
commit | e0e52b83307ec037912c5c9e762ce6e1ea3b1740 (patch) | |
tree | d7385d7c9e62306e1fd70bab722c3396f405e475 /include/linux/regulator/of_regulator.h | |
parent | 764cc5cb7659c06f5818d95d2e20257006aefb0a (diff) | |
download | barebox-e0e52b83307ec037912c5c9e762ce6e1ea3b1740.tar.gz barebox-e0e52b83307ec037912c5c9e762ce6e1ea3b1740.tar.xz |
regulator: port Linux of_regulator_match
Linux regulator drivers like the pfuze and the incoming stpmic make use
of of_regulator_match to parse regulator init data from the device tree.
Port the function over from Linux v5.3, so drivers depending on it can
follow.
As we have no use in barebox for power saving and suspend states, these
parts are omitted.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/linux/regulator/of_regulator.h')
-rw-r--r-- | include/linux/regulator/of_regulator.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/include/linux/regulator/of_regulator.h b/include/linux/regulator/of_regulator.h new file mode 100644 index 0000000000..265b98d1ee --- /dev/null +++ b/include/linux/regulator/of_regulator.h @@ -0,0 +1,48 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * OpenFirmware regulator support routines + */ + +#ifndef __LINUX_OF_REG_H +#define __LINUX_OF_REG_H + +#include <linux/types.h> + +struct device_d; +struct regulator_desc; + +struct of_regulator_match { + const char *name; + void *driver_data; + struct regulator_init_data *init_data; + struct device_node *of_node; + const struct regulator_desc *desc; +}; + +#if defined(CONFIG_OFDEVICE) +extern struct regulator_init_data + *of_get_regulator_init_data(struct device_d *dev, + struct device_node *node, + const struct regulator_desc *desc); +extern int of_regulator_match(struct device_d *dev, struct device_node *node, + struct of_regulator_match *matches, + unsigned int num_matches); +#else +static inline struct regulator_init_data + *of_get_regulator_init_data(struct device_d *dev, + struct device_node *node, + const struct regulator_desc *desc) +{ + return NULL; +} + +static inline int of_regulator_match(struct device_d *dev, + struct device_node *node, + struct of_regulator_match *matches, + unsigned int num_matches) +{ + return 0; +} +#endif /* CONFIG_OF */ + +#endif /* __LINUX_OF_REG_H */ |