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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
#ifndef __REGULATOR_H
#define __REGULATOR_H
/* struct regulator is an opaque object for consumers */
struct regulator;
struct regulator_desc {
unsigned n_voltages;
const struct regulator_ops *ops;
unsigned int min_uV;
unsigned int uV_step;
unsigned int linear_min_sel;
unsigned int vsel_reg;
unsigned int vsel_mask;
unsigned int apply_reg;
unsigned int apply_bit;
unsigned int enable_reg;
unsigned int enable_mask;
unsigned int enable_val;
unsigned int disable_val;
bool enable_is_inverted;
};
struct regulator_dev {
const struct regulator_desc *desc;
struct regmap *regmap;
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 *);
int (*list_voltage) (struct regulator_dev *, unsigned int);
int (*set_voltage_sel) (struct regulator_dev *, unsigned int);
};
#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 *);
int regulator_is_enabled_regmap(struct regulator_dev *);
int regulator_enable_regmap(struct regulator_dev *);
int regulator_disable_regmap(struct regulator_dev *);
int regulator_set_voltage_sel_regmap(struct regulator_dev *, unsigned);
int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
int regulator_map_voltage_linear(struct regulator_dev *rdev,
int min_uV, int max_uV);
int regulator_list_voltage_linear(struct regulator_dev *rdev,
unsigned int selector);
#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;
}
static inline int regulator_set_voltage(struct regulator *regulator,
int min_uV, int max_uV)
{
return 0;
}
#endif
#endif /* __REGULATOR_H */
|