blob: 7b9834aa0c4766c84f9d2b6b266f37c899ca99ca [file] [log] [blame]
Antti Palosaari825b9672008-09-15 15:01:52 -03001/*
2 * DVB USB Linux driver for Afatech AF9015 DVB-T USB2.0 receiver
3 *
4 * Copyright (C) 2007 Antti Palosaari <crope@iki.fi>
5 *
6 * Thanks to Afatech who kindly provided information.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 */
23
24#ifndef _AF9013_PRIV_
25#define _AF9013_PRIV_
26
27#define LOG_PREFIX "af9013"
28extern int af9013_debug;
29
30#define dprintk(var, level, args...) \
31 do { if ((var & level)) printk(args); } while (0)
32
33#define debug_dump(b, l, func) {\
34 int loop_; \
35 for (loop_ = 0; loop_ < l; loop_++) \
36 func("%02x ", b[loop_]); \
37 func("\n");\
38}
39
40#define deb_info(args...) dprintk(af9013_debug, 0x01, args)
41
42#undef err
43#define err(f, arg...) printk(KERN_ERR LOG_PREFIX": " f "\n" , ## arg)
44#undef info
45#define info(f, arg...) printk(KERN_INFO LOG_PREFIX": " f "\n" , ## arg)
46#undef warn
47#define warn(f, arg...) printk(KERN_WARNING LOG_PREFIX": " f "\n" , ## arg)
48
49#define AF9013_DEFAULT_FIRMWARE "dvb-fe-af9013.fw"
50
51struct regdesc {
52 u16 addr;
53 u8 pos:4;
54 u8 len:4;
55 u8 val;
56};
57
58struct snr_table {
59 u32 val;
60 u8 snr;
61};
62
63/* QPSK SNR lookup table */
64static struct snr_table qpsk_snr_table[] = {
65 { 0x0b4771, 0 },
66 { 0x0c1aed, 1 },
67 { 0x0d0d27, 2 },
68 { 0x0e4d19, 3 },
69 { 0x0e5da8, 4 },
70 { 0x107097, 5 },
71 { 0x116975, 6 },
72 { 0x1252d9, 7 },
73 { 0x131fa4, 8 },
74 { 0x13d5e1, 9 },
75 { 0x148e53, 10 },
76 { 0x15358b, 11 },
77 { 0x15dd29, 12 },
78 { 0x168112, 13 },
79 { 0x170b61, 14 },
80 { 0xffffff, 15 },
81};
82
83/* QAM16 SNR lookup table */
84static struct snr_table qam16_snr_table[] = {
85 { 0x05eb62, 5 },
86 { 0x05fecf, 6 },
87 { 0x060b80, 7 },
88 { 0x062501, 8 },
89 { 0x064865, 9 },
90 { 0x069604, 10 },
91 { 0x06f356, 11 },
92 { 0x07706a, 12 },
93 { 0x0804d3, 13 },
94 { 0x089d1a, 14 },
95 { 0x093e3d, 15 },
96 { 0x09e35d, 16 },
97 { 0x0a7c3c, 17 },
98 { 0x0afaf8, 18 },
99 { 0x0b719d, 19 },
100 { 0xffffff, 20 },
101};
102
103/* QAM64 SNR lookup table */
104static struct snr_table qam64_snr_table[] = {
105 { 0x03109b, 12 },
106 { 0x0310d4, 13 },
107 { 0x031920, 14 },
108 { 0x0322d0, 15 },
109 { 0x0339fc, 16 },
110 { 0x0364a1, 17 },
111 { 0x038bcc, 18 },
112 { 0x03c7d3, 19 },
113 { 0x0408cc, 20 },
114 { 0x043bed, 21 },
115 { 0x048061, 22 },
116 { 0x04be95, 23 },
117 { 0x04fa7d, 24 },
118 { 0x052405, 25 },
119 { 0x05570d, 26 },
120 { 0xffffff, 27 },
121};
122
123static struct regdesc ofsm_init[] = {
124 { 0xd73a, 0, 8, 0xa1 },
125 { 0xd73b, 0, 8, 0x1f },
126 { 0xd73c, 4, 4, 0x0a },
127 { 0xd732, 3, 1, 0x00 },
128 { 0xd731, 4, 2, 0x03 },
129 { 0xd73d, 7, 1, 0x01 },
130 { 0xd740, 0, 1, 0x00 },
131 { 0xd740, 1, 1, 0x00 },
132 { 0xd740, 2, 1, 0x00 },
133 { 0xd740, 3, 1, 0x01 },
134 { 0xd3c1, 4, 1, 0x01 },
Antti Palosaari3b11f4e2010-05-14 13:59:50 -0300135 { 0x9124, 0, 8, 0x58 },
136 { 0x9125, 0, 2, 0x02 },
Antti Palosaari825b9672008-09-15 15:01:52 -0300137 { 0xd3a2, 0, 8, 0x00 },
138 { 0xd3a3, 0, 8, 0x04 },
139 { 0xd305, 0, 8, 0x32 },
140 { 0xd306, 0, 8, 0x10 },
141 { 0xd304, 0, 8, 0x04 },
142 { 0x9112, 0, 1, 0x01 },
143 { 0x911d, 0, 1, 0x01 },
144 { 0x911a, 0, 1, 0x01 },
145 { 0x911b, 0, 1, 0x01 },
146 { 0x9bce, 0, 4, 0x02 },
147 { 0x9116, 0, 1, 0x01 },
Antti Palosaari3b11f4e2010-05-14 13:59:50 -0300148 { 0x9122, 0, 8, 0xd0 },
Antti Palosaari825b9672008-09-15 15:01:52 -0300149 { 0xd2e0, 0, 8, 0xd0 },
150 { 0xd2e9, 0, 4, 0x0d },
151 { 0xd38c, 0, 8, 0xfc },
152 { 0xd38d, 0, 8, 0x00 },
153 { 0xd38e, 0, 8, 0x7e },
154 { 0xd38f, 0, 8, 0x00 },
155 { 0xd390, 0, 8, 0x2f },
156 { 0xd145, 4, 1, 0x01 },
157 { 0xd1a9, 4, 1, 0x01 },
158 { 0xd158, 5, 3, 0x01 },
159 { 0xd159, 0, 6, 0x06 },
160 { 0xd167, 0, 8, 0x00 },
161 { 0xd168, 0, 4, 0x07 },
162 { 0xd1c3, 5, 3, 0x00 },
163 { 0xd1c4, 0, 6, 0x00 },
164 { 0xd1c5, 0, 7, 0x10 },
165 { 0xd1c6, 0, 3, 0x02 },
166 { 0xd080, 2, 5, 0x03 },
167 { 0xd081, 4, 4, 0x09 },
168 { 0xd098, 4, 4, 0x0f },
169 { 0xd098, 0, 4, 0x03 },
Antti Palosaari825b9672008-09-15 15:01:52 -0300170 { 0xdbc0, 4, 1, 0x01 },
171 { 0xdbc7, 0, 8, 0x08 },
172 { 0xdbc8, 4, 4, 0x00 },
173 { 0xdbc9, 0, 5, 0x01 },
174 { 0xd280, 0, 8, 0xe0 },
175 { 0xd281, 0, 8, 0xff },
176 { 0xd282, 0, 8, 0xff },
177 { 0xd283, 0, 8, 0xc3 },
178 { 0xd284, 0, 8, 0xff },
179 { 0xd285, 0, 4, 0x01 },
180 { 0xd0f0, 0, 7, 0x1a },
181 { 0xd0f1, 4, 1, 0x01 },
182 { 0xd0f2, 0, 8, 0x0c },
Antti Palosaari3b11f4e2010-05-14 13:59:50 -0300183 { 0xd101, 5, 3, 0x06 },
Antti Palosaari825b9672008-09-15 15:01:52 -0300184 { 0xd103, 0, 4, 0x08 },
185 { 0xd0f8, 0, 7, 0x20 },
186 { 0xd111, 5, 1, 0x00 },
187 { 0xd111, 6, 1, 0x00 },
188 { 0x910b, 0, 8, 0x0a },
189 { 0x9115, 0, 8, 0x02 },
190 { 0x910c, 0, 8, 0x02 },
191 { 0x910d, 0, 8, 0x08 },
192 { 0x910e, 0, 8, 0x0a },
193 { 0x9bf6, 0, 8, 0x06 },
194 { 0x9bf8, 0, 8, 0x02 },
195 { 0x9bf7, 0, 8, 0x05 },
196 { 0x9bf9, 0, 8, 0x0f },
197 { 0x9bfc, 0, 8, 0x13 },
198 { 0x9bd3, 0, 8, 0xff },
199 { 0x9bbe, 0, 1, 0x01 },
200 { 0x9bcc, 0, 1, 0x01 },
201};
202
203/* Panasonic ENV77H11D5 tuner init
204 AF9013_TUNER_ENV77H11D5 = 129 */
205static struct regdesc tuner_init_env77h11d5[] = {
206 { 0x9bd5, 0, 8, 0x01 },
207 { 0x9bd6, 0, 8, 0x03 },
208 { 0x9bbe, 0, 8, 0x01 },
209 { 0xd1a0, 1, 1, 0x01 },
210 { 0xd000, 0, 1, 0x01 },
211 { 0xd000, 1, 1, 0x00 },
212 { 0xd001, 1, 1, 0x01 },
213 { 0xd001, 0, 1, 0x00 },
214 { 0xd001, 5, 1, 0x00 },
215 { 0xd002, 0, 5, 0x19 },
216 { 0xd003, 0, 5, 0x1a },
217 { 0xd004, 0, 5, 0x19 },
218 { 0xd005, 0, 5, 0x1a },
219 { 0xd00e, 0, 5, 0x10 },
220 { 0xd00f, 0, 3, 0x04 },
221 { 0xd00f, 3, 3, 0x05 },
222 { 0xd010, 0, 3, 0x04 },
223 { 0xd010, 3, 3, 0x05 },
224 { 0xd016, 4, 4, 0x03 },
225 { 0xd01f, 0, 6, 0x0a },
226 { 0xd020, 0, 6, 0x0a },
227 { 0x9bda, 0, 8, 0x00 },
228 { 0x9be3, 0, 8, 0x00 },
229 { 0xd015, 0, 8, 0x50 },
230 { 0xd016, 0, 1, 0x00 },
231 { 0xd044, 0, 8, 0x46 },
232 { 0xd045, 0, 1, 0x00 },
233 { 0xd008, 0, 8, 0xdf },
234 { 0xd009, 0, 2, 0x02 },
235 { 0xd006, 0, 8, 0x44 },
236 { 0xd007, 0, 2, 0x01 },
237 { 0xd00c, 0, 8, 0xeb },
238 { 0xd00d, 0, 2, 0x02 },
239 { 0xd00a, 0, 8, 0xf4 },
240 { 0xd00b, 0, 2, 0x01 },
241 { 0x9bba, 0, 8, 0xf9 },
242 { 0x9bc3, 0, 8, 0xdf },
243 { 0x9bc4, 0, 8, 0x02 },
244 { 0x9bc5, 0, 8, 0xeb },
245 { 0x9bc6, 0, 8, 0x02 },
246 { 0x9bc9, 0, 8, 0x52 },
247 { 0xd011, 0, 8, 0x3c },
248 { 0xd012, 0, 2, 0x01 },
249 { 0xd013, 0, 8, 0xf7 },
250 { 0xd014, 0, 2, 0x02 },
251 { 0xd040, 0, 8, 0x0b },
252 { 0xd041, 0, 2, 0x02 },
253 { 0xd042, 0, 8, 0x4d },
254 { 0xd043, 0, 2, 0x00 },
255 { 0xd045, 1, 1, 0x00 },
256 { 0x9bcf, 0, 1, 0x01 },
257 { 0xd045, 2, 1, 0x01 },
258 { 0xd04f, 0, 8, 0x9a },
259 { 0xd050, 0, 1, 0x01 },
260 { 0xd051, 0, 8, 0x5a },
261 { 0xd052, 0, 1, 0x01 },
262 { 0xd053, 0, 8, 0x50 },
263 { 0xd054, 0, 8, 0x46 },
264 { 0x9bd7, 0, 8, 0x0a },
265 { 0x9bd8, 0, 8, 0x14 },
266 { 0x9bd9, 0, 8, 0x08 },
267};
268
269/* Microtune MT2060 tuner init
270 AF9013_TUNER_MT2060 = 130 */
271static struct regdesc tuner_init_mt2060[] = {
272 { 0x9bd5, 0, 8, 0x01 },
273 { 0x9bd6, 0, 8, 0x07 },
274 { 0xd1a0, 1, 1, 0x01 },
275 { 0xd000, 0, 1, 0x01 },
276 { 0xd000, 1, 1, 0x00 },
277 { 0xd001, 1, 1, 0x01 },
278 { 0xd001, 0, 1, 0x00 },
279 { 0xd001, 5, 1, 0x00 },
280 { 0xd002, 0, 5, 0x19 },
281 { 0xd003, 0, 5, 0x1a },
282 { 0xd004, 0, 5, 0x19 },
283 { 0xd005, 0, 5, 0x1a },
284 { 0xd00e, 0, 5, 0x10 },
285 { 0xd00f, 0, 3, 0x04 },
286 { 0xd00f, 3, 3, 0x05 },
287 { 0xd010, 0, 3, 0x04 },
288 { 0xd010, 3, 3, 0x05 },
289 { 0xd016, 4, 4, 0x03 },
290 { 0xd01f, 0, 6, 0x0a },
291 { 0xd020, 0, 6, 0x0a },
292 { 0x9bda, 0, 8, 0x00 },
293 { 0x9be3, 0, 8, 0x00 },
294 { 0x9bbe, 0, 1, 0x00 },
295 { 0x9bcc, 0, 1, 0x00 },
296 { 0x9bb9, 0, 8, 0x75 },
297 { 0x9bcd, 0, 8, 0x24 },
298 { 0x9bff, 0, 8, 0x30 },
299 { 0xd015, 0, 8, 0x46 },
300 { 0xd016, 0, 1, 0x00 },
301 { 0xd044, 0, 8, 0x46 },
302 { 0xd045, 0, 1, 0x00 },
303 { 0xd008, 0, 8, 0x0f },
304 { 0xd009, 0, 2, 0x02 },
305 { 0xd006, 0, 8, 0x32 },
306 { 0xd007, 0, 2, 0x01 },
307 { 0xd00c, 0, 8, 0x36 },
308 { 0xd00d, 0, 2, 0x03 },
309 { 0xd00a, 0, 8, 0x35 },
310 { 0xd00b, 0, 2, 0x01 },
311 { 0x9bc7, 0, 8, 0x07 },
312 { 0x9bc8, 0, 8, 0x90 },
313 { 0x9bc3, 0, 8, 0x0f },
314 { 0x9bc4, 0, 8, 0x02 },
315 { 0x9bc5, 0, 8, 0x36 },
316 { 0x9bc6, 0, 8, 0x03 },
317 { 0x9bba, 0, 8, 0xc9 },
318 { 0x9bc9, 0, 8, 0x79 },
319 { 0xd011, 0, 8, 0x10 },
320 { 0xd012, 0, 2, 0x01 },
321 { 0xd013, 0, 8, 0x45 },
322 { 0xd014, 0, 2, 0x03 },
323 { 0xd040, 0, 8, 0x98 },
324 { 0xd041, 0, 2, 0x00 },
325 { 0xd042, 0, 8, 0xcf },
326 { 0xd043, 0, 2, 0x03 },
327 { 0xd045, 1, 1, 0x00 },
328 { 0x9bcf, 0, 1, 0x01 },
329 { 0xd045, 2, 1, 0x01 },
330 { 0xd04f, 0, 8, 0x9a },
331 { 0xd050, 0, 1, 0x01 },
332 { 0xd051, 0, 8, 0x5a },
333 { 0xd052, 0, 1, 0x01 },
334 { 0xd053, 0, 8, 0x50 },
335 { 0xd054, 0, 8, 0x46 },
336 { 0x9bd7, 0, 8, 0x0a },
337 { 0x9bd8, 0, 8, 0x14 },
338 { 0x9bd9, 0, 8, 0x08 },
339 { 0x9bd0, 0, 8, 0xcc },
340 { 0x9be4, 0, 8, 0xa0 },
341 { 0x9bbd, 0, 8, 0x8e },
342 { 0x9be2, 0, 8, 0x4d },
343 { 0x9bee, 0, 1, 0x01 },
344};
345
346/* Microtune MT2060 tuner init
347 AF9013_TUNER_MT2060_2 = 147 */
348static struct regdesc tuner_init_mt2060_2[] = {
349 { 0x9bd5, 0, 8, 0x01 },
350 { 0x9bd6, 0, 8, 0x06 },
351 { 0x9bbe, 0, 8, 0x01 },
352 { 0xd1a0, 1, 1, 0x01 },
353 { 0xd000, 0, 1, 0x01 },
354 { 0xd000, 1, 1, 0x00 },
355 { 0xd001, 1, 1, 0x01 },
356 { 0xd001, 0, 1, 0x00 },
357 { 0xd001, 5, 1, 0x00 },
358 { 0xd002, 0, 5, 0x19 },
359 { 0xd003, 0, 5, 0x1a },
360 { 0xd004, 0, 5, 0x19 },
361 { 0xd005, 0, 5, 0x1a },
362 { 0xd00e, 0, 5, 0x10 },
363 { 0xd00f, 0, 3, 0x04 },
364 { 0xd00f, 3, 3, 0x05 },
365 { 0xd010, 0, 3, 0x04 },
366 { 0xd010, 3, 3, 0x05 },
367 { 0xd016, 4, 4, 0x03 },
368 { 0xd01f, 0, 6, 0x0a },
369 { 0xd020, 0, 6, 0x0a },
370 { 0xd015, 0, 8, 0x46 },
371 { 0xd016, 0, 1, 0x00 },
372 { 0xd044, 0, 8, 0x46 },
373 { 0xd045, 0, 1, 0x00 },
374 { 0xd008, 0, 8, 0x0f },
375 { 0xd009, 0, 2, 0x02 },
376 { 0xd006, 0, 8, 0x32 },
377 { 0xd007, 0, 2, 0x01 },
378 { 0xd00c, 0, 8, 0x36 },
379 { 0xd00d, 0, 2, 0x03 },
380 { 0xd00a, 0, 8, 0x35 },
381 { 0xd00b, 0, 2, 0x01 },
382 { 0x9bc7, 0, 8, 0x07 },
383 { 0x9bc8, 0, 8, 0x90 },
384 { 0x9bc3, 0, 8, 0x0f },
385 { 0x9bc4, 0, 8, 0x02 },
386 { 0x9bc5, 0, 8, 0x36 },
387 { 0x9bc6, 0, 8, 0x03 },
388 { 0x9bba, 0, 8, 0xc9 },
389 { 0x9bc9, 0, 8, 0x79 },
390 { 0xd011, 0, 8, 0x10 },
391 { 0xd012, 0, 2, 0x01 },
392 { 0xd013, 0, 8, 0x45 },
393 { 0xd014, 0, 2, 0x03 },
394 { 0xd040, 0, 8, 0x98 },
395 { 0xd041, 0, 2, 0x00 },
396 { 0xd042, 0, 8, 0xcf },
397 { 0xd043, 0, 2, 0x03 },
398 { 0xd045, 1, 1, 0x00 },
399 { 0x9bcf, 0, 8, 0x01 },
400 { 0xd045, 2, 1, 0x01 },
401 { 0xd04f, 0, 8, 0x9a },
402 { 0xd050, 0, 1, 0x01 },
403 { 0xd051, 0, 8, 0x5a },
404 { 0xd052, 0, 1, 0x01 },
405 { 0xd053, 0, 8, 0x96 },
406 { 0xd054, 0, 8, 0x46 },
407 { 0xd045, 7, 1, 0x00 },
408 { 0x9bd7, 0, 8, 0x0a },
409 { 0x9bd8, 0, 8, 0x14 },
410 { 0x9bd9, 0, 8, 0x08 },
411};
412
413/* MaxLinear MXL5003 tuner init
414 AF9013_TUNER_MXL5003D = 3 */
415static struct regdesc tuner_init_mxl5003d[] = {
416 { 0x9bd5, 0, 8, 0x01 },
417 { 0x9bd6, 0, 8, 0x09 },
418 { 0xd1a0, 1, 1, 0x01 },
419 { 0xd000, 0, 1, 0x01 },
420 { 0xd000, 1, 1, 0x00 },
421 { 0xd001, 1, 1, 0x01 },
422 { 0xd001, 0, 1, 0x00 },
423 { 0xd001, 5, 1, 0x00 },
424 { 0xd002, 0, 5, 0x19 },
425 { 0xd003, 0, 5, 0x1a },
426 { 0xd004, 0, 5, 0x19 },
427 { 0xd005, 0, 5, 0x1a },
428 { 0xd00e, 0, 5, 0x10 },
429 { 0xd00f, 0, 3, 0x04 },
430 { 0xd00f, 3, 3, 0x05 },
431 { 0xd010, 0, 3, 0x04 },
432 { 0xd010, 3, 3, 0x05 },
433 { 0xd016, 4, 4, 0x03 },
434 { 0xd01f, 0, 6, 0x0a },
435 { 0xd020, 0, 6, 0x0a },
436 { 0x9bda, 0, 8, 0x00 },
437 { 0x9be3, 0, 8, 0x00 },
438 { 0x9bfc, 0, 8, 0x0f },
439 { 0x9bf6, 0, 8, 0x01 },
440 { 0x9bbe, 0, 1, 0x01 },
441 { 0xd015, 0, 8, 0x33 },
442 { 0xd016, 0, 1, 0x00 },
443 { 0xd044, 0, 8, 0x40 },
444 { 0xd045, 0, 1, 0x00 },
445 { 0xd008, 0, 8, 0x0f },
446 { 0xd009, 0, 2, 0x02 },
447 { 0xd006, 0, 8, 0x6c },
448 { 0xd007, 0, 2, 0x00 },
449 { 0xd00c, 0, 8, 0x3d },
450 { 0xd00d, 0, 2, 0x00 },
451 { 0xd00a, 0, 8, 0x45 },
452 { 0xd00b, 0, 2, 0x01 },
453 { 0x9bc7, 0, 8, 0x07 },
454 { 0x9bc8, 0, 8, 0x52 },
455 { 0x9bc3, 0, 8, 0x0f },
456 { 0x9bc4, 0, 8, 0x02 },
457 { 0x9bc5, 0, 8, 0x3d },
458 { 0x9bc6, 0, 8, 0x00 },
459 { 0x9bba, 0, 8, 0xa2 },
460 { 0x9bc9, 0, 8, 0xa0 },
461 { 0xd011, 0, 8, 0x56 },
462 { 0xd012, 0, 2, 0x00 },
463 { 0xd013, 0, 8, 0x50 },
464 { 0xd014, 0, 2, 0x00 },
465 { 0xd040, 0, 8, 0x56 },
466 { 0xd041, 0, 2, 0x00 },
467 { 0xd042, 0, 8, 0x50 },
468 { 0xd043, 0, 2, 0x00 },
469 { 0xd045, 1, 1, 0x00 },
470 { 0x9bcf, 0, 8, 0x01 },
471 { 0xd045, 2, 1, 0x01 },
472 { 0xd04f, 0, 8, 0x9a },
473 { 0xd050, 0, 1, 0x01 },
474 { 0xd051, 0, 8, 0x5a },
475 { 0xd052, 0, 1, 0x01 },
476 { 0xd053, 0, 8, 0x50 },
477 { 0xd054, 0, 8, 0x46 },
478 { 0x9bd7, 0, 8, 0x0a },
479 { 0x9bd8, 0, 8, 0x14 },
480 { 0x9bd9, 0, 8, 0x08 },
481};
482
483/* MaxLinear MXL5005 tuner init
484 AF9013_TUNER_MXL5005D = 13
485 AF9013_TUNER_MXL5005R = 30 */
486static struct regdesc tuner_init_mxl5005[] = {
487 { 0x9bd5, 0, 8, 0x01 },
488 { 0x9bd6, 0, 8, 0x07 },
489 { 0xd1a0, 1, 1, 0x01 },
490 { 0xd000, 0, 1, 0x01 },
491 { 0xd000, 1, 1, 0x00 },
492 { 0xd001, 1, 1, 0x01 },
493 { 0xd001, 0, 1, 0x00 },
494 { 0xd001, 5, 1, 0x00 },
495 { 0xd002, 0, 5, 0x19 },
496 { 0xd003, 0, 5, 0x1a },
497 { 0xd004, 0, 5, 0x19 },
498 { 0xd005, 0, 5, 0x1a },
499 { 0xd00e, 0, 5, 0x10 },
500 { 0xd00f, 0, 3, 0x04 },
501 { 0xd00f, 3, 3, 0x05 },
502 { 0xd010, 0, 3, 0x04 },
503 { 0xd010, 3, 3, 0x05 },
504 { 0xd016, 4, 4, 0x03 },
505 { 0xd01f, 0, 6, 0x0a },
506 { 0xd020, 0, 6, 0x0a },
507 { 0x9bda, 0, 8, 0x01 },
508 { 0x9be3, 0, 8, 0x01 },
509 { 0x9bbe, 0, 1, 0x01 },
510 { 0x9bcc, 0, 1, 0x01 },
511 { 0x9bb9, 0, 8, 0x00 },
512 { 0x9bcd, 0, 8, 0x28 },
513 { 0x9bff, 0, 8, 0x24 },
514 { 0xd015, 0, 8, 0x40 },
515 { 0xd016, 0, 1, 0x00 },
516 { 0xd044, 0, 8, 0x40 },
517 { 0xd045, 0, 1, 0x00 },
518 { 0xd008, 0, 8, 0x0f },
519 { 0xd009, 0, 2, 0x02 },
520 { 0xd006, 0, 8, 0x73 },
521 { 0xd007, 0, 2, 0x01 },
522 { 0xd00c, 0, 8, 0xfa },
523 { 0xd00d, 0, 2, 0x01 },
524 { 0xd00a, 0, 8, 0xff },
525 { 0xd00b, 0, 2, 0x01 },
526 { 0x9bc7, 0, 8, 0x23 },
527 { 0x9bc8, 0, 8, 0x55 },
528 { 0x9bc3, 0, 8, 0x01 },
529 { 0x9bc4, 0, 8, 0x02 },
530 { 0x9bc5, 0, 8, 0xfa },
531 { 0x9bc6, 0, 8, 0x01 },
532 { 0x9bba, 0, 8, 0xff },
533 { 0x9bc9, 0, 8, 0xff },
534 { 0x9bd3, 0, 8, 0x95 },
535 { 0xd011, 0, 8, 0x70 },
536 { 0xd012, 0, 2, 0x01 },
537 { 0xd013, 0, 8, 0xfb },
538 { 0xd014, 0, 2, 0x01 },
539 { 0xd040, 0, 8, 0x70 },
540 { 0xd041, 0, 2, 0x01 },
541 { 0xd042, 0, 8, 0xfb },
542 { 0xd043, 0, 2, 0x01 },
543 { 0xd045, 1, 1, 0x00 },
544 { 0x9bcf, 0, 1, 0x01 },
545 { 0xd045, 2, 1, 0x01 },
546 { 0xd04f, 0, 8, 0x9a },
547 { 0xd050, 0, 1, 0x01 },
548 { 0xd051, 0, 8, 0x5a },
549 { 0xd052, 0, 1, 0x01 },
550 { 0xd053, 0, 8, 0x50 },
551 { 0xd054, 0, 8, 0x46 },
552 { 0x9bd7, 0, 8, 0x0a },
553 { 0x9bd8, 0, 8, 0x14 },
554 { 0x9bd9, 0, 8, 0x08 },
555 { 0x9bd0, 0, 8, 0x93 },
556 { 0x9be4, 0, 8, 0xfe },
557 { 0x9bbd, 0, 8, 0x63 },
558 { 0x9be2, 0, 8, 0xfe },
559 { 0x9bee, 0, 1, 0x01 },
560};
561
562/* Quantek QT1010 tuner init
563 AF9013_TUNER_QT1010 = 134
564 AF9013_TUNER_QT1010A = 162 */
565static struct regdesc tuner_init_qt1010[] = {
566 { 0x9bd5, 0, 8, 0x01 },
567 { 0x9bd6, 0, 8, 0x09 },
568 { 0xd1a0, 1, 1, 0x01 },
569 { 0xd000, 0, 1, 0x01 },
570 { 0xd000, 1, 1, 0x00 },
571 { 0xd001, 1, 1, 0x01 },
572 { 0xd001, 0, 1, 0x00 },
573 { 0xd001, 5, 1, 0x00 },
574 { 0xd002, 0, 5, 0x19 },
575 { 0xd003, 0, 5, 0x1a },
576 { 0xd004, 0, 5, 0x19 },
577 { 0xd005, 0, 5, 0x1a },
578 { 0xd00e, 0, 5, 0x10 },
579 { 0xd00f, 0, 3, 0x04 },
580 { 0xd00f, 3, 3, 0x05 },
581 { 0xd010, 0, 3, 0x04 },
582 { 0xd010, 3, 3, 0x05 },
583 { 0xd016, 4, 4, 0x03 },
584 { 0xd01f, 0, 6, 0x0a },
585 { 0xd020, 0, 6, 0x0a },
586 { 0x9bda, 0, 8, 0x01 },
587 { 0x9be3, 0, 8, 0x01 },
588 { 0xd015, 0, 8, 0x46 },
589 { 0xd016, 0, 1, 0x00 },
590 { 0xd044, 0, 8, 0x46 },
591 { 0xd045, 0, 1, 0x00 },
592 { 0x9bbe, 0, 1, 0x01 },
593 { 0x9bcc, 0, 1, 0x01 },
594 { 0x9bb9, 0, 8, 0x00 },
595 { 0x9bcd, 0, 8, 0x28 },
596 { 0x9bff, 0, 8, 0x20 },
597 { 0xd008, 0, 8, 0x0f },
598 { 0xd009, 0, 2, 0x02 },
599 { 0xd006, 0, 8, 0x99 },
600 { 0xd007, 0, 2, 0x01 },
601 { 0xd00c, 0, 8, 0x0f },
602 { 0xd00d, 0, 2, 0x02 },
603 { 0xd00a, 0, 8, 0x50 },
604 { 0xd00b, 0, 2, 0x01 },
605 { 0x9bc7, 0, 8, 0x00 },
606 { 0x9bc8, 0, 8, 0x00 },
607 { 0x9bc3, 0, 8, 0x0f },
608 { 0x9bc4, 0, 8, 0x02 },
609 { 0x9bc5, 0, 8, 0x0f },
610 { 0x9bc6, 0, 8, 0x02 },
611 { 0x9bba, 0, 8, 0xc5 },
612 { 0x9bc9, 0, 8, 0xff },
613 { 0xd011, 0, 8, 0x58 },
614 { 0xd012, 0, 2, 0x02 },
615 { 0xd013, 0, 8, 0x89 },
616 { 0xd014, 0, 2, 0x01 },
617 { 0xd040, 0, 8, 0x58 },
618 { 0xd041, 0, 2, 0x02 },
619 { 0xd042, 0, 8, 0x89 },
620 { 0xd043, 0, 2, 0x01 },
621 { 0xd045, 1, 1, 0x00 },
622 { 0x9bcf, 0, 1, 0x01 },
623 { 0xd045, 2, 1, 0x01 },
624 { 0xd04f, 0, 8, 0x9a },
625 { 0xd050, 0, 1, 0x01 },
626 { 0xd051, 0, 8, 0x5a },
627 { 0xd052, 0, 1, 0x01 },
628 { 0xd053, 0, 8, 0x50 },
629 { 0xd054, 0, 8, 0x46 },
630 { 0x9bd7, 0, 8, 0x0a },
631 { 0x9bd8, 0, 8, 0x14 },
632 { 0x9bd9, 0, 8, 0x08 },
633 { 0x9bd0, 0, 8, 0xcd },
634 { 0x9be4, 0, 8, 0xbb },
635 { 0x9bbd, 0, 8, 0x93 },
636 { 0x9be2, 0, 8, 0x80 },
637 { 0x9bee, 0, 1, 0x01 },
638};
639
640/* Freescale MC44S803 tuner init
641 AF9013_TUNER_MC44S803 = 133 */
642static struct regdesc tuner_init_mc44s803[] = {
643 { 0x9bd5, 0, 8, 0x01 },
644 { 0x9bd6, 0, 8, 0x06 },
645 { 0xd1a0, 1, 1, 0x01 },
646 { 0xd000, 0, 1, 0x01 },
647 { 0xd000, 1, 1, 0x00 },
648 { 0xd001, 1, 1, 0x01 },
649 { 0xd001, 0, 1, 0x00 },
650 { 0xd001, 5, 1, 0x00 },
651 { 0xd002, 0, 5, 0x19 },
652 { 0xd003, 0, 5, 0x1a },
653 { 0xd004, 0, 5, 0x19 },
654 { 0xd005, 0, 5, 0x1a },
655 { 0xd00e, 0, 5, 0x10 },
656 { 0xd00f, 0, 3, 0x04 },
657 { 0xd00f, 3, 3, 0x05 },
658 { 0xd010, 0, 3, 0x04 },
659 { 0xd010, 3, 3, 0x05 },
660 { 0xd016, 4, 4, 0x03 },
661 { 0xd01f, 0, 6, 0x0a },
662 { 0xd020, 0, 6, 0x0a },
663 { 0x9bda, 0, 8, 0x00 },
664 { 0x9be3, 0, 8, 0x00 },
665 { 0x9bf6, 0, 8, 0x01 },
666 { 0x9bf8, 0, 8, 0x02 },
667 { 0x9bf9, 0, 8, 0x02 },
668 { 0x9bfc, 0, 8, 0x1f },
669 { 0x9bbe, 0, 1, 0x01 },
670 { 0x9bcc, 0, 1, 0x01 },
671 { 0x9bb9, 0, 8, 0x00 },
672 { 0x9bcd, 0, 8, 0x24 },
673 { 0x9bff, 0, 8, 0x24 },
674 { 0xd015, 0, 8, 0x46 },
675 { 0xd016, 0, 1, 0x00 },
676 { 0xd044, 0, 8, 0x46 },
677 { 0xd045, 0, 1, 0x00 },
678 { 0xd008, 0, 8, 0x01 },
679 { 0xd009, 0, 2, 0x02 },
680 { 0xd006, 0, 8, 0x7b },
681 { 0xd007, 0, 2, 0x00 },
682 { 0xd00c, 0, 8, 0x7c },
683 { 0xd00d, 0, 2, 0x02 },
684 { 0xd00a, 0, 8, 0xfe },
685 { 0xd00b, 0, 2, 0x01 },
686 { 0x9bc7, 0, 8, 0x08 },
687 { 0x9bc8, 0, 8, 0x9a },
688 { 0x9bc3, 0, 8, 0x01 },
689 { 0x9bc4, 0, 8, 0x02 },
690 { 0x9bc5, 0, 8, 0x7c },
691 { 0x9bc6, 0, 8, 0x02 },
692 { 0x9bba, 0, 8, 0xfc },
693 { 0x9bc9, 0, 8, 0xaa },
694 { 0xd011, 0, 8, 0x6b },
695 { 0xd012, 0, 2, 0x00 },
696 { 0xd013, 0, 8, 0x88 },
697 { 0xd014, 0, 2, 0x02 },
698 { 0xd040, 0, 8, 0x6b },
699 { 0xd041, 0, 2, 0x00 },
700 { 0xd042, 0, 8, 0x7c },
701 { 0xd043, 0, 2, 0x02 },
702 { 0xd045, 1, 1, 0x00 },
703 { 0x9bcf, 0, 1, 0x01 },
704 { 0xd045, 2, 1, 0x01 },
705 { 0xd04f, 0, 8, 0x9a },
706 { 0xd050, 0, 1, 0x01 },
707 { 0xd051, 0, 8, 0x5a },
708 { 0xd052, 0, 1, 0x01 },
709 { 0xd053, 0, 8, 0x50 },
710 { 0xd054, 0, 8, 0x46 },
711 { 0x9bd7, 0, 8, 0x0a },
712 { 0x9bd8, 0, 8, 0x14 },
713 { 0x9bd9, 0, 8, 0x08 },
714 { 0x9bd0, 0, 8, 0x9e },
715 { 0x9be4, 0, 8, 0xff },
716 { 0x9bbd, 0, 8, 0x9e },
717 { 0x9be2, 0, 8, 0x25 },
718 { 0x9bee, 0, 1, 0x01 },
719 { 0xd73b, 3, 1, 0x00 },
720};
721
722/* unknown, probably for tin can tuner, tuner init
723 AF9013_TUNER_UNKNOWN = 140 */
724static struct regdesc tuner_init_unknown[] = {
725 { 0x9bd5, 0, 8, 0x01 },
726 { 0x9bd6, 0, 8, 0x02 },
727 { 0xd1a0, 1, 1, 0x01 },
728 { 0xd000, 0, 1, 0x01 },
729 { 0xd000, 1, 1, 0x00 },
730 { 0xd001, 1, 1, 0x01 },
731 { 0xd001, 0, 1, 0x00 },
732 { 0xd001, 5, 1, 0x00 },
733 { 0xd002, 0, 5, 0x19 },
734 { 0xd003, 0, 5, 0x1a },
735 { 0xd004, 0, 5, 0x19 },
736 { 0xd005, 0, 5, 0x1a },
737 { 0xd00e, 0, 5, 0x10 },
738 { 0xd00f, 0, 3, 0x04 },
739 { 0xd00f, 3, 3, 0x05 },
740 { 0xd010, 0, 3, 0x04 },
741 { 0xd010, 3, 3, 0x05 },
742 { 0xd016, 4, 4, 0x03 },
743 { 0xd01f, 0, 6, 0x0a },
744 { 0xd020, 0, 6, 0x0a },
745 { 0x9bda, 0, 8, 0x01 },
746 { 0x9be3, 0, 8, 0x01 },
747 { 0xd1a0, 1, 1, 0x00 },
748 { 0x9bbe, 0, 1, 0x01 },
749 { 0x9bcc, 0, 1, 0x01 },
750 { 0x9bb9, 0, 8, 0x00 },
751 { 0x9bcd, 0, 8, 0x18 },
752 { 0x9bff, 0, 8, 0x2c },
753 { 0xd015, 0, 8, 0x46 },
754 { 0xd016, 0, 1, 0x00 },
755 { 0xd044, 0, 8, 0x46 },
756 { 0xd045, 0, 1, 0x00 },
757 { 0xd008, 0, 8, 0xdf },
758 { 0xd009, 0, 2, 0x02 },
759 { 0xd006, 0, 8, 0x44 },
760 { 0xd007, 0, 2, 0x01 },
761 { 0xd00c, 0, 8, 0x00 },
762 { 0xd00d, 0, 2, 0x02 },
763 { 0xd00a, 0, 8, 0xf6 },
764 { 0xd00b, 0, 2, 0x01 },
765 { 0x9bba, 0, 8, 0xf9 },
766 { 0x9bc8, 0, 8, 0xaa },
767 { 0x9bc3, 0, 8, 0xdf },
768 { 0x9bc4, 0, 8, 0x02 },
769 { 0x9bc5, 0, 8, 0x00 },
770 { 0x9bc6, 0, 8, 0x02 },
771 { 0x9bc9, 0, 8, 0xf0 },
772 { 0xd011, 0, 8, 0x3c },
773 { 0xd012, 0, 2, 0x01 },
774 { 0xd013, 0, 8, 0xf7 },
775 { 0xd014, 0, 2, 0x02 },
776 { 0xd040, 0, 8, 0x0b },
777 { 0xd041, 0, 2, 0x02 },
778 { 0xd042, 0, 8, 0x4d },
779 { 0xd043, 0, 2, 0x00 },
780 { 0xd045, 1, 1, 0x00 },
781 { 0x9bcf, 0, 1, 0x01 },
782 { 0xd045, 2, 1, 0x01 },
783 { 0xd04f, 0, 8, 0x9a },
784 { 0xd050, 0, 1, 0x01 },
785 { 0xd051, 0, 8, 0x5a },
786 { 0xd052, 0, 1, 0x01 },
787 { 0xd053, 0, 8, 0x50 },
788 { 0xd054, 0, 8, 0x46 },
789 { 0x9bd7, 0, 8, 0x0a },
790 { 0x9bd8, 0, 8, 0x14 },
791 { 0x9bd9, 0, 8, 0x08 },
792};
793
794/* NXP TDA18271 tuner init
795 AF9013_TUNER_TDA18271 = 156 */
796static struct regdesc tuner_init_tda18271[] = {
797 { 0x9bd5, 0, 8, 0x01 },
798 { 0x9bd6, 0, 8, 0x04 },
799 { 0xd1a0, 1, 1, 0x01 },
800 { 0xd000, 0, 1, 0x01 },
801 { 0xd000, 1, 1, 0x00 },
802 { 0xd001, 1, 1, 0x01 },
803 { 0xd001, 0, 1, 0x00 },
804 { 0xd001, 5, 1, 0x00 },
805 { 0xd002, 0, 5, 0x19 },
806 { 0xd003, 0, 5, 0x1a },
807 { 0xd004, 0, 5, 0x19 },
808 { 0xd005, 0, 5, 0x1a },
809 { 0xd00e, 0, 5, 0x10 },
810 { 0xd00f, 0, 3, 0x04 },
811 { 0xd00f, 3, 3, 0x05 },
812 { 0xd010, 0, 3, 0x04 },
813 { 0xd010, 3, 3, 0x05 },
814 { 0xd016, 4, 4, 0x03 },
815 { 0xd01f, 0, 6, 0x0a },
816 { 0xd020, 0, 6, 0x0a },
817 { 0x9bda, 0, 8, 0x01 },
818 { 0x9be3, 0, 8, 0x01 },
819 { 0xd1a0, 1, 1, 0x00 },
820 { 0x9bbe, 0, 1, 0x01 },
821 { 0x9bcc, 0, 1, 0x01 },
822 { 0x9bb9, 0, 8, 0x00 },
823 { 0x9bcd, 0, 8, 0x18 },
824 { 0x9bff, 0, 8, 0x2c },
825 { 0xd015, 0, 8, 0x46 },
826 { 0xd016, 0, 1, 0x00 },
827 { 0xd044, 0, 8, 0x46 },
828 { 0xd045, 0, 1, 0x00 },
829 { 0xd008, 0, 8, 0xdf },
830 { 0xd009, 0, 2, 0x02 },
831 { 0xd006, 0, 8, 0x44 },
832 { 0xd007, 0, 2, 0x01 },
833 { 0xd00c, 0, 8, 0x00 },
834 { 0xd00d, 0, 2, 0x02 },
835 { 0xd00a, 0, 8, 0xf6 },
836 { 0xd00b, 0, 2, 0x01 },
837 { 0x9bba, 0, 8, 0xf9 },
838 { 0x9bc8, 0, 8, 0xaa },
839 { 0x9bc3, 0, 8, 0xdf },
840 { 0x9bc4, 0, 8, 0x02 },
841 { 0x9bc5, 0, 8, 0x00 },
842 { 0x9bc6, 0, 8, 0x02 },
843 { 0x9bc9, 0, 8, 0xf0 },
844 { 0xd011, 0, 8, 0x3c },
845 { 0xd012, 0, 2, 0x01 },
846 { 0xd013, 0, 8, 0xf7 },
847 { 0xd014, 0, 2, 0x02 },
848 { 0xd040, 0, 8, 0x0b },
849 { 0xd041, 0, 2, 0x02 },
850 { 0xd042, 0, 8, 0x4d },
851 { 0xd043, 0, 2, 0x00 },
852 { 0xd045, 1, 1, 0x00 },
853 { 0x9bcf, 0, 1, 0x01 },
854 { 0xd045, 2, 1, 0x01 },
855 { 0xd04f, 0, 8, 0x9a },
856 { 0xd050, 0, 1, 0x01 },
857 { 0xd051, 0, 8, 0x5a },
858 { 0xd052, 0, 1, 0x01 },
859 { 0xd053, 0, 8, 0x50 },
860 { 0xd054, 0, 8, 0x46 },
861 { 0x9bd7, 0, 8, 0x0a },
862 { 0x9bd8, 0, 8, 0x14 },
863 { 0x9bd9, 0, 8, 0x08 },
864 { 0x9bd0, 0, 8, 0xa8 },
865 { 0x9be4, 0, 8, 0x7f },
866 { 0x9bbd, 0, 8, 0xa8 },
867 { 0x9be2, 0, 8, 0x20 },
868 { 0x9bee, 0, 1, 0x01 },
869};
870
871#endif /* _AF9013_PRIV_ */