1
2
3
4
5
6
7
8
9
10 #ifndef __MFD_WM831X_AUXADC_H__
11 #define __MFD_WM831X_AUXADC_H__
12
13 struct wm831x;
14
15
16
17
18 #define WM831X_AUX_DATA_SRC_MASK 0xF000
19 #define WM831X_AUX_DATA_SRC_SHIFT 12
20 #define WM831X_AUX_DATA_SRC_WIDTH 4
21 #define WM831X_AUX_DATA_MASK 0x0FFF
22 #define WM831X_AUX_DATA_SHIFT 0
23 #define WM831X_AUX_DATA_WIDTH 12
24
25
26
27
28 #define WM831X_AUX_ENA 0x8000
29 #define WM831X_AUX_ENA_MASK 0x8000
30 #define WM831X_AUX_ENA_SHIFT 15
31 #define WM831X_AUX_ENA_WIDTH 1
32 #define WM831X_AUX_CVT_ENA 0x4000
33 #define WM831X_AUX_CVT_ENA_MASK 0x4000
34 #define WM831X_AUX_CVT_ENA_SHIFT 14
35 #define WM831X_AUX_CVT_ENA_WIDTH 1
36 #define WM831X_AUX_SLPENA 0x1000
37 #define WM831X_AUX_SLPENA_MASK 0x1000
38 #define WM831X_AUX_SLPENA_SHIFT 12
39 #define WM831X_AUX_SLPENA_WIDTH 1
40 #define WM831X_AUX_FRC_ENA 0x0800
41 #define WM831X_AUX_FRC_ENA_MASK 0x0800
42 #define WM831X_AUX_FRC_ENA_SHIFT 11
43 #define WM831X_AUX_FRC_ENA_WIDTH 1
44 #define WM831X_AUX_RATE_MASK 0x003F
45 #define WM831X_AUX_RATE_SHIFT 0
46 #define WM831X_AUX_RATE_WIDTH 6
47
48
49
50
51 #define WM831X_AUX_CAL_SEL 0x8000
52 #define WM831X_AUX_CAL_SEL_MASK 0x8000
53 #define WM831X_AUX_CAL_SEL_SHIFT 15
54 #define WM831X_AUX_CAL_SEL_WIDTH 1
55 #define WM831X_AUX_BKUP_BATT_SEL 0x0400
56 #define WM831X_AUX_BKUP_BATT_SEL_MASK 0x0400
57 #define WM831X_AUX_BKUP_BATT_SEL_SHIFT 10
58 #define WM831X_AUX_BKUP_BATT_SEL_WIDTH 1
59 #define WM831X_AUX_WALL_SEL 0x0200
60 #define WM831X_AUX_WALL_SEL_MASK 0x0200
61 #define WM831X_AUX_WALL_SEL_SHIFT 9
62 #define WM831X_AUX_WALL_SEL_WIDTH 1
63 #define WM831X_AUX_BATT_SEL 0x0100
64 #define WM831X_AUX_BATT_SEL_MASK 0x0100
65 #define WM831X_AUX_BATT_SEL_SHIFT 8
66 #define WM831X_AUX_BATT_SEL_WIDTH 1
67 #define WM831X_AUX_USB_SEL 0x0080
68 #define WM831X_AUX_USB_SEL_MASK 0x0080
69 #define WM831X_AUX_USB_SEL_SHIFT 7
70 #define WM831X_AUX_USB_SEL_WIDTH 1
71 #define WM831X_AUX_SYSVDD_SEL 0x0040
72 #define WM831X_AUX_SYSVDD_SEL_MASK 0x0040
73 #define WM831X_AUX_SYSVDD_SEL_SHIFT 6
74 #define WM831X_AUX_SYSVDD_SEL_WIDTH 1
75 #define WM831X_AUX_BATT_TEMP_SEL 0x0020
76 #define WM831X_AUX_BATT_TEMP_SEL_MASK 0x0020
77 #define WM831X_AUX_BATT_TEMP_SEL_SHIFT 5
78 #define WM831X_AUX_BATT_TEMP_SEL_WIDTH 1
79 #define WM831X_AUX_CHIP_TEMP_SEL 0x0010
80 #define WM831X_AUX_CHIP_TEMP_SEL_MASK 0x0010
81 #define WM831X_AUX_CHIP_TEMP_SEL_SHIFT 4
82 #define WM831X_AUX_CHIP_TEMP_SEL_WIDTH 1
83 #define WM831X_AUX_AUX4_SEL 0x0008
84 #define WM831X_AUX_AUX4_SEL_MASK 0x0008
85 #define WM831X_AUX_AUX4_SEL_SHIFT 3
86 #define WM831X_AUX_AUX4_SEL_WIDTH 1
87 #define WM831X_AUX_AUX3_SEL 0x0004
88 #define WM831X_AUX_AUX3_SEL_MASK 0x0004
89 #define WM831X_AUX_AUX3_SEL_SHIFT 2
90 #define WM831X_AUX_AUX3_SEL_WIDTH 1
91 #define WM831X_AUX_AUX2_SEL 0x0002
92 #define WM831X_AUX_AUX2_SEL_MASK 0x0002
93 #define WM831X_AUX_AUX2_SEL_SHIFT 1
94 #define WM831X_AUX_AUX2_SEL_WIDTH 1
95 #define WM831X_AUX_AUX1_SEL 0x0001
96 #define WM831X_AUX_AUX1_SEL_MASK 0x0001
97 #define WM831X_AUX_AUX1_SEL_SHIFT 0
98 #define WM831X_AUX_AUX1_SEL_WIDTH 1
99
100
101
102
103 #define WM831X_DCOMP4_STS 0x0800
104 #define WM831X_DCOMP4_STS_MASK 0x0800
105 #define WM831X_DCOMP4_STS_SHIFT 11
106 #define WM831X_DCOMP4_STS_WIDTH 1
107 #define WM831X_DCOMP3_STS 0x0400
108 #define WM831X_DCOMP3_STS_MASK 0x0400
109 #define WM831X_DCOMP3_STS_SHIFT 10
110 #define WM831X_DCOMP3_STS_WIDTH 1
111 #define WM831X_DCOMP2_STS 0x0200
112 #define WM831X_DCOMP2_STS_MASK 0x0200
113 #define WM831X_DCOMP2_STS_SHIFT 9
114 #define WM831X_DCOMP2_STS_WIDTH 1
115 #define WM831X_DCOMP1_STS 0x0100
116 #define WM831X_DCOMP1_STS_MASK 0x0100
117 #define WM831X_DCOMP1_STS_SHIFT 8
118 #define WM831X_DCOMP1_STS_WIDTH 1
119 #define WM831X_DCMP4_ENA 0x0008
120 #define WM831X_DCMP4_ENA_MASK 0x0008
121 #define WM831X_DCMP4_ENA_SHIFT 3
122 #define WM831X_DCMP4_ENA_WIDTH 1
123 #define WM831X_DCMP3_ENA 0x0004
124 #define WM831X_DCMP3_ENA_MASK 0x0004
125 #define WM831X_DCMP3_ENA_SHIFT 2
126 #define WM831X_DCMP3_ENA_WIDTH 1
127 #define WM831X_DCMP2_ENA 0x0002
128 #define WM831X_DCMP2_ENA_MASK 0x0002
129 #define WM831X_DCMP2_ENA_SHIFT 1
130 #define WM831X_DCMP2_ENA_WIDTH 1
131 #define WM831X_DCMP1_ENA 0x0001
132 #define WM831X_DCMP1_ENA_MASK 0x0001
133 #define WM831X_DCMP1_ENA_SHIFT 0
134 #define WM831X_DCMP1_ENA_WIDTH 1
135
136
137
138
139 #define WM831X_DCMP1_SRC_MASK 0xE000
140 #define WM831X_DCMP1_SRC_SHIFT 13
141 #define WM831X_DCMP1_SRC_WIDTH 3
142 #define WM831X_DCMP1_GT 0x1000
143 #define WM831X_DCMP1_GT_MASK 0x1000
144 #define WM831X_DCMP1_GT_SHIFT 12
145 #define WM831X_DCMP1_GT_WIDTH 1
146 #define WM831X_DCMP1_THR_MASK 0x0FFF
147 #define WM831X_DCMP1_THR_SHIFT 0
148 #define WM831X_DCMP1_THR_WIDTH 12
149
150
151
152
153 #define WM831X_DCMP2_SRC_MASK 0xE000
154 #define WM831X_DCMP2_SRC_SHIFT 13
155 #define WM831X_DCMP2_SRC_WIDTH 3
156 #define WM831X_DCMP2_GT 0x1000
157 #define WM831X_DCMP2_GT_MASK 0x1000
158 #define WM831X_DCMP2_GT_SHIFT 12
159 #define WM831X_DCMP2_GT_WIDTH 1
160 #define WM831X_DCMP2_THR_MASK 0x0FFF
161 #define WM831X_DCMP2_THR_SHIFT 0
162 #define WM831X_DCMP2_THR_WIDTH 12
163
164
165
166
167 #define WM831X_DCMP3_SRC_MASK 0xE000
168 #define WM831X_DCMP3_SRC_SHIFT 13
169 #define WM831X_DCMP3_SRC_WIDTH 3
170 #define WM831X_DCMP3_GT 0x1000
171 #define WM831X_DCMP3_GT_MASK 0x1000
172 #define WM831X_DCMP3_GT_SHIFT 12
173 #define WM831X_DCMP3_GT_WIDTH 1
174 #define WM831X_DCMP3_THR_MASK 0x0FFF
175 #define WM831X_DCMP3_THR_SHIFT 0
176 #define WM831X_DCMP3_THR_WIDTH 12
177
178
179
180
181 #define WM831X_DCMP4_SRC_MASK 0xE000
182 #define WM831X_DCMP4_SRC_SHIFT 13
183 #define WM831X_DCMP4_SRC_WIDTH 3
184 #define WM831X_DCMP4_GT 0x1000
185 #define WM831X_DCMP4_GT_MASK 0x1000
186 #define WM831X_DCMP4_GT_SHIFT 12
187 #define WM831X_DCMP4_GT_WIDTH 1
188 #define WM831X_DCMP4_THR_MASK 0x0FFF
189 #define WM831X_DCMP4_THR_SHIFT 0
190 #define WM831X_DCMP4_THR_WIDTH 12
191
192 #define WM831X_AUX_CAL_FACTOR 0xfff
193 #define WM831X_AUX_CAL_NOMINAL 0x222
194
195 enum wm831x_auxadc {
196 WM831X_AUX_CAL = 15,
197 WM831X_AUX_BKUP_BATT = 10,
198 WM831X_AUX_WALL = 9,
199 WM831X_AUX_BATT = 8,
200 WM831X_AUX_USB = 7,
201 WM831X_AUX_SYSVDD = 6,
202 WM831X_AUX_BATT_TEMP = 5,
203 WM831X_AUX_CHIP_TEMP = 4,
204 WM831X_AUX_AUX4 = 3,
205 WM831X_AUX_AUX3 = 2,
206 WM831X_AUX_AUX2 = 1,
207 WM831X_AUX_AUX1 = 0,
208 };
209
210 int wm831x_auxadc_read(struct wm831x *wm831x, enum wm831x_auxadc input);
211 int wm831x_auxadc_read_uv(struct wm831x *wm831x, enum wm831x_auxadc input);
212
213 #endif