mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-28 11:49:32 +00:00
![Javier Martinez Canillas](/assets/img/avatar_default.png)
Drivers can use the of_regulator_match() function to parse the regulator init_data from DT. A match table is used to specify the name of the node containing the regulators, the device node and to return the init_data to the caller. But also the static regulator descriptor is needed to correctly extract some DT properties like the regulator initial and suspend modes. Use the match table to pass that information. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
45 lines
1.1 KiB
C
45 lines
1.1 KiB
C
/*
|
|
* OpenFirmware regulator support routines
|
|
*
|
|
*/
|
|
|
|
#ifndef __LINUX_OF_REG_H
|
|
#define __LINUX_OF_REG_H
|
|
|
|
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_OF)
|
|
extern struct regulator_init_data
|
|
*of_get_regulator_init_data(struct device *dev,
|
|
struct device_node *node,
|
|
const struct regulator_desc *desc);
|
|
extern int of_regulator_match(struct device *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 *dev,
|
|
struct device_node *node,
|
|
const struct regulator_desc *desc)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline int of_regulator_match(struct device *dev,
|
|
struct device_node *node,
|
|
struct of_regulator_match *matches,
|
|
unsigned int num_matches)
|
|
{
|
|
return 0;
|
|
}
|
|
#endif /* CONFIG_OF */
|
|
|
|
#endif /* __LINUX_OF_REG_H */
|