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