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
96
97
98
99
100
|
/*
* linux/regulator/max77826-regulator.h
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef __LINUX_MAX77826_REGULATOR_H
#define __LINUX_MAX77826_REGULATOR_H
/*******************************************************************************
* Useful Macros
******************************************************************************/
#undef __CONST_FFS
#define __CONST_FFS(_x) \
((_x) & 0x0F ? ((_x) & 0x03 ? ((_x) & 0x01 ? 0 : 1) : \
((_x) & 0x04 ? 2 : 3)) : \
((_x) & 0x30 ? ((_x) & 0x10 ? 4 : 5) : \
((_x) & 0x40 ? 6 : 7)))
#undef BIT_RSVD
#define BIT_RSVD 0
#undef BITS
#define BITS(_end, _start) \
((BIT(_end) - BIT(_start)) + BIT(_end))
#undef __BITS_GET
#define __BITS_GET(_word, _mask, _shift) \
(((_word) & (_mask)) >> (_shift))
#undef BITS_GET
#define BITS_GET(_word, _bit) \
__BITS_GET(_word, _bit, FFS(_bit))
#undef __BITS_SET
#define __BITS_SET(_word, _mask, _shift, _val) \
(((_word) & ~(_mask)) | (((_val) << (_shift)) & (_mask)))
#undef BITS_SET
#define BITS_SET(_word, _bit, _val) \
__BITS_SET(_word, _bit, FFS(_bit), _val)
#undef BITS_MATCH
#define BITS_MATCH(_word, _bit) \
(((_word) & (_bit)) == (_bit))
enum max77826_reg_id {
MAX77826_LDO1 = 1,
MAX77826_LDO2,
MAX77826_LDO3,
MAX77826_LDO4,
MAX77826_LDO5,
MAX77826_LDO6,
MAX77826_LDO7,
MAX77826_LDO8,
MAX77826_LDO9,
MAX77826_LDO10,
MAX77826_LDO11,
MAX77826_LDO12,
MAX77826_LDO13,
MAX77826_LDO14,
MAX77826_LDO15,
MAX77826_LDO_MAX = MAX77826_LDO15,
MAX77826_BUCK,
MAX77826_BB,
MAX77826_REGULATORS = MAX77826_BB,
};
struct max77826_regulator_data {
int active_discharge_enable;
struct regulator_init_data *initdata;
struct device_node *of_node;
};
struct max77826_regulator_platform_data {
int num_regulators;
struct max77826_regulator_data *regulators;
int buck_ramp_rate;
int buck_fpwm;
int buck_fsrade;
int buck_ss;
int buck_freq;
int bb_ovp_th;
int bb_hskip;
int bb_fpwm;
int uvlo_fall_threshold;
};
#endif
|