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