summaryrefslogtreecommitdiffstats
path: root/include/regulator.h
blob: 367e13f05b22622674ccb1a72049f3d88a6663db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef __REGULATOR_H
#define __REGULATOR_H

/* struct regulator is an opaque object for consumers */
struct regulator;

struct regulator_dev {
	struct regulator_ops *ops;
	int boot_on;
};

struct regulator_ops {
	/* enable/disable regulator */
	int (*enable) (struct regulator_dev *);
	int (*disable) (struct regulator_dev *);
	int (*is_enabled) (struct regulator_dev *);
};

#ifdef CONFIG_OFDEVICE
int of_regulator_register(struct regulator_dev *rd, struct device_node *node);
#else
static inline int of_regulator_register(struct regulator_dev *rd,
					struct device_node *node)
{
	return -ENOSYS;
}
#endif
int dev_regulator_register(struct regulator_dev *rd, const char * name,
			   const char* supply);

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 */