1 /*
2  * Copyright (C) ST-Ericsson SA 2010
3  *
4  * License Terms: GNU General Public License v2
5  *
6  * Authors: Sundar Iyer <sundar.iyer@stericsson.com> for ST-Ericsson
7  *          Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson
8  *          Daniel Willerud <daniel.willerud@stericsson.com> for ST-Ericsson
9  */
10 
11 #ifndef __LINUX_MFD_AB8500_REGULATOR_H
12 #define __LINUX_MFD_AB8500_REGULATOR_H
13 
14 #include <linux/platform_device.h>
15 
16 /* AB8500 regulators */
17 enum ab8500_regulator_id {
18 	AB8500_LDO_AUX1,
19 	AB8500_LDO_AUX2,
20 	AB8500_LDO_AUX3,
21 	AB8500_LDO_INTCORE,
22 	AB8500_LDO_TVOUT,
23 	AB8500_LDO_AUDIO,
24 	AB8500_LDO_ANAMIC1,
25 	AB8500_LDO_ANAMIC2,
26 	AB8500_LDO_DMIC,
27 	AB8500_LDO_ANA,
28 	AB8500_NUM_REGULATORS,
29 };
30 
31 /* AB8505 regulators */
32 enum ab8505_regulator_id {
33 	AB8505_LDO_AUX1,
34 	AB8505_LDO_AUX2,
35 	AB8505_LDO_AUX3,
36 	AB8505_LDO_AUX4,
37 	AB8505_LDO_AUX5,
38 	AB8505_LDO_AUX6,
39 	AB8505_LDO_INTCORE,
40 	AB8505_LDO_ADC,
41 	AB8505_LDO_AUDIO,
42 	AB8505_LDO_ANAMIC1,
43 	AB8505_LDO_ANAMIC2,
44 	AB8505_LDO_AUX8,
45 	AB8505_LDO_ANA,
46 	AB8505_NUM_REGULATORS,
47 };
48 
49 /* AB8500 and AB8505 register initialization */
50 struct ab8500_regulator_reg_init {
51 	int id;
52 	u8 mask;
53 	u8 value;
54 };
55 
56 #define INIT_REGULATOR_REGISTER(_id, _mask, _value)	\
57 	{						\
58 		.id = _id,				\
59 		.mask = _mask,				\
60 		.value = _value,			\
61 	}
62 
63 /* AB8500 registers */
64 enum ab8500_regulator_reg {
65 	AB8500_REGUREQUESTCTRL2,
66 	AB8500_REGUREQUESTCTRL3,
67 	AB8500_REGUREQUESTCTRL4,
68 	AB8500_REGUSYSCLKREQ1HPVALID1,
69 	AB8500_REGUSYSCLKREQ1HPVALID2,
70 	AB8500_REGUHWHPREQ1VALID1,
71 	AB8500_REGUHWHPREQ1VALID2,
72 	AB8500_REGUHWHPREQ2VALID1,
73 	AB8500_REGUHWHPREQ2VALID2,
74 	AB8500_REGUSWHPREQVALID1,
75 	AB8500_REGUSWHPREQVALID2,
76 	AB8500_REGUSYSCLKREQVALID1,
77 	AB8500_REGUSYSCLKREQVALID2,
78 	AB8500_REGUMISC1,
79 	AB8500_VAUDIOSUPPLY,
80 	AB8500_REGUCTRL1VAMIC,
81 	AB8500_VPLLVANAREGU,
82 	AB8500_VREFDDR,
83 	AB8500_EXTSUPPLYREGU,
84 	AB8500_VAUX12REGU,
85 	AB8500_VRF1VAUX3REGU,
86 	AB8500_VAUX1SEL,
87 	AB8500_VAUX2SEL,
88 	AB8500_VRF1VAUX3SEL,
89 	AB8500_REGUCTRL2SPARE,
90 	AB8500_REGUCTRLDISCH,
91 	AB8500_REGUCTRLDISCH2,
92 	AB8500_NUM_REGULATOR_REGISTERS,
93 };
94 
95 /* AB8505 registers */
96 enum ab8505_regulator_reg {
97 	AB8505_REGUREQUESTCTRL1,
98 	AB8505_REGUREQUESTCTRL2,
99 	AB8505_REGUREQUESTCTRL3,
100 	AB8505_REGUREQUESTCTRL4,
101 	AB8505_REGUSYSCLKREQ1HPVALID1,
102 	AB8505_REGUSYSCLKREQ1HPVALID2,
103 	AB8505_REGUHWHPREQ1VALID1,
104 	AB8505_REGUHWHPREQ1VALID2,
105 	AB8505_REGUHWHPREQ2VALID1,
106 	AB8505_REGUHWHPREQ2VALID2,
107 	AB8505_REGUSWHPREQVALID1,
108 	AB8505_REGUSWHPREQVALID2,
109 	AB8505_REGUSYSCLKREQVALID1,
110 	AB8505_REGUSYSCLKREQVALID2,
111 	AB8505_REGUVAUX4REQVALID,
112 	AB8505_REGUMISC1,
113 	AB8505_VAUDIOSUPPLY,
114 	AB8505_REGUCTRL1VAMIC,
115 	AB8505_VSMPSAREGU,
116 	AB8505_VSMPSBREGU,
117 	AB8505_VSAFEREGU, /* NOTE! PRCMU register */
118 	AB8505_VPLLVANAREGU,
119 	AB8505_EXTSUPPLYREGU,
120 	AB8505_VAUX12REGU,
121 	AB8505_VRF1VAUX3REGU,
122 	AB8505_VSMPSASEL1,
123 	AB8505_VSMPSASEL2,
124 	AB8505_VSMPSASEL3,
125 	AB8505_VSMPSBSEL1,
126 	AB8505_VSMPSBSEL2,
127 	AB8505_VSMPSBSEL3,
128 	AB8505_VSAFESEL1, /* NOTE! PRCMU register */
129 	AB8505_VSAFESEL2, /* NOTE! PRCMU register */
130 	AB8505_VSAFESEL3, /* NOTE! PRCMU register */
131 	AB8505_VAUX1SEL,
132 	AB8505_VAUX2SEL,
133 	AB8505_VRF1VAUX3SEL,
134 	AB8505_VAUX4REQCTRL,
135 	AB8505_VAUX4REGU,
136 	AB8505_VAUX4SEL,
137 	AB8505_REGUCTRLDISCH,
138 	AB8505_REGUCTRLDISCH2,
139 	AB8505_REGUCTRLDISCH3,
140 	AB8505_CTRLVAUX5,
141 	AB8505_CTRLVAUX6,
142 	AB8505_NUM_REGULATOR_REGISTERS,
143 };
144 
145 /* AB8500 external regulators */
146 struct ab8500_ext_regulator_cfg {
147 	bool hwreq; /* requires hw mode or high power mode */
148 };
149 
150 enum ab8500_ext_regulator_id {
151 	AB8500_EXT_SUPPLY1,
152 	AB8500_EXT_SUPPLY2,
153 	AB8500_EXT_SUPPLY3,
154 	AB8500_NUM_EXT_REGULATORS,
155 };
156 
157 /* AB8500 regulator platform data */
158 struct ab8500_regulator_platform_data {
159 	int num_reg_init;
160 	struct ab8500_regulator_reg_init *reg_init;
161 	int num_regulator;
162 	struct regulator_init_data *regulator;
163 	int num_ext_regulator;
164 	struct regulator_init_data *ext_regulator;
165 };
166 
167 #endif
168