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