barebox/include/regulator.h
Sascha Hauer 485788954c Add initial regulator support
Provide minimal regulator support. Only supported operations are enabling
and disabling regulators. Association of devices with their regulators is
limited to devicetree only. If regulator support is disabled the API expands
to static inline stubs so consumers can still use the API.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-04-29 08:01:32 +02:00

48 lines
940 B
C

#ifndef __REGULATOR_H
#define __REGULATOR_H
/* struct regulator is an opaque object for consumers */
struct regulator;
struct regulator_dev {
struct regulator_ops *ops;
};
struct regulator_ops {
/* enable/disable regulator */
int (*enable) (struct regulator_dev *);
int (*disable) (struct regulator_dev *);
int (*is_enabled) (struct regulator_dev *);
};
int of_regulator_register(struct regulator_dev *rd, struct device_node *node);
void regulators_print(void);
#ifdef CONFIG_REGULATOR
struct regulator *regulator_get(struct device_d *, const char *);
int regulator_enable(struct regulator *);
int regulator_disable(struct regulator *);
#else
static inline struct regulator *regulator_get(struct device_d *dev, const char *id)
{
return NULL;
}
static inline int regulator_enable(struct regulator *r)
{
return 0;
}
static inline int regulator_disable(struct regulator *r)
{
return 0;
}
#endif
#endif /* __REGULATOR_H */