]>
Commit | Line | Data |
---|---|---|
395d00d1 | 1 | /* |
7978b8a1 | 2 | * Montage Technology M88DS3103/M88RS6000 demodulator driver |
395d00d1 AP |
3 | * |
4 | * Copyright (C) 2013 Antti Palosaari <crope@iki.fi> | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation; either version 2 of the License, or | |
9 | * (at your option) any later version. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
395d00d1 AP |
15 | */ |
16 | ||
17 | #ifndef M88DS3103_PRIV_H | |
18 | #define M88DS3103_PRIV_H | |
19 | ||
20 | #include "dvb_frontend.h" | |
21 | #include "m88ds3103.h" | |
22 | #include "dvb_math.h" | |
23 | #include <linux/firmware.h> | |
44b9055b | 24 | #include <linux/i2c-mux.h> |
478932b1 | 25 | #include <linux/regmap.h> |
3ae266f8 | 26 | #include <linux/math64.h> |
395d00d1 AP |
27 | |
28 | #define M88DS3103_FIRMWARE "dvb-demod-m88ds3103.fw" | |
f4df95bc | 29 | #define M88RS6000_FIRMWARE "dvb-demod-m88rs6000.fw" |
f4df95bc | 30 | #define M88RS6000_CHIP_ID 0x74 |
31 | #define M88DS3103_CHIP_ID 0x70 | |
395d00d1 | 32 | |
7978b8a1 | 33 | struct m88ds3103_dev { |
f01919e8 | 34 | struct i2c_client *client; |
478932b1 AP |
35 | struct regmap_config regmap_config; |
36 | struct regmap *regmap; | |
f01919e8 | 37 | struct m88ds3103_config config; |
395d00d1 AP |
38 | const struct m88ds3103_config *cfg; |
39 | struct dvb_frontend fe; | |
0df289a2 MCC |
40 | enum fe_delivery_system delivery_system; |
41 | enum fe_status fe_status; | |
ce80d713 | 42 | u32 dvbv3_ber; /* for old DVBv3 API read_ber */ |
395d00d1 | 43 | bool warm; /* FW running */ |
e00fed40 | 44 | struct i2c_mux_core *muxc; |
f4df95bc | 45 | /* auto detect chip id to do different config */ |
46 | u8 chip_id; | |
47 | /* main mclk is calculated for M88RS6000 dynamically */ | |
f5d9b88d | 48 | s32 mclk; |
ce80d713 AP |
49 | u64 post_bit_error; |
50 | u64 post_bit_count; | |
395d00d1 AP |
51 | }; |
52 | ||
53 | struct m88ds3103_reg_val { | |
54 | u8 reg; | |
55 | u8 val; | |
56 | }; | |
57 | ||
58 | static const struct m88ds3103_reg_val m88ds3103_dvbs_init_reg_vals[] = { | |
59 | {0x23, 0x07}, | |
60 | {0x08, 0x03}, | |
61 | {0x0c, 0x02}, | |
62 | {0x21, 0x54}, | |
63 | {0x25, 0x8a}, | |
64 | {0x27, 0x31}, | |
65 | {0x30, 0x08}, | |
66 | {0x31, 0x40}, | |
67 | {0x32, 0x32}, | |
395d00d1 AP |
68 | {0x35, 0xff}, |
69 | {0x3a, 0x00}, | |
70 | {0x37, 0x10}, | |
71 | {0x38, 0x10}, | |
72 | {0x39, 0x02}, | |
73 | {0x42, 0x60}, | |
74 | {0x4a, 0x80}, | |
75 | {0x4b, 0x04}, | |
76 | {0x4d, 0x91}, | |
77 | {0x5d, 0xc8}, | |
78 | {0x50, 0x36}, | |
79 | {0x51, 0x36}, | |
80 | {0x52, 0x36}, | |
81 | {0x53, 0x36}, | |
dcaf0fbf | 82 | {0x56, 0x01}, |
395d00d1 AP |
83 | {0x63, 0x0f}, |
84 | {0x64, 0x30}, | |
85 | {0x65, 0x40}, | |
86 | {0x68, 0x26}, | |
87 | {0x69, 0x4c}, | |
88 | {0x70, 0x20}, | |
89 | {0x71, 0x70}, | |
90 | {0x72, 0x04}, | |
91 | {0x73, 0x00}, | |
92 | {0x70, 0x40}, | |
93 | {0x71, 0x70}, | |
94 | {0x72, 0x04}, | |
95 | {0x73, 0x00}, | |
96 | {0x70, 0x60}, | |
97 | {0x71, 0x70}, | |
98 | {0x72, 0x04}, | |
99 | {0x73, 0x00}, | |
100 | {0x70, 0x80}, | |
101 | {0x71, 0x70}, | |
102 | {0x72, 0x04}, | |
103 | {0x73, 0x00}, | |
104 | {0x70, 0xa0}, | |
105 | {0x71, 0x70}, | |
106 | {0x72, 0x04}, | |
107 | {0x73, 0x00}, | |
108 | {0x70, 0x1f}, | |
109 | {0x76, 0x38}, | |
110 | {0x77, 0xa6}, | |
111 | {0x78, 0x0c}, | |
112 | {0x79, 0x80}, | |
113 | {0x7f, 0x14}, | |
114 | {0x7c, 0x00}, | |
115 | {0xae, 0x82}, | |
116 | {0x80, 0x64}, | |
117 | {0x81, 0x66}, | |
118 | {0x82, 0x44}, | |
119 | {0x85, 0x04}, | |
120 | {0xcd, 0xf4}, | |
121 | {0x90, 0x33}, | |
122 | {0xa0, 0x44}, | |
123 | {0xc0, 0x08}, | |
124 | {0xc3, 0x10}, | |
125 | {0xc4, 0x08}, | |
126 | {0xc5, 0xf0}, | |
127 | {0xc6, 0xff}, | |
128 | {0xc7, 0x00}, | |
129 | {0xc8, 0x1a}, | |
130 | {0xc9, 0x80}, | |
131 | {0xe0, 0xf8}, | |
132 | {0xe6, 0x8b}, | |
133 | {0xd0, 0x40}, | |
134 | {0xf8, 0x20}, | |
135 | {0xfa, 0x0f}, | |
136 | {0x00, 0x00}, | |
137 | {0xbd, 0x01}, | |
138 | {0xb8, 0x00}, | |
139 | }; | |
140 | ||
141 | static const struct m88ds3103_reg_val m88ds3103_dvbs2_init_reg_vals[] = { | |
142 | {0x23, 0x07}, | |
143 | {0x08, 0x07}, | |
144 | {0x0c, 0x02}, | |
145 | {0x21, 0x54}, | |
146 | {0x25, 0x8a}, | |
147 | {0x27, 0x31}, | |
148 | {0x30, 0x08}, | |
149 | {0x32, 0x32}, | |
395d00d1 AP |
150 | {0x35, 0xff}, |
151 | {0x3a, 0x00}, | |
152 | {0x37, 0x10}, | |
153 | {0x38, 0x10}, | |
154 | {0x39, 0x02}, | |
155 | {0x42, 0x60}, | |
156 | {0x4a, 0x80}, | |
157 | {0x4b, 0x04}, | |
158 | {0x4d, 0x91}, | |
159 | {0x5d, 0xc8}, | |
160 | {0x50, 0x36}, | |
161 | {0x51, 0x36}, | |
162 | {0x52, 0x36}, | |
163 | {0x53, 0x36}, | |
dcaf0fbf | 164 | {0x56, 0x01}, |
395d00d1 AP |
165 | {0x63, 0x0f}, |
166 | {0x64, 0x10}, | |
167 | {0x65, 0x20}, | |
168 | {0x68, 0x46}, | |
169 | {0x69, 0xcd}, | |
170 | {0x70, 0x20}, | |
171 | {0x71, 0x70}, | |
172 | {0x72, 0x04}, | |
173 | {0x73, 0x00}, | |
174 | {0x70, 0x40}, | |
175 | {0x71, 0x70}, | |
176 | {0x72, 0x04}, | |
177 | {0x73, 0x00}, | |
178 | {0x70, 0x60}, | |
179 | {0x71, 0x70}, | |
180 | {0x72, 0x04}, | |
181 | {0x73, 0x00}, | |
182 | {0x70, 0x80}, | |
183 | {0x71, 0x70}, | |
184 | {0x72, 0x04}, | |
185 | {0x73, 0x00}, | |
186 | {0x70, 0xa0}, | |
187 | {0x71, 0x70}, | |
188 | {0x72, 0x04}, | |
189 | {0x73, 0x00}, | |
190 | {0x70, 0x1f}, | |
191 | {0x76, 0x38}, | |
192 | {0x77, 0xa6}, | |
193 | {0x78, 0x0c}, | |
194 | {0x79, 0x80}, | |
195 | {0x7f, 0x14}, | |
196 | {0x85, 0x08}, | |
197 | {0xcd, 0xf4}, | |
198 | {0x90, 0x33}, | |
199 | {0x86, 0x00}, | |
200 | {0x87, 0x0f}, | |
201 | {0x89, 0x00}, | |
202 | {0x8b, 0x44}, | |
203 | {0x8c, 0x66}, | |
204 | {0x9d, 0xc1}, | |
205 | {0x8a, 0x10}, | |
206 | {0xad, 0x40}, | |
207 | {0xa0, 0x44}, | |
208 | {0xc0, 0x08}, | |
209 | {0xc1, 0x10}, | |
210 | {0xc2, 0x08}, | |
211 | {0xc3, 0x10}, | |
212 | {0xc4, 0x08}, | |
213 | {0xc5, 0xf0}, | |
214 | {0xc6, 0xff}, | |
215 | {0xc7, 0x00}, | |
216 | {0xc8, 0x1a}, | |
217 | {0xc9, 0x80}, | |
218 | {0xca, 0x23}, | |
219 | {0xcb, 0x24}, | |
220 | {0xcc, 0xf4}, | |
221 | {0xce, 0x74}, | |
222 | {0x00, 0x00}, | |
223 | {0xbd, 0x01}, | |
224 | {0xb8, 0x00}, | |
225 | }; | |
226 | ||
f4df95bc | 227 | static const struct m88ds3103_reg_val m88rs6000_dvbs_init_reg_vals[] = { |
228 | {0x23, 0x07}, | |
229 | {0x08, 0x03}, | |
230 | {0x0c, 0x02}, | |
231 | {0x20, 0x00}, | |
232 | {0x21, 0x54}, | |
233 | {0x25, 0x82}, | |
234 | {0x27, 0x31}, | |
235 | {0x30, 0x08}, | |
236 | {0x31, 0x40}, | |
237 | {0x32, 0x32}, | |
238 | {0x33, 0x35}, | |
239 | {0x35, 0xff}, | |
240 | {0x3a, 0x00}, | |
241 | {0x37, 0x10}, | |
242 | {0x38, 0x10}, | |
243 | {0x39, 0x02}, | |
244 | {0x42, 0x60}, | |
245 | {0x4a, 0x80}, | |
246 | {0x4b, 0x04}, | |
247 | {0x4d, 0x91}, | |
248 | {0x5d, 0xc8}, | |
249 | {0x50, 0x36}, | |
250 | {0x51, 0x36}, | |
251 | {0x52, 0x36}, | |
252 | {0x53, 0x36}, | |
253 | {0x63, 0x0f}, | |
254 | {0x64, 0x30}, | |
255 | {0x65, 0x40}, | |
256 | {0x68, 0x26}, | |
257 | {0x69, 0x4c}, | |
258 | {0x70, 0x20}, | |
259 | {0x71, 0x70}, | |
260 | {0x72, 0x04}, | |
261 | {0x73, 0x00}, | |
262 | {0x70, 0x40}, | |
263 | {0x71, 0x70}, | |
264 | {0x72, 0x04}, | |
265 | {0x73, 0x00}, | |
266 | {0x70, 0x60}, | |
267 | {0x71, 0x70}, | |
268 | {0x72, 0x04}, | |
269 | {0x73, 0x00}, | |
270 | {0x70, 0x80}, | |
271 | {0x71, 0x70}, | |
272 | {0x72, 0x04}, | |
273 | {0x73, 0x00}, | |
274 | {0x70, 0xa0}, | |
275 | {0x71, 0x70}, | |
276 | {0x72, 0x04}, | |
277 | {0x73, 0x00}, | |
278 | {0x70, 0x1f}, | |
279 | {0x76, 0x38}, | |
280 | {0x77, 0xa6}, | |
281 | {0x78, 0x0c}, | |
282 | {0x79, 0x80}, | |
283 | {0x7f, 0x14}, | |
284 | {0x7c, 0x00}, | |
285 | {0xae, 0x82}, | |
286 | {0x80, 0x64}, | |
287 | {0x81, 0x66}, | |
288 | {0x82, 0x44}, | |
289 | {0x85, 0x04}, | |
290 | {0xcd, 0xf4}, | |
291 | {0x90, 0x33}, | |
292 | {0xa0, 0x44}, | |
293 | {0xbe, 0x00}, | |
294 | {0xc0, 0x08}, | |
295 | {0xc3, 0x10}, | |
296 | {0xc4, 0x08}, | |
297 | {0xc5, 0xf0}, | |
298 | {0xc6, 0xff}, | |
299 | {0xc7, 0x00}, | |
300 | {0xc8, 0x1a}, | |
301 | {0xc9, 0x80}, | |
302 | {0xe0, 0xf8}, | |
303 | {0xe6, 0x8b}, | |
304 | {0xd0, 0x40}, | |
305 | {0xf8, 0x20}, | |
306 | {0xfa, 0x0f}, | |
307 | {0x00, 0x00}, | |
308 | {0xbd, 0x01}, | |
309 | {0xb8, 0x00}, | |
310 | {0x29, 0x11}, | |
311 | }; | |
312 | ||
313 | static const struct m88ds3103_reg_val m88rs6000_dvbs2_init_reg_vals[] = { | |
314 | {0x23, 0x07}, | |
315 | {0x08, 0x07}, | |
316 | {0x0c, 0x02}, | |
317 | {0x20, 0x00}, | |
318 | {0x21, 0x54}, | |
319 | {0x25, 0x82}, | |
320 | {0x27, 0x31}, | |
321 | {0x30, 0x08}, | |
322 | {0x32, 0x32}, | |
323 | {0x33, 0x35}, | |
324 | {0x35, 0xff}, | |
325 | {0x3a, 0x00}, | |
326 | {0x37, 0x10}, | |
327 | {0x38, 0x10}, | |
328 | {0x39, 0x02}, | |
329 | {0x42, 0x60}, | |
330 | {0x4a, 0x80}, | |
331 | {0x4b, 0x04}, | |
332 | {0x4d, 0x91}, | |
333 | {0x5d, 0xc8}, | |
334 | {0x50, 0x36}, | |
335 | {0x51, 0x36}, | |
336 | {0x52, 0x36}, | |
337 | {0x53, 0x36}, | |
338 | {0x63, 0x0f}, | |
339 | {0x64, 0x10}, | |
340 | {0x65, 0x20}, | |
341 | {0x68, 0x46}, | |
342 | {0x69, 0xcd}, | |
343 | {0x70, 0x20}, | |
344 | {0x71, 0x70}, | |
345 | {0x72, 0x04}, | |
346 | {0x73, 0x00}, | |
347 | {0x70, 0x40}, | |
348 | {0x71, 0x70}, | |
349 | {0x72, 0x04}, | |
350 | {0x73, 0x00}, | |
351 | {0x70, 0x60}, | |
352 | {0x71, 0x70}, | |
353 | {0x72, 0x04}, | |
354 | {0x73, 0x00}, | |
355 | {0x70, 0x80}, | |
356 | {0x71, 0x70}, | |
357 | {0x72, 0x04}, | |
358 | {0x73, 0x00}, | |
359 | {0x70, 0xa0}, | |
360 | {0x71, 0x70}, | |
361 | {0x72, 0x04}, | |
362 | {0x73, 0x00}, | |
363 | {0x70, 0x1f}, | |
364 | {0x76, 0x38}, | |
365 | {0x77, 0xa6}, | |
366 | {0x78, 0x0c}, | |
367 | {0x79, 0x80}, | |
368 | {0x7f, 0x14}, | |
369 | {0x85, 0x08}, | |
370 | {0xcd, 0xf4}, | |
371 | {0x90, 0x33}, | |
372 | {0x86, 0x00}, | |
373 | {0x87, 0x0f}, | |
374 | {0x89, 0x00}, | |
375 | {0x8b, 0x44}, | |
376 | {0x8c, 0x66}, | |
377 | {0x9d, 0xc1}, | |
378 | {0x8a, 0x10}, | |
379 | {0xad, 0x40}, | |
380 | {0xa0, 0x44}, | |
381 | {0xbe, 0x00}, | |
382 | {0xc0, 0x08}, | |
383 | {0xc1, 0x10}, | |
384 | {0xc2, 0x08}, | |
385 | {0xc3, 0x10}, | |
386 | {0xc4, 0x08}, | |
387 | {0xc5, 0xf0}, | |
388 | {0xc6, 0xff}, | |
389 | {0xc7, 0x00}, | |
390 | {0xc8, 0x1a}, | |
391 | {0xc9, 0x80}, | |
392 | {0xca, 0x23}, | |
393 | {0xcb, 0x24}, | |
394 | {0xcc, 0xf4}, | |
395 | {0xce, 0x74}, | |
396 | {0x00, 0x00}, | |
397 | {0xbd, 0x01}, | |
398 | {0xb8, 0x00}, | |
399 | {0x29, 0x01}, | |
400 | }; | |
395d00d1 | 401 | #endif |