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