1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * OpenFirmware regulator support routines
4 *
5 */
6
7#ifndef __LINUX_OF_REG_H
8#define __LINUX_OF_REG_H
9
10struct regulator_desc;
11
12struct of_regulator_match {
13	const char *name;
14	void *driver_data;
15	struct regulator_init_data *init_data;
16	struct device_node *of_node;
17	const struct regulator_desc *desc;
18};
19
20#if defined(CONFIG_OF)
21extern struct regulator_init_data
22	*of_get_regulator_init_data(struct device *dev,
23				    struct device_node *node,
24				    const struct regulator_desc *desc);
25extern int of_regulator_match(struct device *dev, struct device_node *node,
26			      struct of_regulator_match *matches,
27			      unsigned int num_matches);
28#else
29static inline struct regulator_init_data
30	*of_get_regulator_init_data(struct device *dev,
31				    struct device_node *node,
32				    const struct regulator_desc *desc)
33{
34	return NULL;
35}
36
37static inline int of_regulator_match(struct device *dev,
38				     struct device_node *node,
39				     struct of_regulator_match *matches,
40				     unsigned int num_matches)
41{
42	return 0;
43}
44#endif /* CONFIG_OF */
45
46#endif /* __LINUX_OF_REG_H */
47