2 * Afatech AF9013 demodulator driver
4 * Copyright (C) 2007 Antti Palosaari <crope@iki.fi>
5 * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
7 * Thanks to Afatech who kindly provided information.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
24 #include <media/dvb_frontend.h>
26 #include <linux/firmware.h>
27 #include <linux/math64.h>
28 #include <linux/regmap.h>
30 #define AF9013_FIRMWARE "dvb-fe-af9013.fw"
32 struct af9013_reg_bit
{
50 /* pre-calculated coeff lookup table */
51 static const struct af9013_coeff coeff_lut
[] = {
53 { 28800000, 8000000, { 0x02, 0x8a, 0x28, 0xa3, 0x05, 0x14,
54 0x51, 0x11, 0x00, 0xa2, 0x8f, 0x3d, 0x00, 0xa2, 0x8a,
55 0x29, 0x00, 0xa2, 0x85, 0x14, 0x01, 0x45, 0x14, 0x14 } },
56 { 28800000, 7000000, { 0x02, 0x38, 0xe3, 0x8e, 0x04, 0x71,
57 0xc7, 0x07, 0x00, 0x8e, 0x3d, 0x55, 0x00, 0x8e, 0x38,
58 0xe4, 0x00, 0x8e, 0x34, 0x72, 0x01, 0x1c, 0x71, 0x32 } },
59 { 28800000, 6000000, { 0x01, 0xe7, 0x9e, 0x7a, 0x03, 0xcf,
60 0x3c, 0x3d, 0x00, 0x79, 0xeb, 0x6e, 0x00, 0x79, 0xe7,
61 0x9e, 0x00, 0x79, 0xe3, 0xcf, 0x00, 0xf3, 0xcf, 0x0f } },
63 { 20480000, 8000000, { 0x03, 0x92, 0x49, 0x26, 0x07, 0x24,
64 0x92, 0x13, 0x00, 0xe4, 0x99, 0x6e, 0x00, 0xe4, 0x92,
65 0x49, 0x00, 0xe4, 0x8b, 0x25, 0x01, 0xc9, 0x24, 0x25 } },
66 { 20480000, 7000000, { 0x03, 0x20, 0x00, 0x01, 0x06, 0x40,
67 0x00, 0x00, 0x00, 0xc8, 0x06, 0x40, 0x00, 0xc8, 0x00,
68 0x00, 0x00, 0xc7, 0xf9, 0xc0, 0x01, 0x90, 0x00, 0x00 } },
69 { 20480000, 6000000, { 0x02, 0xad, 0xb6, 0xdc, 0x05, 0x5b,
70 0x6d, 0x2e, 0x00, 0xab, 0x73, 0x13, 0x00, 0xab, 0x6d,
71 0xb7, 0x00, 0xab, 0x68, 0x5c, 0x01, 0x56, 0xdb, 0x1c } },
73 { 28000000, 8000000, { 0x02, 0x9c, 0xbc, 0x15, 0x05, 0x39,
74 0x78, 0x0a, 0x00, 0xa7, 0x34, 0x3f, 0x00, 0xa7, 0x2f,
75 0x05, 0x00, 0xa7, 0x29, 0xcc, 0x01, 0x4e, 0x5e, 0x03 } },
76 { 28000000, 7000000, { 0x02, 0x49, 0x24, 0x92, 0x04, 0x92,
77 0x49, 0x09, 0x00, 0x92, 0x4d, 0xb7, 0x00, 0x92, 0x49,
78 0x25, 0x00, 0x92, 0x44, 0x92, 0x01, 0x24, 0x92, 0x12 } },
79 { 28000000, 6000000, { 0x01, 0xf5, 0x8d, 0x10, 0x03, 0xeb,
80 0x1a, 0x08, 0x00, 0x7d, 0x67, 0x2f, 0x00, 0x7d, 0x63,
81 0x44, 0x00, 0x7d, 0x5f, 0x59, 0x00, 0xfa, 0xc6, 0x22 } },
83 { 25000000, 8000000, { 0x02, 0xec, 0xfb, 0x9d, 0x05, 0xd9,
84 0xf7, 0x0e, 0x00, 0xbb, 0x44, 0xc1, 0x00, 0xbb, 0x3e,
85 0xe7, 0x00, 0xbb, 0x39, 0x0d, 0x01, 0x76, 0x7d, 0x34 } },
86 { 25000000, 7000000, { 0x02, 0x8f, 0x5c, 0x29, 0x05, 0x1e,
87 0xb8, 0x14, 0x00, 0xa3, 0xdc, 0x29, 0x00, 0xa3, 0xd7,
88 0x0a, 0x00, 0xa3, 0xd1, 0xec, 0x01, 0x47, 0xae, 0x05 } },
89 { 25000000, 6000000, { 0x02, 0x31, 0xbc, 0xb5, 0x04, 0x63,
90 0x79, 0x1b, 0x00, 0x8c, 0x73, 0x91, 0x00, 0x8c, 0x6f,
91 0x2d, 0x00, 0x8c, 0x6a, 0xca, 0x01, 0x18, 0xde, 0x17 } },
94 /* QPSK SNR lookup table */
95 static const struct af9013_snr qpsk_snr_lut
[] = {
115 /* QAM16 SNR lookup table */
116 static const struct af9013_snr qam16_snr_lut
[] = {
136 /* QAM64 SNR lookup table */
137 static const struct af9013_snr qam64_snr_lut
[] = {
157 static const struct af9013_reg_bit ofsm_init
[] = {
158 { 0xd73a, 0, 8, 0xa1 },
159 { 0xd73b, 0, 8, 0x1f },
160 { 0xd73c, 4, 4, 0x0a },
161 { 0xd732, 3, 1, 0x00 },
162 { 0xd731, 4, 2, 0x03 },
163 { 0xd73d, 7, 1, 0x01 },
164 { 0xd740, 0, 1, 0x00 },
165 { 0xd740, 1, 1, 0x00 },
166 { 0xd740, 2, 1, 0x00 },
167 { 0xd740, 3, 1, 0x01 },
168 { 0xd3c1, 4, 1, 0x01 },
169 { 0x9124, 0, 8, 0x58 },
170 { 0x9125, 0, 2, 0x02 },
171 { 0xd3a2, 0, 8, 0x00 },
172 { 0xd3a3, 0, 8, 0x04 },
173 { 0xd305, 0, 8, 0x32 },
174 { 0xd306, 0, 8, 0x10 },
175 { 0xd304, 0, 8, 0x04 },
176 { 0x9112, 0, 1, 0x01 },
177 { 0x911d, 0, 1, 0x01 },
178 { 0x911a, 0, 1, 0x01 },
179 { 0x911b, 0, 1, 0x01 },
180 { 0x9bce, 0, 4, 0x02 },
181 { 0x9116, 0, 1, 0x01 },
182 { 0x9122, 0, 8, 0xd0 },
183 { 0xd2e0, 0, 8, 0xd0 },
184 { 0xd2e9, 0, 4, 0x0d },
185 { 0xd38c, 0, 8, 0xfc },
186 { 0xd38d, 0, 8, 0x00 },
187 { 0xd38e, 0, 8, 0x7e },
188 { 0xd38f, 0, 8, 0x00 },
189 { 0xd390, 0, 8, 0x2f },
190 { 0xd145, 4, 1, 0x01 },
191 { 0xd1a9, 4, 1, 0x01 },
192 { 0xd158, 5, 3, 0x01 },
193 { 0xd159, 0, 6, 0x06 },
194 { 0xd167, 0, 8, 0x00 },
195 { 0xd168, 0, 4, 0x07 },
196 { 0xd1c3, 5, 3, 0x00 },
197 { 0xd1c4, 0, 6, 0x00 },
198 { 0xd1c5, 0, 7, 0x10 },
199 { 0xd1c6, 0, 3, 0x02 },
200 { 0xd080, 2, 5, 0x03 },
201 { 0xd081, 4, 4, 0x09 },
202 { 0xd098, 4, 4, 0x0f },
203 { 0xd098, 0, 4, 0x03 },
204 { 0xdbc0, 4, 1, 0x01 },
205 { 0xdbc7, 0, 8, 0x08 },
206 { 0xdbc8, 4, 4, 0x00 },
207 { 0xdbc9, 0, 5, 0x01 },
208 { 0xd280, 0, 8, 0xe0 },
209 { 0xd281, 0, 8, 0xff },
210 { 0xd282, 0, 8, 0xff },
211 { 0xd283, 0, 8, 0xc3 },
212 { 0xd284, 0, 8, 0xff },
213 { 0xd285, 0, 4, 0x01 },
214 { 0xd0f0, 0, 7, 0x1a },
215 { 0xd0f1, 4, 1, 0x01 },
216 { 0xd0f2, 0, 8, 0x0c },
217 { 0xd101, 5, 3, 0x06 },
218 { 0xd103, 0, 4, 0x08 },
219 { 0xd0f8, 0, 7, 0x20 },
220 { 0xd111, 5, 1, 0x00 },
221 { 0xd111, 6, 1, 0x00 },
222 { 0x910b, 0, 8, 0x0a },
223 { 0x9115, 0, 8, 0x02 },
224 { 0x910c, 0, 8, 0x02 },
225 { 0x910d, 0, 8, 0x08 },
226 { 0x910e, 0, 8, 0x0a },
227 { 0x9bf6, 0, 8, 0x06 },
228 { 0x9bf8, 0, 8, 0x02 },
229 { 0x9bf7, 0, 8, 0x05 },
230 { 0x9bf9, 0, 8, 0x0f },
231 { 0x9bfc, 0, 8, 0x13 },
232 { 0x9bd3, 0, 8, 0xff },
233 { 0x9bbe, 0, 1, 0x01 },
234 { 0x9bcc, 0, 1, 0x01 },
237 /* Panasonic ENV77H11D5 tuner init
238 AF9013_TUNER_ENV77H11D5 = 129 */
239 static const struct af9013_reg_bit tuner_init_env77h11d5
[] = {
240 { 0x9bd5, 0, 8, 0x01 },
241 { 0x9bd6, 0, 8, 0x03 },
242 { 0x9bbe, 0, 8, 0x01 },
243 { 0xd1a0, 1, 1, 0x01 },
244 { 0xd000, 0, 1, 0x01 },
245 { 0xd000, 1, 1, 0x00 },
246 { 0xd001, 1, 1, 0x01 },
247 { 0xd001, 0, 1, 0x00 },
248 { 0xd001, 5, 1, 0x00 },
249 { 0xd002, 0, 5, 0x19 },
250 { 0xd003, 0, 5, 0x1a },
251 { 0xd004, 0, 5, 0x19 },
252 { 0xd005, 0, 5, 0x1a },
253 { 0xd00e, 0, 5, 0x10 },
254 { 0xd00f, 0, 3, 0x04 },
255 { 0xd00f, 3, 3, 0x05 },
256 { 0xd010, 0, 3, 0x04 },
257 { 0xd010, 3, 3, 0x05 },
258 { 0xd016, 4, 4, 0x03 },
259 { 0xd01f, 0, 6, 0x0a },
260 { 0xd020, 0, 6, 0x0a },
261 { 0x9bda, 0, 8, 0x00 },
262 { 0x9be3, 0, 8, 0x00 },
263 { 0xd015, 0, 8, 0x50 },
264 { 0xd016, 0, 1, 0x00 },
265 { 0xd044, 0, 8, 0x46 },
266 { 0xd045, 0, 1, 0x00 },
267 { 0xd008, 0, 8, 0xdf },
268 { 0xd009, 0, 2, 0x02 },
269 { 0xd006, 0, 8, 0x44 },
270 { 0xd007, 0, 2, 0x01 },
271 { 0xd00c, 0, 8, 0xeb },
272 { 0xd00d, 0, 2, 0x02 },
273 { 0xd00a, 0, 8, 0xf4 },
274 { 0xd00b, 0, 2, 0x01 },
275 { 0x9bba, 0, 8, 0xf9 },
276 { 0x9bc3, 0, 8, 0xdf },
277 { 0x9bc4, 0, 8, 0x02 },
278 { 0x9bc5, 0, 8, 0xeb },
279 { 0x9bc6, 0, 8, 0x02 },
280 { 0x9bc9, 0, 8, 0x52 },
281 { 0xd011, 0, 8, 0x3c },
282 { 0xd012, 0, 2, 0x01 },
283 { 0xd013, 0, 8, 0xf7 },
284 { 0xd014, 0, 2, 0x02 },
285 { 0xd040, 0, 8, 0x0b },
286 { 0xd041, 0, 2, 0x02 },
287 { 0xd042, 0, 8, 0x4d },
288 { 0xd043, 0, 2, 0x00 },
289 { 0xd045, 1, 1, 0x00 },
290 { 0x9bcf, 0, 1, 0x01 },
291 { 0xd045, 2, 1, 0x01 },
292 { 0xd04f, 0, 8, 0x9a },
293 { 0xd050, 0, 1, 0x01 },
294 { 0xd051, 0, 8, 0x5a },
295 { 0xd052, 0, 1, 0x01 },
296 { 0xd053, 0, 8, 0x50 },
297 { 0xd054, 0, 8, 0x46 },
298 { 0x9bd7, 0, 8, 0x0a },
299 { 0x9bd8, 0, 8, 0x14 },
300 { 0x9bd9, 0, 8, 0x08 },
303 /* Microtune MT2060 tuner init
304 AF9013_TUNER_MT2060 = 130 */
305 static const struct af9013_reg_bit tuner_init_mt2060
[] = {
306 { 0x9bd5, 0, 8, 0x01 },
307 { 0x9bd6, 0, 8, 0x07 },
308 { 0xd1a0, 1, 1, 0x01 },
309 { 0xd000, 0, 1, 0x01 },
310 { 0xd000, 1, 1, 0x00 },
311 { 0xd001, 1, 1, 0x01 },
312 { 0xd001, 0, 1, 0x00 },
313 { 0xd001, 5, 1, 0x00 },
314 { 0xd002, 0, 5, 0x19 },
315 { 0xd003, 0, 5, 0x1a },
316 { 0xd004, 0, 5, 0x19 },
317 { 0xd005, 0, 5, 0x1a },
318 { 0xd00e, 0, 5, 0x10 },
319 { 0xd00f, 0, 3, 0x04 },
320 { 0xd00f, 3, 3, 0x05 },
321 { 0xd010, 0, 3, 0x04 },
322 { 0xd010, 3, 3, 0x05 },
323 { 0xd016, 4, 4, 0x03 },
324 { 0xd01f, 0, 6, 0x0a },
325 { 0xd020, 0, 6, 0x0a },
326 { 0x9bda, 0, 8, 0x00 },
327 { 0x9be3, 0, 8, 0x00 },
328 { 0x9bbe, 0, 1, 0x00 },
329 { 0x9bcc, 0, 1, 0x00 },
330 { 0x9bb9, 0, 8, 0x75 },
331 { 0x9bcd, 0, 8, 0x24 },
332 { 0x9bff, 0, 8, 0x30 },
333 { 0xd015, 0, 8, 0x46 },
334 { 0xd016, 0, 1, 0x00 },
335 { 0xd044, 0, 8, 0x46 },
336 { 0xd045, 0, 1, 0x00 },
337 { 0xd008, 0, 8, 0x0f },
338 { 0xd009, 0, 2, 0x02 },
339 { 0xd006, 0, 8, 0x32 },
340 { 0xd007, 0, 2, 0x01 },
341 { 0xd00c, 0, 8, 0x36 },
342 { 0xd00d, 0, 2, 0x03 },
343 { 0xd00a, 0, 8, 0x35 },
344 { 0xd00b, 0, 2, 0x01 },
345 { 0x9bc7, 0, 8, 0x07 },
346 { 0x9bc8, 0, 8, 0x90 },
347 { 0x9bc3, 0, 8, 0x0f },
348 { 0x9bc4, 0, 8, 0x02 },
349 { 0x9bc5, 0, 8, 0x36 },
350 { 0x9bc6, 0, 8, 0x03 },
351 { 0x9bba, 0, 8, 0xc9 },
352 { 0x9bc9, 0, 8, 0x79 },
353 { 0xd011, 0, 8, 0x10 },
354 { 0xd012, 0, 2, 0x01 },
355 { 0xd013, 0, 8, 0x45 },
356 { 0xd014, 0, 2, 0x03 },
357 { 0xd040, 0, 8, 0x98 },
358 { 0xd041, 0, 2, 0x00 },
359 { 0xd042, 0, 8, 0xcf },
360 { 0xd043, 0, 2, 0x03 },
361 { 0xd045, 1, 1, 0x00 },
362 { 0x9bcf, 0, 1, 0x01 },
363 { 0xd045, 2, 1, 0x01 },
364 { 0xd04f, 0, 8, 0x9a },
365 { 0xd050, 0, 1, 0x01 },
366 { 0xd051, 0, 8, 0x5a },
367 { 0xd052, 0, 1, 0x01 },
368 { 0xd053, 0, 8, 0x50 },
369 { 0xd054, 0, 8, 0x46 },
370 { 0x9bd7, 0, 8, 0x0a },
371 { 0x9bd8, 0, 8, 0x14 },
372 { 0x9bd9, 0, 8, 0x08 },
373 { 0x9bd0, 0, 8, 0xcc },
374 { 0x9be4, 0, 8, 0xa0 },
375 { 0x9bbd, 0, 8, 0x8e },
376 { 0x9be2, 0, 8, 0x4d },
377 { 0x9bee, 0, 1, 0x01 },
380 /* Microtune MT2060 tuner init
381 AF9013_TUNER_MT2060_2 = 147 */
382 static const struct af9013_reg_bit tuner_init_mt2060_2
[] = {
383 { 0x9bd5, 0, 8, 0x01 },
384 { 0x9bd6, 0, 8, 0x06 },
385 { 0x9bbe, 0, 8, 0x01 },
386 { 0xd1a0, 1, 1, 0x01 },
387 { 0xd000, 0, 1, 0x01 },
388 { 0xd000, 1, 1, 0x00 },
389 { 0xd001, 1, 1, 0x01 },
390 { 0xd001, 0, 1, 0x00 },
391 { 0xd001, 5, 1, 0x00 },
392 { 0xd002, 0, 5, 0x19 },
393 { 0xd003, 0, 5, 0x1a },
394 { 0xd004, 0, 5, 0x19 },
395 { 0xd005, 0, 5, 0x1a },
396 { 0xd00e, 0, 5, 0x10 },
397 { 0xd00f, 0, 3, 0x04 },
398 { 0xd00f, 3, 3, 0x05 },
399 { 0xd010, 0, 3, 0x04 },
400 { 0xd010, 3, 3, 0x05 },
401 { 0xd016, 4, 4, 0x03 },
402 { 0xd01f, 0, 6, 0x0a },
403 { 0xd020, 0, 6, 0x0a },
404 { 0xd015, 0, 8, 0x46 },
405 { 0xd016, 0, 1, 0x00 },
406 { 0xd044, 0, 8, 0x46 },
407 { 0xd045, 0, 1, 0x00 },
408 { 0xd008, 0, 8, 0x0f },
409 { 0xd009, 0, 2, 0x02 },
410 { 0xd006, 0, 8, 0x32 },
411 { 0xd007, 0, 2, 0x01 },
412 { 0xd00c, 0, 8, 0x36 },
413 { 0xd00d, 0, 2, 0x03 },
414 { 0xd00a, 0, 8, 0x35 },
415 { 0xd00b, 0, 2, 0x01 },
416 { 0x9bc7, 0, 8, 0x07 },
417 { 0x9bc8, 0, 8, 0x90 },
418 { 0x9bc3, 0, 8, 0x0f },
419 { 0x9bc4, 0, 8, 0x02 },
420 { 0x9bc5, 0, 8, 0x36 },
421 { 0x9bc6, 0, 8, 0x03 },
422 { 0x9bba, 0, 8, 0xc9 },
423 { 0x9bc9, 0, 8, 0x79 },
424 { 0xd011, 0, 8, 0x10 },
425 { 0xd012, 0, 2, 0x01 },
426 { 0xd013, 0, 8, 0x45 },
427 { 0xd014, 0, 2, 0x03 },
428 { 0xd040, 0, 8, 0x98 },
429 { 0xd041, 0, 2, 0x00 },
430 { 0xd042, 0, 8, 0xcf },
431 { 0xd043, 0, 2, 0x03 },
432 { 0xd045, 1, 1, 0x00 },
433 { 0x9bcf, 0, 8, 0x01 },
434 { 0xd045, 2, 1, 0x01 },
435 { 0xd04f, 0, 8, 0x9a },
436 { 0xd050, 0, 1, 0x01 },
437 { 0xd051, 0, 8, 0x5a },
438 { 0xd052, 0, 1, 0x01 },
439 { 0xd053, 0, 8, 0x96 },
440 { 0xd054, 0, 8, 0x46 },
441 { 0xd045, 7, 1, 0x00 },
442 { 0x9bd7, 0, 8, 0x0a },
443 { 0x9bd8, 0, 8, 0x14 },
444 { 0x9bd9, 0, 8, 0x08 },
447 /* MaxLinear MXL5003 tuner init
448 AF9013_TUNER_MXL5003D = 3 */
449 static const struct af9013_reg_bit tuner_init_mxl5003d
[] = {
450 { 0x9bd5, 0, 8, 0x01 },
451 { 0x9bd6, 0, 8, 0x09 },
452 { 0xd1a0, 1, 1, 0x01 },
453 { 0xd000, 0, 1, 0x01 },
454 { 0xd000, 1, 1, 0x00 },
455 { 0xd001, 1, 1, 0x01 },
456 { 0xd001, 0, 1, 0x00 },
457 { 0xd001, 5, 1, 0x00 },
458 { 0xd002, 0, 5, 0x19 },
459 { 0xd003, 0, 5, 0x1a },
460 { 0xd004, 0, 5, 0x19 },
461 { 0xd005, 0, 5, 0x1a },
462 { 0xd00e, 0, 5, 0x10 },
463 { 0xd00f, 0, 3, 0x04 },
464 { 0xd00f, 3, 3, 0x05 },
465 { 0xd010, 0, 3, 0x04 },
466 { 0xd010, 3, 3, 0x05 },
467 { 0xd016, 4, 4, 0x03 },
468 { 0xd01f, 0, 6, 0x0a },
469 { 0xd020, 0, 6, 0x0a },
470 { 0x9bda, 0, 8, 0x00 },
471 { 0x9be3, 0, 8, 0x00 },
472 { 0x9bfc, 0, 8, 0x0f },
473 { 0x9bf6, 0, 8, 0x01 },
474 { 0x9bbe, 0, 1, 0x01 },
475 { 0xd015, 0, 8, 0x33 },
476 { 0xd016, 0, 1, 0x00 },
477 { 0xd044, 0, 8, 0x40 },
478 { 0xd045, 0, 1, 0x00 },
479 { 0xd008, 0, 8, 0x0f },
480 { 0xd009, 0, 2, 0x02 },
481 { 0xd006, 0, 8, 0x6c },
482 { 0xd007, 0, 2, 0x00 },
483 { 0xd00c, 0, 8, 0x3d },
484 { 0xd00d, 0, 2, 0x00 },
485 { 0xd00a, 0, 8, 0x45 },
486 { 0xd00b, 0, 2, 0x01 },
487 { 0x9bc7, 0, 8, 0x07 },
488 { 0x9bc8, 0, 8, 0x52 },
489 { 0x9bc3, 0, 8, 0x0f },
490 { 0x9bc4, 0, 8, 0x02 },
491 { 0x9bc5, 0, 8, 0x3d },
492 { 0x9bc6, 0, 8, 0x00 },
493 { 0x9bba, 0, 8, 0xa2 },
494 { 0x9bc9, 0, 8, 0xa0 },
495 { 0xd011, 0, 8, 0x56 },
496 { 0xd012, 0, 2, 0x00 },
497 { 0xd013, 0, 8, 0x50 },
498 { 0xd014, 0, 2, 0x00 },
499 { 0xd040, 0, 8, 0x56 },
500 { 0xd041, 0, 2, 0x00 },
501 { 0xd042, 0, 8, 0x50 },
502 { 0xd043, 0, 2, 0x00 },
503 { 0xd045, 1, 1, 0x00 },
504 { 0x9bcf, 0, 8, 0x01 },
505 { 0xd045, 2, 1, 0x01 },
506 { 0xd04f, 0, 8, 0x9a },
507 { 0xd050, 0, 1, 0x01 },
508 { 0xd051, 0, 8, 0x5a },
509 { 0xd052, 0, 1, 0x01 },
510 { 0xd053, 0, 8, 0x50 },
511 { 0xd054, 0, 8, 0x46 },
512 { 0x9bd7, 0, 8, 0x0a },
513 { 0x9bd8, 0, 8, 0x14 },
514 { 0x9bd9, 0, 8, 0x08 },
517 /* MaxLinear MXL5005S & MXL5007T tuner init
518 AF9013_TUNER_MXL5005D = 13
519 AF9013_TUNER_MXL5005R = 30
520 AF9013_TUNER_MXL5007T = 177 */
521 static const struct af9013_reg_bit tuner_init_mxl5005
[] = {
522 { 0x9bd5, 0, 8, 0x01 },
523 { 0x9bd6, 0, 8, 0x07 },
524 { 0xd1a0, 1, 1, 0x01 },
525 { 0xd000, 0, 1, 0x01 },
526 { 0xd000, 1, 1, 0x00 },
527 { 0xd001, 1, 1, 0x01 },
528 { 0xd001, 0, 1, 0x00 },
529 { 0xd001, 5, 1, 0x00 },
530 { 0xd002, 0, 5, 0x19 },
531 { 0xd003, 0, 5, 0x1a },
532 { 0xd004, 0, 5, 0x19 },
533 { 0xd005, 0, 5, 0x1a },
534 { 0xd00e, 0, 5, 0x10 },
535 { 0xd00f, 0, 3, 0x04 },
536 { 0xd00f, 3, 3, 0x05 },
537 { 0xd010, 0, 3, 0x04 },
538 { 0xd010, 3, 3, 0x05 },
539 { 0xd016, 4, 4, 0x03 },
540 { 0xd01f, 0, 6, 0x0a },
541 { 0xd020, 0, 6, 0x0a },
542 { 0x9bda, 0, 8, 0x01 },
543 { 0x9be3, 0, 8, 0x01 },
544 { 0x9bbe, 0, 1, 0x01 },
545 { 0x9bcc, 0, 1, 0x01 },
546 { 0x9bb9, 0, 8, 0x00 },
547 { 0x9bcd, 0, 8, 0x28 },
548 { 0x9bff, 0, 8, 0x24 },
549 { 0xd015, 0, 8, 0x40 },
550 { 0xd016, 0, 1, 0x00 },
551 { 0xd044, 0, 8, 0x40 },
552 { 0xd045, 0, 1, 0x00 },
553 { 0xd008, 0, 8, 0x0f },
554 { 0xd009, 0, 2, 0x02 },
555 { 0xd006, 0, 8, 0x73 },
556 { 0xd007, 0, 2, 0x01 },
557 { 0xd00c, 0, 8, 0xfa },
558 { 0xd00d, 0, 2, 0x01 },
559 { 0xd00a, 0, 8, 0xff },
560 { 0xd00b, 0, 2, 0x01 },
561 { 0x9bc7, 0, 8, 0x23 },
562 { 0x9bc8, 0, 8, 0x55 },
563 { 0x9bc3, 0, 8, 0x01 },
564 { 0x9bc4, 0, 8, 0x02 },
565 { 0x9bc5, 0, 8, 0xfa },
566 { 0x9bc6, 0, 8, 0x01 },
567 { 0x9bba, 0, 8, 0xff },
568 { 0x9bc9, 0, 8, 0xff },
569 { 0x9bd3, 0, 8, 0x95 },
570 { 0xd011, 0, 8, 0x70 },
571 { 0xd012, 0, 2, 0x01 },
572 { 0xd013, 0, 8, 0xfb },
573 { 0xd014, 0, 2, 0x01 },
574 { 0xd040, 0, 8, 0x70 },
575 { 0xd041, 0, 2, 0x01 },
576 { 0xd042, 0, 8, 0xfb },
577 { 0xd043, 0, 2, 0x01 },
578 { 0xd045, 1, 1, 0x00 },
579 { 0x9bcf, 0, 1, 0x01 },
580 { 0xd045, 2, 1, 0x01 },
581 { 0xd04f, 0, 8, 0x9a },
582 { 0xd050, 0, 1, 0x01 },
583 { 0xd051, 0, 8, 0x5a },
584 { 0xd052, 0, 1, 0x01 },
585 { 0xd053, 0, 8, 0x50 },
586 { 0xd054, 0, 8, 0x46 },
587 { 0x9bd7, 0, 8, 0x0a },
588 { 0x9bd8, 0, 8, 0x14 },
589 { 0x9bd9, 0, 8, 0x08 },
590 { 0x9bd0, 0, 8, 0x93 },
591 { 0x9be4, 0, 8, 0xfe },
592 { 0x9bbd, 0, 8, 0x63 },
593 { 0x9be2, 0, 8, 0xfe },
594 { 0x9bee, 0, 1, 0x01 },
597 /* Quantek QT1010 tuner init
598 AF9013_TUNER_QT1010 = 134
599 AF9013_TUNER_QT1010A = 162 */
600 static const struct af9013_reg_bit tuner_init_qt1010
[] = {
601 { 0x9bd5, 0, 8, 0x01 },
602 { 0x9bd6, 0, 8, 0x09 },
603 { 0xd1a0, 1, 1, 0x01 },
604 { 0xd000, 0, 1, 0x01 },
605 { 0xd000, 1, 1, 0x00 },
606 { 0xd001, 1, 1, 0x01 },
607 { 0xd001, 0, 1, 0x00 },
608 { 0xd001, 5, 1, 0x00 },
609 { 0xd002, 0, 5, 0x19 },
610 { 0xd003, 0, 5, 0x1a },
611 { 0xd004, 0, 5, 0x19 },
612 { 0xd005, 0, 5, 0x1a },
613 { 0xd00e, 0, 5, 0x10 },
614 { 0xd00f, 0, 3, 0x04 },
615 { 0xd00f, 3, 3, 0x05 },
616 { 0xd010, 0, 3, 0x04 },
617 { 0xd010, 3, 3, 0x05 },
618 { 0xd016, 4, 4, 0x03 },
619 { 0xd01f, 0, 6, 0x0a },
620 { 0xd020, 0, 6, 0x0a },
621 { 0x9bda, 0, 8, 0x01 },
622 { 0x9be3, 0, 8, 0x01 },
623 { 0xd015, 0, 8, 0x46 },
624 { 0xd016, 0, 1, 0x00 },
625 { 0xd044, 0, 8, 0x46 },
626 { 0xd045, 0, 1, 0x00 },
627 { 0x9bbe, 0, 1, 0x01 },
628 { 0x9bcc, 0, 1, 0x01 },
629 { 0x9bb9, 0, 8, 0x00 },
630 { 0x9bcd, 0, 8, 0x28 },
631 { 0x9bff, 0, 8, 0x20 },
632 { 0xd008, 0, 8, 0x0f },
633 { 0xd009, 0, 2, 0x02 },
634 { 0xd006, 0, 8, 0x99 },
635 { 0xd007, 0, 2, 0x01 },
636 { 0xd00c, 0, 8, 0x0f },
637 { 0xd00d, 0, 2, 0x02 },
638 { 0xd00a, 0, 8, 0x50 },
639 { 0xd00b, 0, 2, 0x01 },
640 { 0x9bc7, 0, 8, 0x00 },
641 { 0x9bc8, 0, 8, 0x00 },
642 { 0x9bc3, 0, 8, 0x0f },
643 { 0x9bc4, 0, 8, 0x02 },
644 { 0x9bc5, 0, 8, 0x0f },
645 { 0x9bc6, 0, 8, 0x02 },
646 { 0x9bba, 0, 8, 0xc5 },
647 { 0x9bc9, 0, 8, 0xff },
648 { 0xd011, 0, 8, 0x58 },
649 { 0xd012, 0, 2, 0x02 },
650 { 0xd013, 0, 8, 0x89 },
651 { 0xd014, 0, 2, 0x01 },
652 { 0xd040, 0, 8, 0x58 },
653 { 0xd041, 0, 2, 0x02 },
654 { 0xd042, 0, 8, 0x89 },
655 { 0xd043, 0, 2, 0x01 },
656 { 0xd045, 1, 1, 0x00 },
657 { 0x9bcf, 0, 1, 0x01 },
658 { 0xd045, 2, 1, 0x01 },
659 { 0xd04f, 0, 8, 0x9a },
660 { 0xd050, 0, 1, 0x01 },
661 { 0xd051, 0, 8, 0x5a },
662 { 0xd052, 0, 1, 0x01 },
663 { 0xd053, 0, 8, 0x50 },
664 { 0xd054, 0, 8, 0x46 },
665 { 0x9bd7, 0, 8, 0x0a },
666 { 0x9bd8, 0, 8, 0x14 },
667 { 0x9bd9, 0, 8, 0x08 },
668 { 0x9bd0, 0, 8, 0xcd },
669 { 0x9be4, 0, 8, 0xbb },
670 { 0x9bbd, 0, 8, 0x93 },
671 { 0x9be2, 0, 8, 0x80 },
672 { 0x9bee, 0, 1, 0x01 },
675 /* Freescale MC44S803 tuner init
676 AF9013_TUNER_MC44S803 = 133 */
677 static const struct af9013_reg_bit tuner_init_mc44s803
[] = {
678 { 0x9bd5, 0, 8, 0x01 },
679 { 0x9bd6, 0, 8, 0x06 },
680 { 0xd1a0, 1, 1, 0x01 },
681 { 0xd000, 0, 1, 0x01 },
682 { 0xd000, 1, 1, 0x00 },
683 { 0xd001, 1, 1, 0x01 },
684 { 0xd001, 0, 1, 0x00 },
685 { 0xd001, 5, 1, 0x00 },
686 { 0xd002, 0, 5, 0x19 },
687 { 0xd003, 0, 5, 0x1a },
688 { 0xd004, 0, 5, 0x19 },
689 { 0xd005, 0, 5, 0x1a },
690 { 0xd00e, 0, 5, 0x10 },
691 { 0xd00f, 0, 3, 0x04 },
692 { 0xd00f, 3, 3, 0x05 },
693 { 0xd010, 0, 3, 0x04 },
694 { 0xd010, 3, 3, 0x05 },
695 { 0xd016, 4, 4, 0x03 },
696 { 0xd01f, 0, 6, 0x0a },
697 { 0xd020, 0, 6, 0x0a },
698 { 0x9bda, 0, 8, 0x00 },
699 { 0x9be3, 0, 8, 0x00 },
700 { 0x9bf6, 0, 8, 0x01 },
701 { 0x9bf8, 0, 8, 0x02 },
702 { 0x9bf9, 0, 8, 0x02 },
703 { 0x9bfc, 0, 8, 0x1f },
704 { 0x9bbe, 0, 1, 0x01 },
705 { 0x9bcc, 0, 1, 0x01 },
706 { 0x9bb9, 0, 8, 0x00 },
707 { 0x9bcd, 0, 8, 0x24 },
708 { 0x9bff, 0, 8, 0x24 },
709 { 0xd015, 0, 8, 0x46 },
710 { 0xd016, 0, 1, 0x00 },
711 { 0xd044, 0, 8, 0x46 },
712 { 0xd045, 0, 1, 0x00 },
713 { 0xd008, 0, 8, 0x01 },
714 { 0xd009, 0, 2, 0x02 },
715 { 0xd006, 0, 8, 0x7b },
716 { 0xd007, 0, 2, 0x00 },
717 { 0xd00c, 0, 8, 0x7c },
718 { 0xd00d, 0, 2, 0x02 },
719 { 0xd00a, 0, 8, 0xfe },
720 { 0xd00b, 0, 2, 0x01 },
721 { 0x9bc7, 0, 8, 0x08 },
722 { 0x9bc8, 0, 8, 0x9a },
723 { 0x9bc3, 0, 8, 0x01 },
724 { 0x9bc4, 0, 8, 0x02 },
725 { 0x9bc5, 0, 8, 0x7c },
726 { 0x9bc6, 0, 8, 0x02 },
727 { 0x9bba, 0, 8, 0xfc },
728 { 0x9bc9, 0, 8, 0xaa },
729 { 0xd011, 0, 8, 0x6b },
730 { 0xd012, 0, 2, 0x00 },
731 { 0xd013, 0, 8, 0x88 },
732 { 0xd014, 0, 2, 0x02 },
733 { 0xd040, 0, 8, 0x6b },
734 { 0xd041, 0, 2, 0x00 },
735 { 0xd042, 0, 8, 0x7c },
736 { 0xd043, 0, 2, 0x02 },
737 { 0xd045, 1, 1, 0x00 },
738 { 0x9bcf, 0, 1, 0x01 },
739 { 0xd045, 2, 1, 0x01 },
740 { 0xd04f, 0, 8, 0x9a },
741 { 0xd050, 0, 1, 0x01 },
742 { 0xd051, 0, 8, 0x5a },
743 { 0xd052, 0, 1, 0x01 },
744 { 0xd053, 0, 8, 0x50 },
745 { 0xd054, 0, 8, 0x46 },
746 { 0x9bd7, 0, 8, 0x0a },
747 { 0x9bd8, 0, 8, 0x14 },
748 { 0x9bd9, 0, 8, 0x08 },
749 { 0x9bd0, 0, 8, 0x9e },
750 { 0x9be4, 0, 8, 0xff },
751 { 0x9bbd, 0, 8, 0x9e },
752 { 0x9be2, 0, 8, 0x25 },
753 { 0x9bee, 0, 1, 0x01 },
754 { 0xd73b, 3, 1, 0x00 },
757 /* unknown, probably for tin can tuner, tuner init
758 AF9013_TUNER_UNKNOWN = 140 */
759 static const struct af9013_reg_bit tuner_init_unknown
[] = {
760 { 0x9bd5, 0, 8, 0x01 },
761 { 0x9bd6, 0, 8, 0x02 },
762 { 0xd1a0, 1, 1, 0x01 },
763 { 0xd000, 0, 1, 0x01 },
764 { 0xd000, 1, 1, 0x00 },
765 { 0xd001, 1, 1, 0x01 },
766 { 0xd001, 0, 1, 0x00 },
767 { 0xd001, 5, 1, 0x00 },
768 { 0xd002, 0, 5, 0x19 },
769 { 0xd003, 0, 5, 0x1a },
770 { 0xd004, 0, 5, 0x19 },
771 { 0xd005, 0, 5, 0x1a },
772 { 0xd00e, 0, 5, 0x10 },
773 { 0xd00f, 0, 3, 0x04 },
774 { 0xd00f, 3, 3, 0x05 },
775 { 0xd010, 0, 3, 0x04 },
776 { 0xd010, 3, 3, 0x05 },
777 { 0xd016, 4, 4, 0x03 },
778 { 0xd01f, 0, 6, 0x0a },
779 { 0xd020, 0, 6, 0x0a },
780 { 0x9bda, 0, 8, 0x01 },
781 { 0x9be3, 0, 8, 0x01 },
782 { 0xd1a0, 1, 1, 0x00 },
783 { 0x9bbe, 0, 1, 0x01 },
784 { 0x9bcc, 0, 1, 0x01 },
785 { 0x9bb9, 0, 8, 0x00 },
786 { 0x9bcd, 0, 8, 0x18 },
787 { 0x9bff, 0, 8, 0x2c },
788 { 0xd015, 0, 8, 0x46 },
789 { 0xd016, 0, 1, 0x00 },
790 { 0xd044, 0, 8, 0x46 },
791 { 0xd045, 0, 1, 0x00 },
792 { 0xd008, 0, 8, 0xdf },
793 { 0xd009, 0, 2, 0x02 },
794 { 0xd006, 0, 8, 0x44 },
795 { 0xd007, 0, 2, 0x01 },
796 { 0xd00c, 0, 8, 0x00 },
797 { 0xd00d, 0, 2, 0x02 },
798 { 0xd00a, 0, 8, 0xf6 },
799 { 0xd00b, 0, 2, 0x01 },
800 { 0x9bba, 0, 8, 0xf9 },
801 { 0x9bc8, 0, 8, 0xaa },
802 { 0x9bc3, 0, 8, 0xdf },
803 { 0x9bc4, 0, 8, 0x02 },
804 { 0x9bc5, 0, 8, 0x00 },
805 { 0x9bc6, 0, 8, 0x02 },
806 { 0x9bc9, 0, 8, 0xf0 },
807 { 0xd011, 0, 8, 0x3c },
808 { 0xd012, 0, 2, 0x01 },
809 { 0xd013, 0, 8, 0xf7 },
810 { 0xd014, 0, 2, 0x02 },
811 { 0xd040, 0, 8, 0x0b },
812 { 0xd041, 0, 2, 0x02 },
813 { 0xd042, 0, 8, 0x4d },
814 { 0xd043, 0, 2, 0x00 },
815 { 0xd045, 1, 1, 0x00 },
816 { 0x9bcf, 0, 1, 0x01 },
817 { 0xd045, 2, 1, 0x01 },
818 { 0xd04f, 0, 8, 0x9a },
819 { 0xd050, 0, 1, 0x01 },
820 { 0xd051, 0, 8, 0x5a },
821 { 0xd052, 0, 1, 0x01 },
822 { 0xd053, 0, 8, 0x50 },
823 { 0xd054, 0, 8, 0x46 },
824 { 0x9bd7, 0, 8, 0x0a },
825 { 0x9bd8, 0, 8, 0x14 },
826 { 0x9bd9, 0, 8, 0x08 },
829 /* NXP TDA18271 & TDA18218 tuner init
830 AF9013_TUNER_TDA18271 = 156
831 AF9013_TUNER_TDA18218 = 179 */
832 static const struct af9013_reg_bit tuner_init_tda18271
[] = {
833 { 0x9bd5, 0, 8, 0x01 },
834 { 0x9bd6, 0, 8, 0x04 },
835 { 0xd1a0, 1, 1, 0x01 },
836 { 0xd000, 0, 1, 0x01 },
837 { 0xd000, 1, 1, 0x00 },
838 { 0xd001, 1, 1, 0x01 },
839 { 0xd001, 0, 1, 0x00 },
840 { 0xd001, 5, 1, 0x00 },
841 { 0xd002, 0, 5, 0x19 },
842 { 0xd003, 0, 5, 0x1a },
843 { 0xd004, 0, 5, 0x19 },
844 { 0xd005, 0, 5, 0x1a },
845 { 0xd00e, 0, 5, 0x10 },
846 { 0xd00f, 0, 3, 0x04 },
847 { 0xd00f, 3, 3, 0x05 },
848 { 0xd010, 0, 3, 0x04 },
849 { 0xd010, 3, 3, 0x05 },
850 { 0xd016, 4, 4, 0x03 },
851 { 0xd01f, 0, 6, 0x0a },
852 { 0xd020, 0, 6, 0x0a },
853 { 0x9bda, 0, 8, 0x01 },
854 { 0x9be3, 0, 8, 0x01 },
855 { 0xd1a0, 1, 1, 0x00 },
856 { 0x9bbe, 0, 1, 0x01 },
857 { 0x9bcc, 0, 1, 0x01 },
858 { 0x9bb9, 0, 8, 0x00 },
859 { 0x9bcd, 0, 8, 0x18 },
860 { 0x9bff, 0, 8, 0x2c },
861 { 0xd015, 0, 8, 0x46 },
862 { 0xd016, 0, 1, 0x00 },
863 { 0xd044, 0, 8, 0x46 },
864 { 0xd045, 0, 1, 0x00 },
865 { 0xd008, 0, 8, 0xdf },
866 { 0xd009, 0, 2, 0x02 },
867 { 0xd006, 0, 8, 0x44 },
868 { 0xd007, 0, 2, 0x01 },
869 { 0xd00c, 0, 8, 0x00 },
870 { 0xd00d, 0, 2, 0x02 },
871 { 0xd00a, 0, 8, 0xf6 },
872 { 0xd00b, 0, 2, 0x01 },
873 { 0x9bba, 0, 8, 0xf9 },
874 { 0x9bc8, 0, 8, 0xaa },
875 { 0x9bc3, 0, 8, 0xdf },
876 { 0x9bc4, 0, 8, 0x02 },
877 { 0x9bc5, 0, 8, 0x00 },
878 { 0x9bc6, 0, 8, 0x02 },
879 { 0x9bc9, 0, 8, 0xf0 },
880 { 0xd011, 0, 8, 0x3c },
881 { 0xd012, 0, 2, 0x01 },
882 { 0xd013, 0, 8, 0xf7 },
883 { 0xd014, 0, 2, 0x02 },
884 { 0xd040, 0, 8, 0x0b },
885 { 0xd041, 0, 2, 0x02 },
886 { 0xd042, 0, 8, 0x4d },
887 { 0xd043, 0, 2, 0x00 },
888 { 0xd045, 1, 1, 0x00 },
889 { 0x9bcf, 0, 1, 0x01 },
890 { 0xd045, 2, 1, 0x01 },
891 { 0xd04f, 0, 8, 0x9a },
892 { 0xd050, 0, 1, 0x01 },
893 { 0xd051, 0, 8, 0x5a },
894 { 0xd052, 0, 1, 0x01 },
895 { 0xd053, 0, 8, 0x50 },
896 { 0xd054, 0, 8, 0x46 },
897 { 0x9bd7, 0, 8, 0x0a },
898 { 0x9bd8, 0, 8, 0x14 },
899 { 0x9bd9, 0, 8, 0x08 },
900 { 0x9bd0, 0, 8, 0xa8 },
901 { 0x9be4, 0, 8, 0x7f },
902 { 0x9bbd, 0, 8, 0xa8 },
903 { 0x9be2, 0, 8, 0x20 },
904 { 0x9bee, 0, 1, 0x01 },
907 #endif /* AF9013_PRIV_H */