treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / media / tuners / tda18271-maps.c
blob0c78c203826eb732485fc3b8a8550fb039e8b9cf
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 tda18271-maps.c - driver for the Philips / NXP TDA18271 silicon tuner
5 Copyright (C) 2007, 2008 Michael Krufky <mkrufky@linuxtv.org>
7 */
9 #include "tda18271-priv.h"
11 struct tda18271_pll_map {
12 u32 lomax;
13 u8 pd; /* post div */
14 u8 d; /* div */
17 struct tda18271_map {
18 u32 rfmax;
19 u8 val;
22 /*---------------------------------------------------------------------*/
24 static struct tda18271_pll_map tda18271c1_main_pll[] = {
25 { .lomax = 32000, .pd = 0x5f, .d = 0xf0 },
26 { .lomax = 35000, .pd = 0x5e, .d = 0xe0 },
27 { .lomax = 37000, .pd = 0x5d, .d = 0xd0 },
28 { .lomax = 41000, .pd = 0x5c, .d = 0xc0 },
29 { .lomax = 44000, .pd = 0x5b, .d = 0xb0 },
30 { .lomax = 49000, .pd = 0x5a, .d = 0xa0 },
31 { .lomax = 54000, .pd = 0x59, .d = 0x90 },
32 { .lomax = 61000, .pd = 0x58, .d = 0x80 },
33 { .lomax = 65000, .pd = 0x4f, .d = 0x78 },
34 { .lomax = 70000, .pd = 0x4e, .d = 0x70 },
35 { .lomax = 75000, .pd = 0x4d, .d = 0x68 },
36 { .lomax = 82000, .pd = 0x4c, .d = 0x60 },
37 { .lomax = 89000, .pd = 0x4b, .d = 0x58 },
38 { .lomax = 98000, .pd = 0x4a, .d = 0x50 },
39 { .lomax = 109000, .pd = 0x49, .d = 0x48 },
40 { .lomax = 123000, .pd = 0x48, .d = 0x40 },
41 { .lomax = 131000, .pd = 0x3f, .d = 0x3c },
42 { .lomax = 141000, .pd = 0x3e, .d = 0x38 },
43 { .lomax = 151000, .pd = 0x3d, .d = 0x34 },
44 { .lomax = 164000, .pd = 0x3c, .d = 0x30 },
45 { .lomax = 179000, .pd = 0x3b, .d = 0x2c },
46 { .lomax = 197000, .pd = 0x3a, .d = 0x28 },
47 { .lomax = 219000, .pd = 0x39, .d = 0x24 },
48 { .lomax = 246000, .pd = 0x38, .d = 0x20 },
49 { .lomax = 263000, .pd = 0x2f, .d = 0x1e },
50 { .lomax = 282000, .pd = 0x2e, .d = 0x1c },
51 { .lomax = 303000, .pd = 0x2d, .d = 0x1a },
52 { .lomax = 329000, .pd = 0x2c, .d = 0x18 },
53 { .lomax = 359000, .pd = 0x2b, .d = 0x16 },
54 { .lomax = 395000, .pd = 0x2a, .d = 0x14 },
55 { .lomax = 438000, .pd = 0x29, .d = 0x12 },
56 { .lomax = 493000, .pd = 0x28, .d = 0x10 },
57 { .lomax = 526000, .pd = 0x1f, .d = 0x0f },
58 { .lomax = 564000, .pd = 0x1e, .d = 0x0e },
59 { .lomax = 607000, .pd = 0x1d, .d = 0x0d },
60 { .lomax = 658000, .pd = 0x1c, .d = 0x0c },
61 { .lomax = 718000, .pd = 0x1b, .d = 0x0b },
62 { .lomax = 790000, .pd = 0x1a, .d = 0x0a },
63 { .lomax = 877000, .pd = 0x19, .d = 0x09 },
64 { .lomax = 987000, .pd = 0x18, .d = 0x08 },
65 { .lomax = 0, .pd = 0x00, .d = 0x00 }, /* end */
68 static struct tda18271_pll_map tda18271c2_main_pll[] = {
69 { .lomax = 33125, .pd = 0x57, .d = 0xf0 },
70 { .lomax = 35500, .pd = 0x56, .d = 0xe0 },
71 { .lomax = 38188, .pd = 0x55, .d = 0xd0 },
72 { .lomax = 41375, .pd = 0x54, .d = 0xc0 },
73 { .lomax = 45125, .pd = 0x53, .d = 0xb0 },
74 { .lomax = 49688, .pd = 0x52, .d = 0xa0 },
75 { .lomax = 55188, .pd = 0x51, .d = 0x90 },
76 { .lomax = 62125, .pd = 0x50, .d = 0x80 },
77 { .lomax = 66250, .pd = 0x47, .d = 0x78 },
78 { .lomax = 71000, .pd = 0x46, .d = 0x70 },
79 { .lomax = 76375, .pd = 0x45, .d = 0x68 },
80 { .lomax = 82750, .pd = 0x44, .d = 0x60 },
81 { .lomax = 90250, .pd = 0x43, .d = 0x58 },
82 { .lomax = 99375, .pd = 0x42, .d = 0x50 },
83 { .lomax = 110375, .pd = 0x41, .d = 0x48 },
84 { .lomax = 124250, .pd = 0x40, .d = 0x40 },
85 { .lomax = 132500, .pd = 0x37, .d = 0x3c },
86 { .lomax = 142000, .pd = 0x36, .d = 0x38 },
87 { .lomax = 152750, .pd = 0x35, .d = 0x34 },
88 { .lomax = 165500, .pd = 0x34, .d = 0x30 },
89 { .lomax = 180500, .pd = 0x33, .d = 0x2c },
90 { .lomax = 198750, .pd = 0x32, .d = 0x28 },
91 { .lomax = 220750, .pd = 0x31, .d = 0x24 },
92 { .lomax = 248500, .pd = 0x30, .d = 0x20 },
93 { .lomax = 265000, .pd = 0x27, .d = 0x1e },
94 { .lomax = 284000, .pd = 0x26, .d = 0x1c },
95 { .lomax = 305500, .pd = 0x25, .d = 0x1a },
96 { .lomax = 331000, .pd = 0x24, .d = 0x18 },
97 { .lomax = 361000, .pd = 0x23, .d = 0x16 },
98 { .lomax = 397500, .pd = 0x22, .d = 0x14 },
99 { .lomax = 441500, .pd = 0x21, .d = 0x12 },
100 { .lomax = 497000, .pd = 0x20, .d = 0x10 },
101 { .lomax = 530000, .pd = 0x17, .d = 0x0f },
102 { .lomax = 568000, .pd = 0x16, .d = 0x0e },
103 { .lomax = 611000, .pd = 0x15, .d = 0x0d },
104 { .lomax = 662000, .pd = 0x14, .d = 0x0c },
105 { .lomax = 722000, .pd = 0x13, .d = 0x0b },
106 { .lomax = 795000, .pd = 0x12, .d = 0x0a },
107 { .lomax = 883000, .pd = 0x11, .d = 0x09 },
108 { .lomax = 994000, .pd = 0x10, .d = 0x08 },
109 { .lomax = 0, .pd = 0x00, .d = 0x00 }, /* end */
112 static struct tda18271_pll_map tda18271c1_cal_pll[] = {
113 { .lomax = 33000, .pd = 0xdd, .d = 0xd0 },
114 { .lomax = 36000, .pd = 0xdc, .d = 0xc0 },
115 { .lomax = 40000, .pd = 0xdb, .d = 0xb0 },
116 { .lomax = 44000, .pd = 0xda, .d = 0xa0 },
117 { .lomax = 49000, .pd = 0xd9, .d = 0x90 },
118 { .lomax = 55000, .pd = 0xd8, .d = 0x80 },
119 { .lomax = 63000, .pd = 0xd3, .d = 0x70 },
120 { .lomax = 67000, .pd = 0xcd, .d = 0x68 },
121 { .lomax = 73000, .pd = 0xcc, .d = 0x60 },
122 { .lomax = 80000, .pd = 0xcb, .d = 0x58 },
123 { .lomax = 88000, .pd = 0xca, .d = 0x50 },
124 { .lomax = 98000, .pd = 0xc9, .d = 0x48 },
125 { .lomax = 110000, .pd = 0xc8, .d = 0x40 },
126 { .lomax = 126000, .pd = 0xc3, .d = 0x38 },
127 { .lomax = 135000, .pd = 0xbd, .d = 0x34 },
128 { .lomax = 147000, .pd = 0xbc, .d = 0x30 },
129 { .lomax = 160000, .pd = 0xbb, .d = 0x2c },
130 { .lomax = 176000, .pd = 0xba, .d = 0x28 },
131 { .lomax = 196000, .pd = 0xb9, .d = 0x24 },
132 { .lomax = 220000, .pd = 0xb8, .d = 0x20 },
133 { .lomax = 252000, .pd = 0xb3, .d = 0x1c },
134 { .lomax = 271000, .pd = 0xad, .d = 0x1a },
135 { .lomax = 294000, .pd = 0xac, .d = 0x18 },
136 { .lomax = 321000, .pd = 0xab, .d = 0x16 },
137 { .lomax = 353000, .pd = 0xaa, .d = 0x14 },
138 { .lomax = 392000, .pd = 0xa9, .d = 0x12 },
139 { .lomax = 441000, .pd = 0xa8, .d = 0x10 },
140 { .lomax = 505000, .pd = 0xa3, .d = 0x0e },
141 { .lomax = 543000, .pd = 0x9d, .d = 0x0d },
142 { .lomax = 589000, .pd = 0x9c, .d = 0x0c },
143 { .lomax = 642000, .pd = 0x9b, .d = 0x0b },
144 { .lomax = 707000, .pd = 0x9a, .d = 0x0a },
145 { .lomax = 785000, .pd = 0x99, .d = 0x09 },
146 { .lomax = 883000, .pd = 0x98, .d = 0x08 },
147 { .lomax = 1010000, .pd = 0x93, .d = 0x07 },
148 { .lomax = 0, .pd = 0x00, .d = 0x00 }, /* end */
151 static struct tda18271_pll_map tda18271c2_cal_pll[] = {
152 { .lomax = 33813, .pd = 0xdd, .d = 0xd0 },
153 { .lomax = 36625, .pd = 0xdc, .d = 0xc0 },
154 { .lomax = 39938, .pd = 0xdb, .d = 0xb0 },
155 { .lomax = 43938, .pd = 0xda, .d = 0xa0 },
156 { .lomax = 48813, .pd = 0xd9, .d = 0x90 },
157 { .lomax = 54938, .pd = 0xd8, .d = 0x80 },
158 { .lomax = 62813, .pd = 0xd3, .d = 0x70 },
159 { .lomax = 67625, .pd = 0xcd, .d = 0x68 },
160 { .lomax = 73250, .pd = 0xcc, .d = 0x60 },
161 { .lomax = 79875, .pd = 0xcb, .d = 0x58 },
162 { .lomax = 87875, .pd = 0xca, .d = 0x50 },
163 { .lomax = 97625, .pd = 0xc9, .d = 0x48 },
164 { .lomax = 109875, .pd = 0xc8, .d = 0x40 },
165 { .lomax = 125625, .pd = 0xc3, .d = 0x38 },
166 { .lomax = 135250, .pd = 0xbd, .d = 0x34 },
167 { .lomax = 146500, .pd = 0xbc, .d = 0x30 },
168 { .lomax = 159750, .pd = 0xbb, .d = 0x2c },
169 { .lomax = 175750, .pd = 0xba, .d = 0x28 },
170 { .lomax = 195250, .pd = 0xb9, .d = 0x24 },
171 { .lomax = 219750, .pd = 0xb8, .d = 0x20 },
172 { .lomax = 251250, .pd = 0xb3, .d = 0x1c },
173 { .lomax = 270500, .pd = 0xad, .d = 0x1a },
174 { .lomax = 293000, .pd = 0xac, .d = 0x18 },
175 { .lomax = 319500, .pd = 0xab, .d = 0x16 },
176 { .lomax = 351500, .pd = 0xaa, .d = 0x14 },
177 { .lomax = 390500, .pd = 0xa9, .d = 0x12 },
178 { .lomax = 439500, .pd = 0xa8, .d = 0x10 },
179 { .lomax = 502500, .pd = 0xa3, .d = 0x0e },
180 { .lomax = 541000, .pd = 0x9d, .d = 0x0d },
181 { .lomax = 586000, .pd = 0x9c, .d = 0x0c },
182 { .lomax = 639000, .pd = 0x9b, .d = 0x0b },
183 { .lomax = 703000, .pd = 0x9a, .d = 0x0a },
184 { .lomax = 781000, .pd = 0x99, .d = 0x09 },
185 { .lomax = 879000, .pd = 0x98, .d = 0x08 },
186 { .lomax = 0, .pd = 0x00, .d = 0x00 }, /* end */
189 static struct tda18271_map tda18271_bp_filter[] = {
190 { .rfmax = 62000, .val = 0x00 },
191 { .rfmax = 84000, .val = 0x01 },
192 { .rfmax = 100000, .val = 0x02 },
193 { .rfmax = 140000, .val = 0x03 },
194 { .rfmax = 170000, .val = 0x04 },
195 { .rfmax = 180000, .val = 0x05 },
196 { .rfmax = 865000, .val = 0x06 },
197 { .rfmax = 0, .val = 0x00 }, /* end */
200 static struct tda18271_map tda18271c1_km[] = {
201 { .rfmax = 61100, .val = 0x74 },
202 { .rfmax = 350000, .val = 0x40 },
203 { .rfmax = 720000, .val = 0x30 },
204 { .rfmax = 865000, .val = 0x40 },
205 { .rfmax = 0, .val = 0x00 }, /* end */
208 static struct tda18271_map tda18271c2_km[] = {
209 { .rfmax = 47900, .val = 0x38 },
210 { .rfmax = 61100, .val = 0x44 },
211 { .rfmax = 350000, .val = 0x30 },
212 { .rfmax = 720000, .val = 0x24 },
213 { .rfmax = 865000, .val = 0x3c },
214 { .rfmax = 0, .val = 0x00 }, /* end */
217 static struct tda18271_map tda18271_rf_band[] = {
218 { .rfmax = 47900, .val = 0x00 },
219 { .rfmax = 61100, .val = 0x01 },
220 { .rfmax = 152600, .val = 0x02 },
221 { .rfmax = 164700, .val = 0x03 },
222 { .rfmax = 203500, .val = 0x04 },
223 { .rfmax = 457800, .val = 0x05 },
224 { .rfmax = 865000, .val = 0x06 },
225 { .rfmax = 0, .val = 0x00 }, /* end */
228 static struct tda18271_map tda18271_gain_taper[] = {
229 { .rfmax = 45400, .val = 0x1f },
230 { .rfmax = 45800, .val = 0x1e },
231 { .rfmax = 46200, .val = 0x1d },
232 { .rfmax = 46700, .val = 0x1c },
233 { .rfmax = 47100, .val = 0x1b },
234 { .rfmax = 47500, .val = 0x1a },
235 { .rfmax = 47900, .val = 0x19 },
236 { .rfmax = 49600, .val = 0x17 },
237 { .rfmax = 51200, .val = 0x16 },
238 { .rfmax = 52900, .val = 0x15 },
239 { .rfmax = 54500, .val = 0x14 },
240 { .rfmax = 56200, .val = 0x13 },
241 { .rfmax = 57800, .val = 0x12 },
242 { .rfmax = 59500, .val = 0x11 },
243 { .rfmax = 61100, .val = 0x10 },
244 { .rfmax = 67600, .val = 0x0d },
245 { .rfmax = 74200, .val = 0x0c },
246 { .rfmax = 80700, .val = 0x0b },
247 { .rfmax = 87200, .val = 0x0a },
248 { .rfmax = 93800, .val = 0x09 },
249 { .rfmax = 100300, .val = 0x08 },
250 { .rfmax = 106900, .val = 0x07 },
251 { .rfmax = 113400, .val = 0x06 },
252 { .rfmax = 119900, .val = 0x05 },
253 { .rfmax = 126500, .val = 0x04 },
254 { .rfmax = 133000, .val = 0x03 },
255 { .rfmax = 139500, .val = 0x02 },
256 { .rfmax = 146100, .val = 0x01 },
257 { .rfmax = 152600, .val = 0x00 },
258 { .rfmax = 154300, .val = 0x1f },
259 { .rfmax = 156100, .val = 0x1e },
260 { .rfmax = 157800, .val = 0x1d },
261 { .rfmax = 159500, .val = 0x1c },
262 { .rfmax = 161200, .val = 0x1b },
263 { .rfmax = 163000, .val = 0x1a },
264 { .rfmax = 164700, .val = 0x19 },
265 { .rfmax = 170200, .val = 0x17 },
266 { .rfmax = 175800, .val = 0x16 },
267 { .rfmax = 181300, .val = 0x15 },
268 { .rfmax = 186900, .val = 0x14 },
269 { .rfmax = 192400, .val = 0x13 },
270 { .rfmax = 198000, .val = 0x12 },
271 { .rfmax = 203500, .val = 0x11 },
272 { .rfmax = 216200, .val = 0x14 },
273 { .rfmax = 228900, .val = 0x13 },
274 { .rfmax = 241600, .val = 0x12 },
275 { .rfmax = 254400, .val = 0x11 },
276 { .rfmax = 267100, .val = 0x10 },
277 { .rfmax = 279800, .val = 0x0f },
278 { .rfmax = 292500, .val = 0x0e },
279 { .rfmax = 305200, .val = 0x0d },
280 { .rfmax = 317900, .val = 0x0c },
281 { .rfmax = 330700, .val = 0x0b },
282 { .rfmax = 343400, .val = 0x0a },
283 { .rfmax = 356100, .val = 0x09 },
284 { .rfmax = 368800, .val = 0x08 },
285 { .rfmax = 381500, .val = 0x07 },
286 { .rfmax = 394200, .val = 0x06 },
287 { .rfmax = 406900, .val = 0x05 },
288 { .rfmax = 419700, .val = 0x04 },
289 { .rfmax = 432400, .val = 0x03 },
290 { .rfmax = 445100, .val = 0x02 },
291 { .rfmax = 457800, .val = 0x01 },
292 { .rfmax = 476300, .val = 0x19 },
293 { .rfmax = 494800, .val = 0x18 },
294 { .rfmax = 513300, .val = 0x17 },
295 { .rfmax = 531800, .val = 0x16 },
296 { .rfmax = 550300, .val = 0x15 },
297 { .rfmax = 568900, .val = 0x14 },
298 { .rfmax = 587400, .val = 0x13 },
299 { .rfmax = 605900, .val = 0x12 },
300 { .rfmax = 624400, .val = 0x11 },
301 { .rfmax = 642900, .val = 0x10 },
302 { .rfmax = 661400, .val = 0x0f },
303 { .rfmax = 679900, .val = 0x0e },
304 { .rfmax = 698400, .val = 0x0d },
305 { .rfmax = 716900, .val = 0x0c },
306 { .rfmax = 735400, .val = 0x0b },
307 { .rfmax = 753900, .val = 0x0a },
308 { .rfmax = 772500, .val = 0x09 },
309 { .rfmax = 791000, .val = 0x08 },
310 { .rfmax = 809500, .val = 0x07 },
311 { .rfmax = 828000, .val = 0x06 },
312 { .rfmax = 846500, .val = 0x05 },
313 { .rfmax = 865000, .val = 0x04 },
314 { .rfmax = 0, .val = 0x00 }, /* end */
317 static struct tda18271_map tda18271c1_rf_cal[] = {
318 { .rfmax = 41000, .val = 0x1e },
319 { .rfmax = 43000, .val = 0x30 },
320 { .rfmax = 45000, .val = 0x43 },
321 { .rfmax = 46000, .val = 0x4d },
322 { .rfmax = 47000, .val = 0x54 },
323 { .rfmax = 47900, .val = 0x64 },
324 { .rfmax = 49100, .val = 0x20 },
325 { .rfmax = 50000, .val = 0x22 },
326 { .rfmax = 51000, .val = 0x2a },
327 { .rfmax = 53000, .val = 0x32 },
328 { .rfmax = 55000, .val = 0x35 },
329 { .rfmax = 56000, .val = 0x3c },
330 { .rfmax = 57000, .val = 0x3f },
331 { .rfmax = 58000, .val = 0x48 },
332 { .rfmax = 59000, .val = 0x4d },
333 { .rfmax = 60000, .val = 0x58 },
334 { .rfmax = 61100, .val = 0x5f },
335 { .rfmax = 0, .val = 0x00 }, /* end */
338 static struct tda18271_map tda18271c2_rf_cal[] = {
339 { .rfmax = 41000, .val = 0x0f },
340 { .rfmax = 43000, .val = 0x1c },
341 { .rfmax = 45000, .val = 0x2f },
342 { .rfmax = 46000, .val = 0x39 },
343 { .rfmax = 47000, .val = 0x40 },
344 { .rfmax = 47900, .val = 0x50 },
345 { .rfmax = 49100, .val = 0x16 },
346 { .rfmax = 50000, .val = 0x18 },
347 { .rfmax = 51000, .val = 0x20 },
348 { .rfmax = 53000, .val = 0x28 },
349 { .rfmax = 55000, .val = 0x2b },
350 { .rfmax = 56000, .val = 0x32 },
351 { .rfmax = 57000, .val = 0x35 },
352 { .rfmax = 58000, .val = 0x3e },
353 { .rfmax = 59000, .val = 0x43 },
354 { .rfmax = 60000, .val = 0x4e },
355 { .rfmax = 61100, .val = 0x55 },
356 { .rfmax = 63000, .val = 0x0f },
357 { .rfmax = 64000, .val = 0x11 },
358 { .rfmax = 65000, .val = 0x12 },
359 { .rfmax = 66000, .val = 0x15 },
360 { .rfmax = 67000, .val = 0x16 },
361 { .rfmax = 68000, .val = 0x17 },
362 { .rfmax = 70000, .val = 0x19 },
363 { .rfmax = 71000, .val = 0x1c },
364 { .rfmax = 72000, .val = 0x1d },
365 { .rfmax = 73000, .val = 0x1f },
366 { .rfmax = 74000, .val = 0x20 },
367 { .rfmax = 75000, .val = 0x21 },
368 { .rfmax = 76000, .val = 0x24 },
369 { .rfmax = 77000, .val = 0x25 },
370 { .rfmax = 78000, .val = 0x27 },
371 { .rfmax = 80000, .val = 0x28 },
372 { .rfmax = 81000, .val = 0x29 },
373 { .rfmax = 82000, .val = 0x2d },
374 { .rfmax = 83000, .val = 0x2e },
375 { .rfmax = 84000, .val = 0x2f },
376 { .rfmax = 85000, .val = 0x31 },
377 { .rfmax = 86000, .val = 0x33 },
378 { .rfmax = 87000, .val = 0x34 },
379 { .rfmax = 88000, .val = 0x35 },
380 { .rfmax = 89000, .val = 0x37 },
381 { .rfmax = 90000, .val = 0x38 },
382 { .rfmax = 91000, .val = 0x39 },
383 { .rfmax = 93000, .val = 0x3c },
384 { .rfmax = 94000, .val = 0x3e },
385 { .rfmax = 95000, .val = 0x3f },
386 { .rfmax = 96000, .val = 0x40 },
387 { .rfmax = 97000, .val = 0x42 },
388 { .rfmax = 99000, .val = 0x45 },
389 { .rfmax = 100000, .val = 0x46 },
390 { .rfmax = 102000, .val = 0x48 },
391 { .rfmax = 103000, .val = 0x4a },
392 { .rfmax = 105000, .val = 0x4d },
393 { .rfmax = 106000, .val = 0x4e },
394 { .rfmax = 107000, .val = 0x50 },
395 { .rfmax = 108000, .val = 0x51 },
396 { .rfmax = 110000, .val = 0x54 },
397 { .rfmax = 111000, .val = 0x56 },
398 { .rfmax = 112000, .val = 0x57 },
399 { .rfmax = 113000, .val = 0x58 },
400 { .rfmax = 114000, .val = 0x59 },
401 { .rfmax = 115000, .val = 0x5c },
402 { .rfmax = 116000, .val = 0x5d },
403 { .rfmax = 117000, .val = 0x5f },
404 { .rfmax = 119000, .val = 0x60 },
405 { .rfmax = 120000, .val = 0x64 },
406 { .rfmax = 121000, .val = 0x65 },
407 { .rfmax = 122000, .val = 0x66 },
408 { .rfmax = 123000, .val = 0x68 },
409 { .rfmax = 124000, .val = 0x69 },
410 { .rfmax = 125000, .val = 0x6c },
411 { .rfmax = 126000, .val = 0x6d },
412 { .rfmax = 127000, .val = 0x6e },
413 { .rfmax = 128000, .val = 0x70 },
414 { .rfmax = 129000, .val = 0x71 },
415 { .rfmax = 130000, .val = 0x75 },
416 { .rfmax = 131000, .val = 0x77 },
417 { .rfmax = 132000, .val = 0x78 },
418 { .rfmax = 133000, .val = 0x7b },
419 { .rfmax = 134000, .val = 0x7e },
420 { .rfmax = 135000, .val = 0x81 },
421 { .rfmax = 136000, .val = 0x82 },
422 { .rfmax = 137000, .val = 0x87 },
423 { .rfmax = 138000, .val = 0x88 },
424 { .rfmax = 139000, .val = 0x8d },
425 { .rfmax = 140000, .val = 0x8e },
426 { .rfmax = 141000, .val = 0x91 },
427 { .rfmax = 142000, .val = 0x95 },
428 { .rfmax = 143000, .val = 0x9a },
429 { .rfmax = 144000, .val = 0x9d },
430 { .rfmax = 145000, .val = 0xa1 },
431 { .rfmax = 146000, .val = 0xa2 },
432 { .rfmax = 147000, .val = 0xa4 },
433 { .rfmax = 148000, .val = 0xa9 },
434 { .rfmax = 149000, .val = 0xae },
435 { .rfmax = 150000, .val = 0xb0 },
436 { .rfmax = 151000, .val = 0xb1 },
437 { .rfmax = 152000, .val = 0xb7 },
438 { .rfmax = 152600, .val = 0xbd },
439 { .rfmax = 154000, .val = 0x20 },
440 { .rfmax = 155000, .val = 0x22 },
441 { .rfmax = 156000, .val = 0x24 },
442 { .rfmax = 157000, .val = 0x25 },
443 { .rfmax = 158000, .val = 0x27 },
444 { .rfmax = 159000, .val = 0x29 },
445 { .rfmax = 160000, .val = 0x2c },
446 { .rfmax = 161000, .val = 0x2d },
447 { .rfmax = 163000, .val = 0x2e },
448 { .rfmax = 164000, .val = 0x2f },
449 { .rfmax = 164700, .val = 0x30 },
450 { .rfmax = 166000, .val = 0x11 },
451 { .rfmax = 167000, .val = 0x12 },
452 { .rfmax = 168000, .val = 0x13 },
453 { .rfmax = 169000, .val = 0x14 },
454 { .rfmax = 170000, .val = 0x15 },
455 { .rfmax = 172000, .val = 0x16 },
456 { .rfmax = 173000, .val = 0x17 },
457 { .rfmax = 174000, .val = 0x18 },
458 { .rfmax = 175000, .val = 0x1a },
459 { .rfmax = 176000, .val = 0x1b },
460 { .rfmax = 178000, .val = 0x1d },
461 { .rfmax = 179000, .val = 0x1e },
462 { .rfmax = 180000, .val = 0x1f },
463 { .rfmax = 181000, .val = 0x20 },
464 { .rfmax = 182000, .val = 0x21 },
465 { .rfmax = 183000, .val = 0x22 },
466 { .rfmax = 184000, .val = 0x24 },
467 { .rfmax = 185000, .val = 0x25 },
468 { .rfmax = 186000, .val = 0x26 },
469 { .rfmax = 187000, .val = 0x27 },
470 { .rfmax = 188000, .val = 0x29 },
471 { .rfmax = 189000, .val = 0x2a },
472 { .rfmax = 190000, .val = 0x2c },
473 { .rfmax = 191000, .val = 0x2d },
474 { .rfmax = 192000, .val = 0x2e },
475 { .rfmax = 193000, .val = 0x2f },
476 { .rfmax = 194000, .val = 0x30 },
477 { .rfmax = 195000, .val = 0x33 },
478 { .rfmax = 196000, .val = 0x35 },
479 { .rfmax = 198000, .val = 0x36 },
480 { .rfmax = 200000, .val = 0x38 },
481 { .rfmax = 201000, .val = 0x3c },
482 { .rfmax = 202000, .val = 0x3d },
483 { .rfmax = 203500, .val = 0x3e },
484 { .rfmax = 206000, .val = 0x0e },
485 { .rfmax = 208000, .val = 0x0f },
486 { .rfmax = 212000, .val = 0x10 },
487 { .rfmax = 216000, .val = 0x11 },
488 { .rfmax = 217000, .val = 0x12 },
489 { .rfmax = 218000, .val = 0x13 },
490 { .rfmax = 220000, .val = 0x14 },
491 { .rfmax = 222000, .val = 0x15 },
492 { .rfmax = 225000, .val = 0x16 },
493 { .rfmax = 228000, .val = 0x17 },
494 { .rfmax = 231000, .val = 0x18 },
495 { .rfmax = 234000, .val = 0x19 },
496 { .rfmax = 235000, .val = 0x1a },
497 { .rfmax = 236000, .val = 0x1b },
498 { .rfmax = 237000, .val = 0x1c },
499 { .rfmax = 240000, .val = 0x1d },
500 { .rfmax = 242000, .val = 0x1e },
501 { .rfmax = 244000, .val = 0x1f },
502 { .rfmax = 247000, .val = 0x20 },
503 { .rfmax = 249000, .val = 0x21 },
504 { .rfmax = 252000, .val = 0x22 },
505 { .rfmax = 253000, .val = 0x23 },
506 { .rfmax = 254000, .val = 0x24 },
507 { .rfmax = 256000, .val = 0x25 },
508 { .rfmax = 259000, .val = 0x26 },
509 { .rfmax = 262000, .val = 0x27 },
510 { .rfmax = 264000, .val = 0x28 },
511 { .rfmax = 267000, .val = 0x29 },
512 { .rfmax = 269000, .val = 0x2a },
513 { .rfmax = 271000, .val = 0x2b },
514 { .rfmax = 273000, .val = 0x2c },
515 { .rfmax = 275000, .val = 0x2d },
516 { .rfmax = 277000, .val = 0x2e },
517 { .rfmax = 279000, .val = 0x2f },
518 { .rfmax = 282000, .val = 0x30 },
519 { .rfmax = 284000, .val = 0x31 },
520 { .rfmax = 286000, .val = 0x32 },
521 { .rfmax = 287000, .val = 0x33 },
522 { .rfmax = 290000, .val = 0x34 },
523 { .rfmax = 293000, .val = 0x35 },
524 { .rfmax = 295000, .val = 0x36 },
525 { .rfmax = 297000, .val = 0x37 },
526 { .rfmax = 300000, .val = 0x38 },
527 { .rfmax = 303000, .val = 0x39 },
528 { .rfmax = 305000, .val = 0x3a },
529 { .rfmax = 306000, .val = 0x3b },
530 { .rfmax = 307000, .val = 0x3c },
531 { .rfmax = 310000, .val = 0x3d },
532 { .rfmax = 312000, .val = 0x3e },
533 { .rfmax = 315000, .val = 0x3f },
534 { .rfmax = 318000, .val = 0x40 },
535 { .rfmax = 320000, .val = 0x41 },
536 { .rfmax = 323000, .val = 0x42 },
537 { .rfmax = 324000, .val = 0x43 },
538 { .rfmax = 325000, .val = 0x44 },
539 { .rfmax = 327000, .val = 0x45 },
540 { .rfmax = 331000, .val = 0x46 },
541 { .rfmax = 334000, .val = 0x47 },
542 { .rfmax = 337000, .val = 0x48 },
543 { .rfmax = 339000, .val = 0x49 },
544 { .rfmax = 340000, .val = 0x4a },
545 { .rfmax = 341000, .val = 0x4b },
546 { .rfmax = 343000, .val = 0x4c },
547 { .rfmax = 345000, .val = 0x4d },
548 { .rfmax = 349000, .val = 0x4e },
549 { .rfmax = 352000, .val = 0x4f },
550 { .rfmax = 353000, .val = 0x50 },
551 { .rfmax = 355000, .val = 0x51 },
552 { .rfmax = 357000, .val = 0x52 },
553 { .rfmax = 359000, .val = 0x53 },
554 { .rfmax = 361000, .val = 0x54 },
555 { .rfmax = 362000, .val = 0x55 },
556 { .rfmax = 364000, .val = 0x56 },
557 { .rfmax = 368000, .val = 0x57 },
558 { .rfmax = 370000, .val = 0x58 },
559 { .rfmax = 372000, .val = 0x59 },
560 { .rfmax = 375000, .val = 0x5a },
561 { .rfmax = 376000, .val = 0x5b },
562 { .rfmax = 377000, .val = 0x5c },
563 { .rfmax = 379000, .val = 0x5d },
564 { .rfmax = 382000, .val = 0x5e },
565 { .rfmax = 384000, .val = 0x5f },
566 { .rfmax = 385000, .val = 0x60 },
567 { .rfmax = 386000, .val = 0x61 },
568 { .rfmax = 388000, .val = 0x62 },
569 { .rfmax = 390000, .val = 0x63 },
570 { .rfmax = 393000, .val = 0x64 },
571 { .rfmax = 394000, .val = 0x65 },
572 { .rfmax = 396000, .val = 0x66 },
573 { .rfmax = 397000, .val = 0x67 },
574 { .rfmax = 398000, .val = 0x68 },
575 { .rfmax = 400000, .val = 0x69 },
576 { .rfmax = 402000, .val = 0x6a },
577 { .rfmax = 403000, .val = 0x6b },
578 { .rfmax = 407000, .val = 0x6c },
579 { .rfmax = 408000, .val = 0x6d },
580 { .rfmax = 409000, .val = 0x6e },
581 { .rfmax = 410000, .val = 0x6f },
582 { .rfmax = 411000, .val = 0x70 },
583 { .rfmax = 412000, .val = 0x71 },
584 { .rfmax = 413000, .val = 0x72 },
585 { .rfmax = 414000, .val = 0x73 },
586 { .rfmax = 417000, .val = 0x74 },
587 { .rfmax = 418000, .val = 0x75 },
588 { .rfmax = 420000, .val = 0x76 },
589 { .rfmax = 422000, .val = 0x77 },
590 { .rfmax = 423000, .val = 0x78 },
591 { .rfmax = 424000, .val = 0x79 },
592 { .rfmax = 427000, .val = 0x7a },
593 { .rfmax = 428000, .val = 0x7b },
594 { .rfmax = 429000, .val = 0x7d },
595 { .rfmax = 432000, .val = 0x7f },
596 { .rfmax = 434000, .val = 0x80 },
597 { .rfmax = 435000, .val = 0x81 },
598 { .rfmax = 436000, .val = 0x83 },
599 { .rfmax = 437000, .val = 0x84 },
600 { .rfmax = 438000, .val = 0x85 },
601 { .rfmax = 439000, .val = 0x86 },
602 { .rfmax = 440000, .val = 0x87 },
603 { .rfmax = 441000, .val = 0x88 },
604 { .rfmax = 442000, .val = 0x89 },
605 { .rfmax = 445000, .val = 0x8a },
606 { .rfmax = 446000, .val = 0x8b },
607 { .rfmax = 447000, .val = 0x8c },
608 { .rfmax = 448000, .val = 0x8e },
609 { .rfmax = 449000, .val = 0x8f },
610 { .rfmax = 450000, .val = 0x90 },
611 { .rfmax = 452000, .val = 0x91 },
612 { .rfmax = 453000, .val = 0x93 },
613 { .rfmax = 454000, .val = 0x94 },
614 { .rfmax = 456000, .val = 0x96 },
615 { .rfmax = 457800, .val = 0x98 },
616 { .rfmax = 461000, .val = 0x11 },
617 { .rfmax = 468000, .val = 0x12 },
618 { .rfmax = 472000, .val = 0x13 },
619 { .rfmax = 473000, .val = 0x14 },
620 { .rfmax = 474000, .val = 0x15 },
621 { .rfmax = 481000, .val = 0x16 },
622 { .rfmax = 486000, .val = 0x17 },
623 { .rfmax = 491000, .val = 0x18 },
624 { .rfmax = 498000, .val = 0x19 },
625 { .rfmax = 499000, .val = 0x1a },
626 { .rfmax = 501000, .val = 0x1b },
627 { .rfmax = 506000, .val = 0x1c },
628 { .rfmax = 511000, .val = 0x1d },
629 { .rfmax = 516000, .val = 0x1e },
630 { .rfmax = 520000, .val = 0x1f },
631 { .rfmax = 521000, .val = 0x20 },
632 { .rfmax = 525000, .val = 0x21 },
633 { .rfmax = 529000, .val = 0x22 },
634 { .rfmax = 533000, .val = 0x23 },
635 { .rfmax = 539000, .val = 0x24 },
636 { .rfmax = 541000, .val = 0x25 },
637 { .rfmax = 547000, .val = 0x26 },
638 { .rfmax = 549000, .val = 0x27 },
639 { .rfmax = 551000, .val = 0x28 },
640 { .rfmax = 556000, .val = 0x29 },
641 { .rfmax = 561000, .val = 0x2a },
642 { .rfmax = 563000, .val = 0x2b },
643 { .rfmax = 565000, .val = 0x2c },
644 { .rfmax = 569000, .val = 0x2d },
645 { .rfmax = 571000, .val = 0x2e },
646 { .rfmax = 577000, .val = 0x2f },
647 { .rfmax = 580000, .val = 0x30 },
648 { .rfmax = 582000, .val = 0x31 },
649 { .rfmax = 584000, .val = 0x32 },
650 { .rfmax = 588000, .val = 0x33 },
651 { .rfmax = 591000, .val = 0x34 },
652 { .rfmax = 596000, .val = 0x35 },
653 { .rfmax = 598000, .val = 0x36 },
654 { .rfmax = 603000, .val = 0x37 },
655 { .rfmax = 604000, .val = 0x38 },
656 { .rfmax = 606000, .val = 0x39 },
657 { .rfmax = 612000, .val = 0x3a },
658 { .rfmax = 615000, .val = 0x3b },
659 { .rfmax = 617000, .val = 0x3c },
660 { .rfmax = 621000, .val = 0x3d },
661 { .rfmax = 622000, .val = 0x3e },
662 { .rfmax = 625000, .val = 0x3f },
663 { .rfmax = 632000, .val = 0x40 },
664 { .rfmax = 633000, .val = 0x41 },
665 { .rfmax = 634000, .val = 0x42 },
666 { .rfmax = 642000, .val = 0x43 },
667 { .rfmax = 643000, .val = 0x44 },
668 { .rfmax = 647000, .val = 0x45 },
669 { .rfmax = 650000, .val = 0x46 },
670 { .rfmax = 652000, .val = 0x47 },
671 { .rfmax = 657000, .val = 0x48 },
672 { .rfmax = 661000, .val = 0x49 },
673 { .rfmax = 662000, .val = 0x4a },
674 { .rfmax = 665000, .val = 0x4b },
675 { .rfmax = 667000, .val = 0x4c },
676 { .rfmax = 670000, .val = 0x4d },
677 { .rfmax = 673000, .val = 0x4e },
678 { .rfmax = 676000, .val = 0x4f },
679 { .rfmax = 677000, .val = 0x50 },
680 { .rfmax = 681000, .val = 0x51 },
681 { .rfmax = 683000, .val = 0x52 },
682 { .rfmax = 686000, .val = 0x53 },
683 { .rfmax = 688000, .val = 0x54 },
684 { .rfmax = 689000, .val = 0x55 },
685 { .rfmax = 691000, .val = 0x56 },
686 { .rfmax = 695000, .val = 0x57 },
687 { .rfmax = 698000, .val = 0x58 },
688 { .rfmax = 703000, .val = 0x59 },
689 { .rfmax = 704000, .val = 0x5a },
690 { .rfmax = 705000, .val = 0x5b },
691 { .rfmax = 707000, .val = 0x5c },
692 { .rfmax = 710000, .val = 0x5d },
693 { .rfmax = 712000, .val = 0x5e },
694 { .rfmax = 717000, .val = 0x5f },
695 { .rfmax = 718000, .val = 0x60 },
696 { .rfmax = 721000, .val = 0x61 },
697 { .rfmax = 722000, .val = 0x62 },
698 { .rfmax = 723000, .val = 0x63 },
699 { .rfmax = 725000, .val = 0x64 },
700 { .rfmax = 727000, .val = 0x65 },
701 { .rfmax = 730000, .val = 0x66 },
702 { .rfmax = 732000, .val = 0x67 },
703 { .rfmax = 735000, .val = 0x68 },
704 { .rfmax = 740000, .val = 0x69 },
705 { .rfmax = 741000, .val = 0x6a },
706 { .rfmax = 742000, .val = 0x6b },
707 { .rfmax = 743000, .val = 0x6c },
708 { .rfmax = 745000, .val = 0x6d },
709 { .rfmax = 747000, .val = 0x6e },
710 { .rfmax = 748000, .val = 0x6f },
711 { .rfmax = 750000, .val = 0x70 },
712 { .rfmax = 752000, .val = 0x71 },
713 { .rfmax = 754000, .val = 0x72 },
714 { .rfmax = 757000, .val = 0x73 },
715 { .rfmax = 758000, .val = 0x74 },
716 { .rfmax = 760000, .val = 0x75 },
717 { .rfmax = 763000, .val = 0x76 },
718 { .rfmax = 764000, .val = 0x77 },
719 { .rfmax = 766000, .val = 0x78 },
720 { .rfmax = 767000, .val = 0x79 },
721 { .rfmax = 768000, .val = 0x7a },
722 { .rfmax = 773000, .val = 0x7b },
723 { .rfmax = 774000, .val = 0x7c },
724 { .rfmax = 776000, .val = 0x7d },
725 { .rfmax = 777000, .val = 0x7e },
726 { .rfmax = 778000, .val = 0x7f },
727 { .rfmax = 779000, .val = 0x80 },
728 { .rfmax = 781000, .val = 0x81 },
729 { .rfmax = 783000, .val = 0x82 },
730 { .rfmax = 784000, .val = 0x83 },
731 { .rfmax = 785000, .val = 0x84 },
732 { .rfmax = 786000, .val = 0x85 },
733 { .rfmax = 793000, .val = 0x86 },
734 { .rfmax = 794000, .val = 0x87 },
735 { .rfmax = 795000, .val = 0x88 },
736 { .rfmax = 797000, .val = 0x89 },
737 { .rfmax = 799000, .val = 0x8a },
738 { .rfmax = 801000, .val = 0x8b },
739 { .rfmax = 802000, .val = 0x8c },
740 { .rfmax = 803000, .val = 0x8d },
741 { .rfmax = 804000, .val = 0x8e },
742 { .rfmax = 810000, .val = 0x90 },
743 { .rfmax = 811000, .val = 0x91 },
744 { .rfmax = 812000, .val = 0x92 },
745 { .rfmax = 814000, .val = 0x93 },
746 { .rfmax = 816000, .val = 0x94 },
747 { .rfmax = 817000, .val = 0x96 },
748 { .rfmax = 818000, .val = 0x97 },
749 { .rfmax = 820000, .val = 0x98 },
750 { .rfmax = 821000, .val = 0x99 },
751 { .rfmax = 822000, .val = 0x9a },
752 { .rfmax = 828000, .val = 0x9b },
753 { .rfmax = 829000, .val = 0x9d },
754 { .rfmax = 830000, .val = 0x9f },
755 { .rfmax = 831000, .val = 0xa0 },
756 { .rfmax = 833000, .val = 0xa1 },
757 { .rfmax = 835000, .val = 0xa2 },
758 { .rfmax = 836000, .val = 0xa3 },
759 { .rfmax = 837000, .val = 0xa4 },
760 { .rfmax = 838000, .val = 0xa6 },
761 { .rfmax = 840000, .val = 0xa8 },
762 { .rfmax = 842000, .val = 0xa9 },
763 { .rfmax = 845000, .val = 0xaa },
764 { .rfmax = 846000, .val = 0xab },
765 { .rfmax = 847000, .val = 0xad },
766 { .rfmax = 848000, .val = 0xae },
767 { .rfmax = 852000, .val = 0xaf },
768 { .rfmax = 853000, .val = 0xb0 },
769 { .rfmax = 858000, .val = 0xb1 },
770 { .rfmax = 860000, .val = 0xb2 },
771 { .rfmax = 861000, .val = 0xb3 },
772 { .rfmax = 862000, .val = 0xb4 },
773 { .rfmax = 863000, .val = 0xb6 },
774 { .rfmax = 864000, .val = 0xb8 },
775 { .rfmax = 865000, .val = 0xb9 },
776 { .rfmax = 0, .val = 0x00 }, /* end */
779 static struct tda18271_map tda18271_ir_measure[] = {
780 { .rfmax = 30000, .val = 4 },
781 { .rfmax = 200000, .val = 5 },
782 { .rfmax = 600000, .val = 6 },
783 { .rfmax = 865000, .val = 7 },
784 { .rfmax = 0, .val = 0 }, /* end */
787 static struct tda18271_map tda18271_rf_cal_dc_over_dt[] = {
788 { .rfmax = 47900, .val = 0x00 },
789 { .rfmax = 55000, .val = 0x00 },
790 { .rfmax = 61100, .val = 0x0a },
791 { .rfmax = 64000, .val = 0x0a },
792 { .rfmax = 82000, .val = 0x14 },
793 { .rfmax = 84000, .val = 0x19 },
794 { .rfmax = 119000, .val = 0x1c },
795 { .rfmax = 124000, .val = 0x20 },
796 { .rfmax = 129000, .val = 0x2a },
797 { .rfmax = 134000, .val = 0x32 },
798 { .rfmax = 139000, .val = 0x39 },
799 { .rfmax = 144000, .val = 0x3e },
800 { .rfmax = 149000, .val = 0x3f },
801 { .rfmax = 152600, .val = 0x40 },
802 { .rfmax = 154000, .val = 0x40 },
803 { .rfmax = 164700, .val = 0x41 },
804 { .rfmax = 203500, .val = 0x32 },
805 { .rfmax = 353000, .val = 0x19 },
806 { .rfmax = 356000, .val = 0x1a },
807 { .rfmax = 359000, .val = 0x1b },
808 { .rfmax = 363000, .val = 0x1c },
809 { .rfmax = 366000, .val = 0x1d },
810 { .rfmax = 369000, .val = 0x1e },
811 { .rfmax = 373000, .val = 0x1f },
812 { .rfmax = 376000, .val = 0x20 },
813 { .rfmax = 379000, .val = 0x21 },
814 { .rfmax = 383000, .val = 0x22 },
815 { .rfmax = 386000, .val = 0x23 },
816 { .rfmax = 389000, .val = 0x24 },
817 { .rfmax = 393000, .val = 0x25 },
818 { .rfmax = 396000, .val = 0x26 },
819 { .rfmax = 399000, .val = 0x27 },
820 { .rfmax = 402000, .val = 0x28 },
821 { .rfmax = 404000, .val = 0x29 },
822 { .rfmax = 407000, .val = 0x2a },
823 { .rfmax = 409000, .val = 0x2b },
824 { .rfmax = 412000, .val = 0x2c },
825 { .rfmax = 414000, .val = 0x2d },
826 { .rfmax = 417000, .val = 0x2e },
827 { .rfmax = 419000, .val = 0x2f },
828 { .rfmax = 422000, .val = 0x30 },
829 { .rfmax = 424000, .val = 0x31 },
830 { .rfmax = 427000, .val = 0x32 },
831 { .rfmax = 429000, .val = 0x33 },
832 { .rfmax = 432000, .val = 0x34 },
833 { .rfmax = 434000, .val = 0x35 },
834 { .rfmax = 437000, .val = 0x36 },
835 { .rfmax = 439000, .val = 0x37 },
836 { .rfmax = 442000, .val = 0x38 },
837 { .rfmax = 444000, .val = 0x39 },
838 { .rfmax = 447000, .val = 0x3a },
839 { .rfmax = 449000, .val = 0x3b },
840 { .rfmax = 457800, .val = 0x3c },
841 { .rfmax = 465000, .val = 0x0f },
842 { .rfmax = 477000, .val = 0x12 },
843 { .rfmax = 483000, .val = 0x14 },
844 { .rfmax = 502000, .val = 0x19 },
845 { .rfmax = 508000, .val = 0x1b },
846 { .rfmax = 519000, .val = 0x1c },
847 { .rfmax = 522000, .val = 0x1d },
848 { .rfmax = 524000, .val = 0x1e },
849 { .rfmax = 534000, .val = 0x1f },
850 { .rfmax = 549000, .val = 0x20 },
851 { .rfmax = 554000, .val = 0x22 },
852 { .rfmax = 584000, .val = 0x24 },
853 { .rfmax = 589000, .val = 0x26 },
854 { .rfmax = 658000, .val = 0x27 },
855 { .rfmax = 664000, .val = 0x2c },
856 { .rfmax = 669000, .val = 0x2d },
857 { .rfmax = 699000, .val = 0x2e },
858 { .rfmax = 704000, .val = 0x30 },
859 { .rfmax = 709000, .val = 0x31 },
860 { .rfmax = 714000, .val = 0x32 },
861 { .rfmax = 724000, .val = 0x33 },
862 { .rfmax = 729000, .val = 0x36 },
863 { .rfmax = 739000, .val = 0x38 },
864 { .rfmax = 744000, .val = 0x39 },
865 { .rfmax = 749000, .val = 0x3b },
866 { .rfmax = 754000, .val = 0x3c },
867 { .rfmax = 759000, .val = 0x3d },
868 { .rfmax = 764000, .val = 0x3e },
869 { .rfmax = 769000, .val = 0x3f },
870 { .rfmax = 774000, .val = 0x40 },
871 { .rfmax = 779000, .val = 0x41 },
872 { .rfmax = 784000, .val = 0x43 },
873 { .rfmax = 789000, .val = 0x46 },
874 { .rfmax = 794000, .val = 0x48 },
875 { .rfmax = 799000, .val = 0x4b },
876 { .rfmax = 804000, .val = 0x4f },
877 { .rfmax = 809000, .val = 0x54 },
878 { .rfmax = 814000, .val = 0x59 },
879 { .rfmax = 819000, .val = 0x5d },
880 { .rfmax = 824000, .val = 0x61 },
881 { .rfmax = 829000, .val = 0x68 },
882 { .rfmax = 834000, .val = 0x6e },
883 { .rfmax = 839000, .val = 0x75 },
884 { .rfmax = 844000, .val = 0x7e },
885 { .rfmax = 849000, .val = 0x82 },
886 { .rfmax = 854000, .val = 0x84 },
887 { .rfmax = 859000, .val = 0x8f },
888 { .rfmax = 865000, .val = 0x9a },
889 { .rfmax = 0, .val = 0x00 }, /* end */
892 /*---------------------------------------------------------------------*/
894 struct tda18271_thermo_map {
895 u8 d;
896 u8 r0;
897 u8 r1;
900 static struct tda18271_thermo_map tda18271_thermometer[] = {
901 { .d = 0x00, .r0 = 60, .r1 = 92 },
902 { .d = 0x01, .r0 = 62, .r1 = 94 },
903 { .d = 0x02, .r0 = 66, .r1 = 98 },
904 { .d = 0x03, .r0 = 64, .r1 = 96 },
905 { .d = 0x04, .r0 = 74, .r1 = 106 },
906 { .d = 0x05, .r0 = 72, .r1 = 104 },
907 { .d = 0x06, .r0 = 68, .r1 = 100 },
908 { .d = 0x07, .r0 = 70, .r1 = 102 },
909 { .d = 0x08, .r0 = 90, .r1 = 122 },
910 { .d = 0x09, .r0 = 88, .r1 = 120 },
911 { .d = 0x0a, .r0 = 84, .r1 = 116 },
912 { .d = 0x0b, .r0 = 86, .r1 = 118 },
913 { .d = 0x0c, .r0 = 76, .r1 = 108 },
914 { .d = 0x0d, .r0 = 78, .r1 = 110 },
915 { .d = 0x0e, .r0 = 82, .r1 = 114 },
916 { .d = 0x0f, .r0 = 80, .r1 = 112 },
917 { .d = 0x00, .r0 = 0, .r1 = 0 }, /* end */
920 int tda18271_lookup_thermometer(struct dvb_frontend *fe)
922 struct tda18271_priv *priv = fe->tuner_priv;
923 unsigned char *regs = priv->tda18271_regs;
924 int val, i = 0;
926 while (tda18271_thermometer[i].d < (regs[R_TM] & 0x0f)) {
927 if (tda18271_thermometer[i + 1].d == 0)
928 break;
929 i++;
932 if ((regs[R_TM] & 0x20) == 0x20)
933 val = tda18271_thermometer[i].r1;
934 else
935 val = tda18271_thermometer[i].r0;
937 tda_map("(%d) tm = %d\n", i, val);
939 return val;
942 /*---------------------------------------------------------------------*/
944 struct tda18271_cid_target_map {
945 u32 rfmax;
946 u8 target;
947 u16 limit;
950 static struct tda18271_cid_target_map tda18271_cid_target[] = {
951 { .rfmax = 46000, .target = 0x04, .limit = 1800 },
952 { .rfmax = 52200, .target = 0x0a, .limit = 1500 },
953 { .rfmax = 70100, .target = 0x01, .limit = 4000 },
954 { .rfmax = 136800, .target = 0x18, .limit = 4000 },
955 { .rfmax = 156700, .target = 0x18, .limit = 4000 },
956 { .rfmax = 186250, .target = 0x0a, .limit = 4000 },
957 { .rfmax = 230000, .target = 0x0a, .limit = 4000 },
958 { .rfmax = 345000, .target = 0x18, .limit = 4000 },
959 { .rfmax = 426000, .target = 0x0e, .limit = 4000 },
960 { .rfmax = 489500, .target = 0x1e, .limit = 4000 },
961 { .rfmax = 697500, .target = 0x32, .limit = 4000 },
962 { .rfmax = 842000, .target = 0x3a, .limit = 4000 },
963 { .rfmax = 0, .target = 0x00, .limit = 0 }, /* end */
966 int tda18271_lookup_cid_target(struct dvb_frontend *fe,
967 u32 *freq, u8 *cid_target, u16 *count_limit)
969 struct tda18271_priv *priv = fe->tuner_priv;
970 int i = 0;
972 while ((tda18271_cid_target[i].rfmax * 1000) < *freq) {
973 if (tda18271_cid_target[i + 1].rfmax == 0)
974 break;
975 i++;
977 *cid_target = tda18271_cid_target[i].target;
978 *count_limit = tda18271_cid_target[i].limit;
980 tda_map("(%d) cid_target = %02x, count_limit = %d\n", i,
981 tda18271_cid_target[i].target, tda18271_cid_target[i].limit);
983 return 0;
986 /*---------------------------------------------------------------------*/
988 static struct tda18271_rf_tracking_filter_cal tda18271_rf_band_template[] = {
989 { .rfmax = 47900, .rfband = 0x00,
990 .rf1_def = 46000, .rf2_def = 0, .rf3_def = 0 },
991 { .rfmax = 61100, .rfband = 0x01,
992 .rf1_def = 52200, .rf2_def = 0, .rf3_def = 0 },
993 { .rfmax = 152600, .rfband = 0x02,
994 .rf1_def = 70100, .rf2_def = 136800, .rf3_def = 0 },
995 { .rfmax = 164700, .rfband = 0x03,
996 .rf1_def = 156700, .rf2_def = 0, .rf3_def = 0 },
997 { .rfmax = 203500, .rfband = 0x04,
998 .rf1_def = 186250, .rf2_def = 0, .rf3_def = 0 },
999 { .rfmax = 457800, .rfband = 0x05,
1000 .rf1_def = 230000, .rf2_def = 345000, .rf3_def = 426000 },
1001 { .rfmax = 865000, .rfband = 0x06,
1002 .rf1_def = 489500, .rf2_def = 697500, .rf3_def = 842000 },
1003 { .rfmax = 0, .rfband = 0x00,
1004 .rf1_def = 0, .rf2_def = 0, .rf3_def = 0 }, /* end */
1007 int tda18271_lookup_rf_band(struct dvb_frontend *fe, u32 *freq, u8 *rf_band)
1009 struct tda18271_priv *priv = fe->tuner_priv;
1010 struct tda18271_rf_tracking_filter_cal *map = priv->rf_cal_state;
1011 int i = 0;
1013 while ((map[i].rfmax * 1000) < *freq) {
1014 if (tda18271_debug & DBG_ADV)
1015 tda_map("(%d) rfmax = %d < freq = %d, rf1_def = %d, rf2_def = %d, rf3_def = %d, rf1 = %d, rf2 = %d, rf3 = %d, rf_a1 = %d, rf_a2 = %d, rf_b1 = %d, rf_b2 = %d\n",
1016 i, map[i].rfmax * 1000, *freq,
1017 map[i].rf1_def, map[i].rf2_def, map[i].rf3_def,
1018 map[i].rf1, map[i].rf2, map[i].rf3,
1019 map[i].rf_a1, map[i].rf_a2,
1020 map[i].rf_b1, map[i].rf_b2);
1021 if (map[i].rfmax == 0)
1022 return -EINVAL;
1023 i++;
1025 if (rf_band)
1026 *rf_band = map[i].rfband;
1028 tda_map("(%d) rf_band = %02x\n", i, map[i].rfband);
1030 return i;
1033 /*---------------------------------------------------------------------*/
1035 struct tda18271_map_layout {
1036 struct tda18271_pll_map *main_pll;
1037 struct tda18271_pll_map *cal_pll;
1039 struct tda18271_map *rf_cal;
1040 struct tda18271_map *rf_cal_kmco;
1041 struct tda18271_map *rf_cal_dc_over_dt;
1043 struct tda18271_map *bp_filter;
1044 struct tda18271_map *rf_band;
1045 struct tda18271_map *gain_taper;
1046 struct tda18271_map *ir_measure;
1049 /*---------------------------------------------------------------------*/
1051 int tda18271_lookup_pll_map(struct dvb_frontend *fe,
1052 enum tda18271_map_type map_type,
1053 u32 *freq, u8 *post_div, u8 *div)
1055 struct tda18271_priv *priv = fe->tuner_priv;
1056 struct tda18271_pll_map *map = NULL;
1057 unsigned int i = 0;
1058 char *map_name;
1059 int ret = 0;
1061 BUG_ON(!priv->maps);
1063 switch (map_type) {
1064 case MAIN_PLL:
1065 map = priv->maps->main_pll;
1066 map_name = "main_pll";
1067 break;
1068 case CAL_PLL:
1069 map = priv->maps->cal_pll;
1070 map_name = "cal_pll";
1071 break;
1072 default:
1073 /* we should never get here */
1074 map_name = "undefined";
1075 break;
1078 if (!map) {
1079 tda_warn("%s map is not set!\n", map_name);
1080 ret = -EINVAL;
1081 goto fail;
1084 while ((map[i].lomax * 1000) < *freq) {
1085 if (map[i + 1].lomax == 0) {
1086 tda_map("%s: frequency (%d) out of range\n",
1087 map_name, *freq);
1088 ret = -ERANGE;
1089 break;
1091 i++;
1093 *post_div = map[i].pd;
1094 *div = map[i].d;
1096 tda_map("(%d) %s: post div = 0x%02x, div = 0x%02x\n",
1097 i, map_name, *post_div, *div);
1098 fail:
1099 return ret;
1102 int tda18271_lookup_map(struct dvb_frontend *fe,
1103 enum tda18271_map_type map_type,
1104 u32 *freq, u8 *val)
1106 struct tda18271_priv *priv = fe->tuner_priv;
1107 struct tda18271_map *map = NULL;
1108 unsigned int i = 0;
1109 char *map_name;
1110 int ret = 0;
1112 BUG_ON(!priv->maps);
1114 switch (map_type) {
1115 case BP_FILTER:
1116 map = priv->maps->bp_filter;
1117 map_name = "bp_filter";
1118 break;
1119 case RF_CAL_KMCO:
1120 map = priv->maps->rf_cal_kmco;
1121 map_name = "km";
1122 break;
1123 case RF_BAND:
1124 map = priv->maps->rf_band;
1125 map_name = "rf_band";
1126 break;
1127 case GAIN_TAPER:
1128 map = priv->maps->gain_taper;
1129 map_name = "gain_taper";
1130 break;
1131 case RF_CAL:
1132 map = priv->maps->rf_cal;
1133 map_name = "rf_cal";
1134 break;
1135 case IR_MEASURE:
1136 map = priv->maps->ir_measure;
1137 map_name = "ir_measure";
1138 break;
1139 case RF_CAL_DC_OVER_DT:
1140 map = priv->maps->rf_cal_dc_over_dt;
1141 map_name = "rf_cal_dc_over_dt";
1142 break;
1143 default:
1144 /* we should never get here */
1145 map_name = "undefined";
1146 break;
1149 if (!map) {
1150 tda_warn("%s map is not set!\n", map_name);
1151 ret = -EINVAL;
1152 goto fail;
1155 while ((map[i].rfmax * 1000) < *freq) {
1156 if (map[i + 1].rfmax == 0) {
1157 tda_map("%s: frequency (%d) out of range\n",
1158 map_name, *freq);
1159 ret = -ERANGE;
1160 break;
1162 i++;
1164 *val = map[i].val;
1166 tda_map("(%d) %s: 0x%02x\n", i, map_name, *val);
1167 fail:
1168 return ret;
1171 /*---------------------------------------------------------------------*/
1173 static const struct tda18271_std_map tda18271c1_std_map = {
1174 .fm_radio = { .if_freq = 1250, .fm_rfn = 1, .agc_mode = 3, .std = 0,
1175 .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x18 */
1176 .atv_b = { .if_freq = 6750, .fm_rfn = 0, .agc_mode = 1, .std = 6,
1177 .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0e */
1178 .atv_dk = { .if_freq = 7750, .fm_rfn = 0, .agc_mode = 1, .std = 7,
1179 .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0f */
1180 .atv_gh = { .if_freq = 7750, .fm_rfn = 0, .agc_mode = 1, .std = 7,
1181 .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0f */
1182 .atv_i = { .if_freq = 7750, .fm_rfn = 0, .agc_mode = 1, .std = 7,
1183 .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0f */
1184 .atv_l = { .if_freq = 7750, .fm_rfn = 0, .agc_mode = 1, .std = 7,
1185 .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0f */
1186 .atv_lc = { .if_freq = 1250, .fm_rfn = 0, .agc_mode = 1, .std = 7,
1187 .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0f */
1188 .atv_mn = { .if_freq = 5750, .fm_rfn = 0, .agc_mode = 1, .std = 5,
1189 .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0d */
1190 .atsc_6 = { .if_freq = 3250, .fm_rfn = 0, .agc_mode = 3, .std = 4,
1191 .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1c */
1192 .dvbt_6 = { .if_freq = 3300, .fm_rfn = 0, .agc_mode = 3, .std = 4,
1193 .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1c */
1194 .dvbt_7 = { .if_freq = 3800, .fm_rfn = 0, .agc_mode = 3, .std = 5,
1195 .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1d */
1196 .dvbt_8 = { .if_freq = 4300, .fm_rfn = 0, .agc_mode = 3, .std = 6,
1197 .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1e */
1198 .qam_6 = { .if_freq = 4000, .fm_rfn = 0, .agc_mode = 3, .std = 5,
1199 .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1d */
1200 .qam_7 = { .if_freq = 4500, .fm_rfn = 0, .agc_mode = 3, .std = 6,
1201 .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1e */
1202 .qam_8 = { .if_freq = 5000, .fm_rfn = 0, .agc_mode = 3, .std = 7,
1203 .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1f */
1206 static const struct tda18271_std_map tda18271c2_std_map = {
1207 .fm_radio = { .if_freq = 1250, .fm_rfn = 1, .agc_mode = 3, .std = 0,
1208 .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x18 */
1209 .atv_b = { .if_freq = 6000, .fm_rfn = 0, .agc_mode = 1, .std = 5,
1210 .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0d */
1211 .atv_dk = { .if_freq = 6900, .fm_rfn = 0, .agc_mode = 1, .std = 6,
1212 .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0e */
1213 .atv_gh = { .if_freq = 7100, .fm_rfn = 0, .agc_mode = 1, .std = 6,
1214 .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0e */
1215 .atv_i = { .if_freq = 7250, .fm_rfn = 0, .agc_mode = 1, .std = 6,
1216 .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0e */
1217 .atv_l = { .if_freq = 6900, .fm_rfn = 0, .agc_mode = 1, .std = 6,
1218 .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0e */
1219 .atv_lc = { .if_freq = 1250, .fm_rfn = 0, .agc_mode = 1, .std = 6,
1220 .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0e */
1221 .atv_mn = { .if_freq = 5400, .fm_rfn = 0, .agc_mode = 1, .std = 4,
1222 .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0c */
1223 .atsc_6 = { .if_freq = 3250, .fm_rfn = 0, .agc_mode = 3, .std = 4,
1224 .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1c */
1225 .dvbt_6 = { .if_freq = 3300, .fm_rfn = 0, .agc_mode = 3, .std = 4,
1226 .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1c */
1227 .dvbt_7 = { .if_freq = 3500, .fm_rfn = 0, .agc_mode = 3, .std = 4,
1228 .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1c */
1229 .dvbt_8 = { .if_freq = 4000, .fm_rfn = 0, .agc_mode = 3, .std = 5,
1230 .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1d */
1231 .qam_6 = { .if_freq = 4000, .fm_rfn = 0, .agc_mode = 3, .std = 5,
1232 .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1d */
1233 .qam_7 = { .if_freq = 4500, .fm_rfn = 0, .agc_mode = 3, .std = 6,
1234 .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1e */
1235 .qam_8 = { .if_freq = 5000, .fm_rfn = 0, .agc_mode = 3, .std = 7,
1236 .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1f */
1239 /*---------------------------------------------------------------------*/
1241 static struct tda18271_map_layout tda18271c1_map_layout = {
1242 .main_pll = tda18271c1_main_pll,
1243 .cal_pll = tda18271c1_cal_pll,
1245 .rf_cal = tda18271c1_rf_cal,
1246 .rf_cal_kmco = tda18271c1_km,
1248 .bp_filter = tda18271_bp_filter,
1249 .rf_band = tda18271_rf_band,
1250 .gain_taper = tda18271_gain_taper,
1251 .ir_measure = tda18271_ir_measure,
1254 static struct tda18271_map_layout tda18271c2_map_layout = {
1255 .main_pll = tda18271c2_main_pll,
1256 .cal_pll = tda18271c2_cal_pll,
1258 .rf_cal = tda18271c2_rf_cal,
1259 .rf_cal_kmco = tda18271c2_km,
1261 .rf_cal_dc_over_dt = tda18271_rf_cal_dc_over_dt,
1263 .bp_filter = tda18271_bp_filter,
1264 .rf_band = tda18271_rf_band,
1265 .gain_taper = tda18271_gain_taper,
1266 .ir_measure = tda18271_ir_measure,
1269 int tda18271_assign_map_layout(struct dvb_frontend *fe)
1271 struct tda18271_priv *priv = fe->tuner_priv;
1272 int ret = 0;
1274 switch (priv->id) {
1275 case TDA18271HDC1:
1276 priv->maps = &tda18271c1_map_layout;
1277 priv->std = tda18271c1_std_map;
1278 break;
1279 case TDA18271HDC2:
1280 priv->maps = &tda18271c2_map_layout;
1281 priv->std = tda18271c2_std_map;
1282 break;
1283 default:
1284 ret = -EINVAL;
1285 break;
1287 memcpy(priv->rf_cal_state, &tda18271_rf_band_template,
1288 sizeof(tda18271_rf_band_template));
1290 return ret;