From e0e52b83307ec037912c5c9e762ce6e1ea3b1740 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Wed, 6 Nov 2019 08:11:49 +0100 Subject: 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 Signed-off-by: Ahmad Fatoum Signed-off-by: Sascha Hauer --- include/linux/regulator/of_regulator.h | 48 ++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 include/linux/regulator/of_regulator.h (limited to 'include/linux/regulator/of_regulator.h') 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 + +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 */ -- cgit v1.2.3