]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - drivers/media/i2c/cx25840/cx25840-core.c
Merge branches 'for-4.11/upstream-fixes', 'for-4.12/accutouch', 'for-4.12/cp2112...
[mirror_ubuntu-artful-kernel.git] / drivers / media / i2c / cx25840 / cx25840-core.c
CommitLineData
bd985160
HV
1/* cx25840 - Conexant CX25840 audio/video decoder driver
2 *
3 * Copyright (C) 2004 Ulf Eklund
4 *
25985edc 5 * Based on the saa7115 driver and on the first version of Chris Kennedy's
bd985160
HV
6 * cx25840 driver.
7 *
8 * Changes by Tyler Trafford <tatrafford@comcast.net>
9 * - cleanup/rewrite for V4L2 API (2005)
10 *
11 * VBI support by Hans Verkuil <hverkuil@xs4all.nl>.
12 *
3e3bf277
CN
13 * NTSC sliced VBI support by Christopher Neufeld <television@cneufeld.ca>
14 * with additional fixes by Hans Verkuil <hverkuil@xs4all.nl>.
15 *
6d897616 16 * CX23885 support by Steven Toth <stoth@linuxtv.org>.
f234081b 17 *
52fd3dda
AW
18 * CX2388[578] IRQ handling, IO Pin mux configuration and other small fixes are
19 * Copyright (C) 2010 Andy Walls <awalls@md.metrocast.net>
20 *
74900b47
ST
21 * CX23888 DIF support for the HVR1850
22 * Copyright (C) 2011 Steven Toth <stoth@kernellabs.com>
23 *
bd985160
HV
24 * This program is free software; you can redistribute it and/or
25 * modify it under the terms of the GNU General Public License
26 * as published by the Free Software Foundation; either version 2
27 * of the License, or (at your option) any later version.
28 *
29 * This program is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 * GNU General Public License for more details.
bd985160
HV
33 */
34
35
36#include <linux/kernel.h>
37#include <linux/module.h>
38#include <linux/slab.h>
39#include <linux/videodev2.h>
40#include <linux/i2c.h>
f61b48f7 41#include <linux/delay.h>
3308e2b5 42#include <linux/math64.h>
bd985160 43#include <media/v4l2-common.h>
d647f0b7 44#include <media/drv-intf/cx25840.h>
bd985160 45
31bc09b5 46#include "cx25840-core.h"
bd985160
HV
47
48MODULE_DESCRIPTION("Conexant CX25840 audio/video decoder driver");
1f4b3365 49MODULE_AUTHOR("Ulf Eklund, Chris Kennedy, Hans Verkuil, Tyler Trafford");
bd985160
HV
50MODULE_LICENSE("GPL");
51
52fd3dda
AW
52#define CX25840_VID_INT_STAT_REG 0x410
53#define CX25840_VID_INT_STAT_BITS 0x0000ffff
54#define CX25840_VID_INT_MASK_BITS 0xffff0000
55#define CX25840_VID_INT_MASK_SHFT 16
56#define CX25840_VID_INT_MASK_REG 0x412
57
58#define CX23885_AUD_MC_INT_MASK_REG 0x80c
59#define CX23885_AUD_MC_INT_STAT_BITS 0xffff0000
60#define CX23885_AUD_MC_INT_CTRL_BITS 0x0000ffff
61#define CX23885_AUD_MC_INT_STAT_SHFT 16
62
63#define CX25840_AUD_INT_CTRL_REG 0x812
64#define CX25840_AUD_INT_STAT_REG 0x813
65
66#define CX23885_PIN_CTRL_IRQ_REG 0x123
67#define CX23885_PIN_CTRL_IRQ_IR_STAT 0x40
68#define CX23885_PIN_CTRL_IRQ_AUD_STAT 0x20
69#define CX23885_PIN_CTRL_IRQ_VID_STAT 0x10
70
71#define CX25840_IR_STATS_REG 0x210
72#define CX25840_IR_IRQEN_REG 0x214
73
fe0d3dff 74static int cx25840_debug;
bd985160 75
b5fc7144 76module_param_named(debug,cx25840_debug, int, 0644);
bd985160 77
fac9e899 78MODULE_PARM_DESC(debug, "Debugging messages [0=Off (default) 1=On]");
bd985160 79
bd985160
HV
80
81/* ----------------------------------------------------------------------- */
ba50e7e1 82static void cx23888_std_setup(struct i2c_client *client);
bd985160
HV
83
84int cx25840_write(struct i2c_client *client, u16 addr, u8 value)
85{
86 u8 buffer[3];
87 buffer[0] = addr >> 8;
88 buffer[1] = addr & 0xff;
89 buffer[2] = value;
90 return i2c_master_send(client, buffer, 3);
91}
92
93int cx25840_write4(struct i2c_client *client, u16 addr, u32 value)
94{
95 u8 buffer[6];
96 buffer[0] = addr >> 8;
97 buffer[1] = addr & 0xff;
4a56eb3f
HV
98 buffer[2] = value & 0xff;
99 buffer[3] = (value >> 8) & 0xff;
100 buffer[4] = (value >> 16) & 0xff;
101 buffer[5] = value >> 24;
bd985160
HV
102 return i2c_master_send(client, buffer, 6);
103}
104
105u8 cx25840_read(struct i2c_client * client, u16 addr)
106{
5f272644
AW
107 struct i2c_msg msgs[2];
108 u8 tx_buf[2], rx_buf[1];
109
110 /* Write register address */
111 tx_buf[0] = addr >> 8;
112 tx_buf[1] = addr & 0xff;
113 msgs[0].addr = client->addr;
114 msgs[0].flags = 0;
115 msgs[0].len = 2;
116 msgs[0].buf = (char *) tx_buf;
117
118 /* Read data from register */
119 msgs[1].addr = client->addr;
120 msgs[1].flags = I2C_M_RD;
121 msgs[1].len = 1;
122 msgs[1].buf = (char *) rx_buf;
123
124 if (i2c_transfer(client->adapter, msgs, 2) < 2)
bd985160
HV
125 return 0;
126
5f272644 127 return rx_buf[0];
bd985160
HV
128}
129
130u32 cx25840_read4(struct i2c_client * client, u16 addr)
131{
5f272644
AW
132 struct i2c_msg msgs[2];
133 u8 tx_buf[2], rx_buf[4];
134
135 /* Write register address */
136 tx_buf[0] = addr >> 8;
137 tx_buf[1] = addr & 0xff;
138 msgs[0].addr = client->addr;
139 msgs[0].flags = 0;
140 msgs[0].len = 2;
141 msgs[0].buf = (char *) tx_buf;
142
143 /* Read data from registers */
144 msgs[1].addr = client->addr;
145 msgs[1].flags = I2C_M_RD;
146 msgs[1].len = 4;
147 msgs[1].buf = (char *) rx_buf;
148
149 if (i2c_transfer(client->adapter, msgs, 2) < 2)
bd985160
HV
150 return 0;
151
5f272644
AW
152 return (rx_buf[3] << 24) | (rx_buf[2] << 16) | (rx_buf[1] << 8) |
153 rx_buf[0];
bd985160
HV
154}
155
e2b8cf4c 156int cx25840_and_or(struct i2c_client *client, u16 addr, unsigned and_mask,
bd985160
HV
157 u8 or_value)
158{
159 return cx25840_write(client, addr,
160 (cx25840_read(client, addr) & and_mask) |
161 or_value);
162}
163
52fd3dda
AW
164int cx25840_and_or4(struct i2c_client *client, u16 addr, u32 and_mask,
165 u32 or_value)
166{
167 return cx25840_write4(client, addr,
168 (cx25840_read4(client, addr) & and_mask) |
169 or_value);
170}
171
bd985160
HV
172/* ----------------------------------------------------------------------- */
173
a8bbf12a
HV
174static int set_input(struct i2c_client *client, enum cx25840_video_input vid_input,
175 enum cx25840_audio_input aud_input);
bd985160
HV
176
177/* ----------------------------------------------------------------------- */
178
d06d5777
AW
179static int cx23885_s_io_pin_config(struct v4l2_subdev *sd, size_t n,
180 struct v4l2_subdev_io_pin_config *p)
181{
182 struct i2c_client *client = v4l2_get_subdevdata(sd);
183 int i;
184 u32 pin_ctrl;
185 u8 gpio_oe, gpio_data, strength;
186
187 pin_ctrl = cx25840_read4(client, 0x120);
188 gpio_oe = cx25840_read(client, 0x160);
189 gpio_data = cx25840_read(client, 0x164);
190
191 for (i = 0; i < n; i++) {
192 strength = p[i].strength;
193 if (strength > CX25840_PIN_DRIVE_FAST)
194 strength = CX25840_PIN_DRIVE_FAST;
195
196 switch (p[i].pin) {
197 case CX23885_PIN_IRQ_N_GPIO16:
198 if (p[i].function != CX23885_PAD_IRQ_N) {
199 /* GPIO16 */
200 pin_ctrl &= ~(0x1 << 25);
201 } else {
202 /* IRQ_N */
203 if (p[i].flags &
204 (V4L2_SUBDEV_IO_PIN_DISABLE |
205 V4L2_SUBDEV_IO_PIN_INPUT)) {
206 pin_ctrl &= ~(0x1 << 25);
207 } else {
208 pin_ctrl |= (0x1 << 25);
209 }
210 if (p[i].flags &
211 V4L2_SUBDEV_IO_PIN_ACTIVE_LOW) {
212 pin_ctrl &= ~(0x1 << 24);
213 } else {
214 pin_ctrl |= (0x1 << 24);
215 }
216 }
217 break;
218 case CX23885_PIN_IR_RX_GPIO19:
219 if (p[i].function != CX23885_PAD_GPIO19) {
220 /* IR_RX */
221 gpio_oe |= (0x1 << 0);
222 pin_ctrl &= ~(0x3 << 18);
223 pin_ctrl |= (strength << 18);
224 } else {
225 /* GPIO19 */
226 gpio_oe &= ~(0x1 << 0);
227 if (p[i].flags & V4L2_SUBDEV_IO_PIN_SET_VALUE) {
228 gpio_data &= ~(0x1 << 0);
229 gpio_data |= ((p[i].value & 0x1) << 0);
230 }
231 pin_ctrl &= ~(0x3 << 12);
232 pin_ctrl |= (strength << 12);
233 }
234 break;
235 case CX23885_PIN_IR_TX_GPIO20:
236 if (p[i].function != CX23885_PAD_GPIO20) {
237 /* IR_TX */
238 gpio_oe |= (0x1 << 1);
239 if (p[i].flags & V4L2_SUBDEV_IO_PIN_DISABLE)
240 pin_ctrl &= ~(0x1 << 10);
241 else
242 pin_ctrl |= (0x1 << 10);
243 pin_ctrl &= ~(0x3 << 18);
244 pin_ctrl |= (strength << 18);
245 } else {
246 /* GPIO20 */
247 gpio_oe &= ~(0x1 << 1);
248 if (p[i].flags & V4L2_SUBDEV_IO_PIN_SET_VALUE) {
249 gpio_data &= ~(0x1 << 1);
250 gpio_data |= ((p[i].value & 0x1) << 1);
251 }
252 pin_ctrl &= ~(0x3 << 12);
253 pin_ctrl |= (strength << 12);
254 }
255 break;
256 case CX23885_PIN_I2S_SDAT_GPIO21:
257 if (p[i].function != CX23885_PAD_GPIO21) {
258 /* I2S_SDAT */
259 /* TODO: Input or Output config */
260 gpio_oe |= (0x1 << 2);
261 pin_ctrl &= ~(0x3 << 22);
262 pin_ctrl |= (strength << 22);
263 } else {
264 /* GPIO21 */
265 gpio_oe &= ~(0x1 << 2);
266 if (p[i].flags & V4L2_SUBDEV_IO_PIN_SET_VALUE) {
267 gpio_data &= ~(0x1 << 2);
268 gpio_data |= ((p[i].value & 0x1) << 2);
269 }
270 pin_ctrl &= ~(0x3 << 12);
271 pin_ctrl |= (strength << 12);
272 }
273 break;
274 case CX23885_PIN_I2S_WCLK_GPIO22:
275 if (p[i].function != CX23885_PAD_GPIO22) {
276 /* I2S_WCLK */
277 /* TODO: Input or Output config */
278 gpio_oe |= (0x1 << 3);
279 pin_ctrl &= ~(0x3 << 22);
280 pin_ctrl |= (strength << 22);
281 } else {
282 /* GPIO22 */
283 gpio_oe &= ~(0x1 << 3);
284 if (p[i].flags & V4L2_SUBDEV_IO_PIN_SET_VALUE) {
285 gpio_data &= ~(0x1 << 3);
286 gpio_data |= ((p[i].value & 0x1) << 3);
287 }
288 pin_ctrl &= ~(0x3 << 12);
289 pin_ctrl |= (strength << 12);
290 }
291 break;
292 case CX23885_PIN_I2S_BCLK_GPIO23:
293 if (p[i].function != CX23885_PAD_GPIO23) {
294 /* I2S_BCLK */
295 /* TODO: Input or Output config */
296 gpio_oe |= (0x1 << 4);
297 pin_ctrl &= ~(0x3 << 22);
298 pin_ctrl |= (strength << 22);
299 } else {
300 /* GPIO23 */
301 gpio_oe &= ~(0x1 << 4);
302 if (p[i].flags & V4L2_SUBDEV_IO_PIN_SET_VALUE) {
303 gpio_data &= ~(0x1 << 4);
304 gpio_data |= ((p[i].value & 0x1) << 4);
305 }
306 pin_ctrl &= ~(0x3 << 12);
307 pin_ctrl |= (strength << 12);
308 }
309 break;
310 }
311 }
312
313 cx25840_write(client, 0x164, gpio_data);
314 cx25840_write(client, 0x160, gpio_oe);
315 cx25840_write4(client, 0x120, pin_ctrl);
316 return 0;
317}
318
319static int common_s_io_pin_config(struct v4l2_subdev *sd, size_t n,
320 struct v4l2_subdev_io_pin_config *pincfg)
321{
322 struct cx25840_state *state = to_state(sd);
323
324 if (is_cx2388x(state))
325 return cx23885_s_io_pin_config(sd, n, pincfg);
326 return 0;
327}
328
329/* ----------------------------------------------------------------------- */
330
d92c20e0 331static void init_dll1(struct i2c_client *client)
bd985160
HV
332{
333 /* This is the Hauppauge sequence used to
334 * initialize the Delay Lock Loop 1 (ADC DLL). */
335 cx25840_write(client, 0x159, 0x23);
336 cx25840_write(client, 0x15a, 0x87);
337 cx25840_write(client, 0x15b, 0x06);
38051450 338 udelay(10);
bd985160 339 cx25840_write(client, 0x159, 0xe1);
38051450 340 udelay(10);
bd985160
HV
341 cx25840_write(client, 0x15a, 0x86);
342 cx25840_write(client, 0x159, 0xe0);
343 cx25840_write(client, 0x159, 0xe1);
344 cx25840_write(client, 0x15b, 0x10);
345}
346
d92c20e0 347static void init_dll2(struct i2c_client *client)
bd985160
HV
348{
349 /* This is the Hauppauge sequence used to
350 * initialize the Delay Lock Loop 2 (ADC DLL). */
351 cx25840_write(client, 0x15d, 0xe3);
352 cx25840_write(client, 0x15e, 0x86);
353 cx25840_write(client, 0x15f, 0x06);
38051450 354 udelay(10);
bd985160
HV
355 cx25840_write(client, 0x15d, 0xe1);
356 cx25840_write(client, 0x15d, 0xe0);
357 cx25840_write(client, 0x15d, 0xe1);
358}
359
e2b8cf4c
HV
360static void cx25836_initialize(struct i2c_client *client)
361{
362 /* reset configuration is described on page 3-77 of the CX25836 datasheet */
363 /* 2. */
364 cx25840_and_or(client, 0x000, ~0x01, 0x01);
365 cx25840_and_or(client, 0x000, ~0x01, 0x00);
366 /* 3a. */
367 cx25840_and_or(client, 0x15a, ~0x70, 0x00);
368 /* 3b. */
369 cx25840_and_or(client, 0x15b, ~0x1e, 0x06);
370 /* 3c. */
371 cx25840_and_or(client, 0x159, ~0x02, 0x02);
372 /* 3d. */
38051450 373 udelay(10);
e2b8cf4c
HV
374 /* 3e. */
375 cx25840_and_or(client, 0x159, ~0x02, 0x00);
376 /* 3f. */
377 cx25840_and_or(client, 0x159, ~0xc0, 0xc0);
378 /* 3g. */
379 cx25840_and_or(client, 0x159, ~0x01, 0x00);
380 cx25840_and_or(client, 0x159, ~0x01, 0x01);
381 /* 3h. */
382 cx25840_and_or(client, 0x15b, ~0x1e, 0x10);
383}
384
21340ae0
HV
385static void cx25840_work_handler(struct work_struct *work)
386{
387 struct cx25840_state *state = container_of(work, struct cx25840_state, fw_work);
388 cx25840_loadfw(state->c);
389 wake_up(&state->fw_wait);
390}
391
89fc4eb9 392static void cx25840_initialize(struct i2c_client *client)
bd985160 393{
21340ae0 394 DEFINE_WAIT(wait);
9357b31c 395 struct cx25840_state *state = to_state(i2c_get_clientdata(client));
21340ae0 396 struct workqueue_struct *q;
bd985160
HV
397
398 /* datasheet startup in numbered steps, refer to page 3-77 */
399 /* 2. */
400 cx25840_and_or(client, 0x803, ~0x10, 0x00);
401 /* The default of this register should be 4, but I get 0 instead.
402 * Set this register to 4 manually. */
403 cx25840_write(client, 0x000, 0x04);
404 /* 3. */
405 init_dll1(client);
406 init_dll2(client);
407 cx25840_write(client, 0x136, 0x0a);
408 /* 4. */
409 cx25840_write(client, 0x13c, 0x01);
410 cx25840_write(client, 0x13c, 0x00);
411 /* 5. */
21340ae0
HV
412 /* Do the firmware load in a work handler to prevent.
413 Otherwise the kernel is blocked waiting for the
414 bit-banging i2c interface to finish uploading the
415 firmware. */
416 INIT_WORK(&state->fw_work, cx25840_work_handler);
417 init_waitqueue_head(&state->fw_wait);
418 q = create_singlethread_workqueue("cx25840_fw");
419 prepare_to_wait(&state->fw_wait, &wait, TASK_UNINTERRUPTIBLE);
420 queue_work(q, &state->fw_work);
421 schedule();
422 finish_wait(&state->fw_wait, &wait);
423 destroy_workqueue(q);
424
bd985160
HV
425 /* 6. */
426 cx25840_write(client, 0x115, 0x8c);
427 cx25840_write(client, 0x116, 0x07);
428 cx25840_write(client, 0x118, 0x02);
429 /* 7. */
430 cx25840_write(client, 0x4a5, 0x80);
431 cx25840_write(client, 0x4a5, 0x00);
432 cx25840_write(client, 0x402, 0x00);
433 /* 8. */
73dcddc5
HV
434 cx25840_and_or(client, 0x401, ~0x18, 0);
435 cx25840_and_or(client, 0x4a2, ~0x10, 0x10);
436 /* steps 8c and 8d are done in change_input() */
bd985160
HV
437 /* 10. */
438 cx25840_write(client, 0x8d3, 0x1f);
439 cx25840_write(client, 0x8e3, 0x03);
440
cb5aa1c6 441 cx25840_std_setup(client);
bd985160
HV
442
443 /* trial and error says these are needed to get audio */
444 cx25840_write(client, 0x914, 0xa0);
445 cx25840_write(client, 0x918, 0xa0);
446 cx25840_write(client, 0x919, 0x01);
447
25985edc 448 /* stereo preferred */
bd985160
HV
449 cx25840_write(client, 0x809, 0x04);
450 /* AC97 shift */
451 cx25840_write(client, 0x8cf, 0x0f);
452
a8bbf12a
HV
453 /* (re)set input */
454 set_input(client, state->vid_input, state->aud_input);
bd985160
HV
455
456 /* start microcontroller */
457 cx25840_and_or(client, 0x803, ~0x10, 0x10);
458}
459
f234081b
ST
460static void cx23885_initialize(struct i2c_client *client)
461{
462 DEFINE_WAIT(wait);
9357b31c 463 struct cx25840_state *state = to_state(i2c_get_clientdata(client));
f234081b
ST
464 struct workqueue_struct *q;
465
e283d780
AW
466 /*
467 * Come out of digital power down
468 * The CX23888, at least, needs this, otherwise registers aside from
469 * 0x0-0x2 can't be read or written.
470 */
471 cx25840_write(client, 0x000, 0);
472
f234081b
ST
473 /* Internal Reset */
474 cx25840_and_or(client, 0x102, ~0x01, 0x01);
475 cx25840_and_or(client, 0x102, ~0x01, 0x00);
476
477 /* Stop microcontroller */
478 cx25840_and_or(client, 0x803, ~0x10, 0x00);
479
480 /* DIF in reset? */
481 cx25840_write(client, 0x398, 0);
482
e283d780
AW
483 /*
484 * Trust the default xtal, no division
485 * '885: 28.636363... MHz
486 * '887: 25.000000 MHz
487 * '888: 50.000000 MHz
488 */
f234081b
ST
489 cx25840_write(client, 0x2, 0x76);
490
e283d780 491 /* Power up all the PLL's and DLL */
f234081b
ST
492 cx25840_write(client, 0x1, 0x40);
493
e283d780
AW
494 /* Sys PLL */
495 switch (state->id) {
29d6a98b 496 case CX23888_AV:
e283d780
AW
497 /*
498 * 50.0 MHz * (0xb + 0xe8ba26/0x2000000)/4 = 5 * 28.636363 MHz
499 * 572.73 MHz before post divide
500 */
74900b47
ST
501 /* HVR1850 or 50MHz xtal */
502 cx25840_write(client, 0x2, 0x71);
503 cx25840_write4(client, 0x11c, 0x01d1744c);
504 cx25840_write4(client, 0x118, 0x00000416);
505 cx25840_write4(client, 0x404, 0x0010253e);
506 cx25840_write4(client, 0x42c, 0x42600000);
507 cx25840_write4(client, 0x44c, 0x161f1000);
e283d780 508 break;
29d6a98b 509 case CX23887_AV:
e283d780
AW
510 /*
511 * 25.0 MHz * (0x16 + 0x1d1744c/0x2000000)/4 = 5 * 28.636363 MHz
512 * 572.73 MHz before post divide
513 */
514 cx25840_write4(client, 0x11c, 0x01d1744c);
515 cx25840_write4(client, 0x118, 0x00000416);
516 break;
29d6a98b 517 case CX23885_AV:
e283d780
AW
518 default:
519 /*
520 * 28.636363 MHz * (0x14 + 0x0/0x2000000)/4 = 5 * 28.636363 MHz
521 * 572.73 MHz before post divide
522 */
523 cx25840_write4(client, 0x11c, 0x00000000);
524 cx25840_write4(client, 0x118, 0x00000414);
525 break;
526 }
f234081b
ST
527
528 /* Disable DIF bypass */
529 cx25840_write4(client, 0x33c, 0x00000001);
530
531 /* DIF Src phase inc */
532 cx25840_write4(client, 0x340, 0x0df7df83);
533
e283d780
AW
534 /*
535 * Vid PLL
536 * Setup for a BT.656 pixel clock of 13.5 Mpixels/second
537 *
538 * 28.636363 MHz * (0xf + 0x02be2c9/0x2000000)/4 = 8 * 13.5 MHz
539 * 432.0 MHz before post divide
540 */
74900b47
ST
541
542 /* HVR1850 */
543 switch (state->id) {
29d6a98b 544 case CX23888_AV:
74900b47
ST
545 /* 888/HVR1250 specific */
546 cx25840_write4(client, 0x10c, 0x13333333);
547 cx25840_write4(client, 0x108, 0x00000515);
548 break;
549 default:
550 cx25840_write4(client, 0x10c, 0x002be2c9);
551 cx25840_write4(client, 0x108, 0x0000040f);
552 }
f234081b
ST
553
554 /* Luma */
555 cx25840_write4(client, 0x414, 0x00107d12);
556
557 /* Chroma */
ee61cd9f
HV
558 if (is_cx23888(state))
559 cx25840_write4(client, 0x418, 0x1d008282);
560 else
561 cx25840_write4(client, 0x420, 0x3d008282);
f234081b 562
e283d780
AW
563 /*
564 * Aux PLL
565 * Initial setup for audio sample clock:
566 * 48 ksps, 16 bits/sample, x160 multiplier = 122.88 MHz
25985edc 567 * Initial I2S output/master clock(?):
e283d780
AW
568 * 48 ksps, 16 bits/sample, x16 multiplier = 12.288 MHz
569 */
570 switch (state->id) {
29d6a98b 571 case CX23888_AV:
e283d780
AW
572 /*
573 * 50.0 MHz * (0x7 + 0x0bedfa4/0x2000000)/3 = 122.88 MHz
574 * 368.64 MHz before post divide
575 * 122.88 MHz / 0xa = 12.288 MHz
576 */
74900b47
ST
577 /* HVR1850 or 50MHz xtal */
578 cx25840_write4(client, 0x114, 0x017dbf48);
579 cx25840_write4(client, 0x110, 0x000a030e);
e283d780 580 break;
29d6a98b 581 case CX23887_AV:
e283d780
AW
582 /*
583 * 25.0 MHz * (0xe + 0x17dbf48/0x2000000)/3 = 122.88 MHz
584 * 368.64 MHz before post divide
585 * 122.88 MHz / 0xa = 12.288 MHz
586 */
587 cx25840_write4(client, 0x114, 0x017dbf48);
588 cx25840_write4(client, 0x110, 0x000a030e);
589 break;
29d6a98b 590 case CX23885_AV:
e283d780
AW
591 default:
592 /*
593 * 28.636363 MHz * (0xc + 0x1bf0c9e/0x2000000)/3 = 122.88 MHz
594 * 368.64 MHz before post divide
595 * 122.88 MHz / 0xa = 12.288 MHz
596 */
597 cx25840_write4(client, 0x114, 0x01bf0c9e);
598 cx25840_write4(client, 0x110, 0x000a030c);
599 break;
c2c1b415 600 }
f234081b
ST
601
602 /* ADC2 input select */
603 cx25840_write(client, 0x102, 0x10);
604
605 /* VIN1 & VIN5 */
606 cx25840_write(client, 0x103, 0x11);
607
608 /* Enable format auto detect */
609 cx25840_write(client, 0x400, 0);
610 /* Fast subchroma lock */
611 /* White crush, Chroma AGC & Chroma Killer enabled */
612 cx25840_write(client, 0x401, 0xe8);
613
614 /* Select AFE clock pad output source */
615 cx25840_write(client, 0x144, 0x05);
616
f3d6f633
ST
617 /* Drive GPIO2 direction and values for HVR1700
618 * where an onboard mux selects the output of demodulator
619 * vs the 417. Failure to set this results in no DTV.
620 * It's safe to set this across all Hauppauge boards
621 * currently, regardless of the board type.
622 */
623 cx25840_write(client, 0x160, 0x1d);
624 cx25840_write(client, 0x164, 0x00);
625
f234081b
ST
626 /* Do the firmware load in a work handler to prevent.
627 Otherwise the kernel is blocked waiting for the
628 bit-banging i2c interface to finish uploading the
629 firmware. */
630 INIT_WORK(&state->fw_work, cx25840_work_handler);
631 init_waitqueue_head(&state->fw_wait);
632 q = create_singlethread_workqueue("cx25840_fw");
633 prepare_to_wait(&state->fw_wait, &wait, TASK_UNINTERRUPTIBLE);
634 queue_work(q, &state->fw_work);
635 schedule();
636 finish_wait(&state->fw_wait, &wait);
637 destroy_workqueue(q);
638
ba50e7e1 639 /* Call the cx23888 specific std setup func, we no longer rely on
74900b47
ST
640 * the generic cx24840 func.
641 */
ba50e7e1
DH
642 if (is_cx23888(state))
643 cx23888_std_setup(client);
644 else
645 cx25840_std_setup(client);
f234081b
ST
646
647 /* (re)set input */
648 set_input(client, state->vid_input, state->aud_input);
649
650 /* start microcontroller */
651 cx25840_and_or(client, 0x803, ~0x10, 0x10);
52fd3dda
AW
652
653 /* Disable and clear video interrupts - we don't use them */
654 cx25840_write4(client, CX25840_VID_INT_STAT_REG, 0xffffffff);
655
656 /* Disable and clear audio interrupts - we don't use them */
657 cx25840_write(client, CX25840_AUD_INT_CTRL_REG, 0xff);
658 cx25840_write(client, CX25840_AUD_INT_STAT_REG, 0xff);
74900b47
ST
659
660 /* CC raw enable */
661 /* - VIP 1.1 control codes - 10bit, blue field enable.
662 * - enable raw data during vertical blanking.
663 * - enable ancillary Data insertion for 656 or VIP.
664 */
665 cx25840_write4(client, 0x404, 0x0010253e);
666
667 /* CC on - Undocumented Register */
cdf472d3 668 cx25840_write(client, state->vbi_regs_offset + 0x42f, 0x66);
74900b47
ST
669
670 /* HVR-1250 / HVR1850 DIF related */
671 /* Power everything up */
672 cx25840_write4(client, 0x130, 0x0);
673
674 /* Undocumented */
ee61cd9f
HV
675 if (is_cx23888(state))
676 cx25840_write4(client, 0x454, 0x6628021F);
677 else
678 cx25840_write4(client, 0x478, 0x6628021F);
74900b47
ST
679
680 /* AFE_CLK_OUT_CTRL - Select the clock output source as output */
681 cx25840_write4(client, 0x144, 0x5);
682
683 /* I2C_OUT_CTL - I2S output configuration as
684 * Master, Sony, Left justified, left sample on WS=1
685 */
686 cx25840_write4(client, 0x918, 0x1a0);
687
688 /* AFE_DIAG_CTRL1 */
689 cx25840_write4(client, 0x134, 0x000a1800);
690
691 /* AFE_DIAG_CTRL3 - Inverted Polarity for Audio and Video */
692 cx25840_write4(client, 0x13c, 0x00310000);
f234081b
ST
693}
694
bd985160
HV
695/* ----------------------------------------------------------------------- */
696
149783b5
SD
697static void cx231xx_initialize(struct i2c_client *client)
698{
699 DEFINE_WAIT(wait);
700 struct cx25840_state *state = to_state(i2c_get_clientdata(client));
701 struct workqueue_struct *q;
702
703 /* Internal Reset */
704 cx25840_and_or(client, 0x102, ~0x01, 0x01);
705 cx25840_and_or(client, 0x102, ~0x01, 0x00);
706
707 /* Stop microcontroller */
708 cx25840_and_or(client, 0x803, ~0x10, 0x00);
709
710 /* DIF in reset? */
711 cx25840_write(client, 0x398, 0);
712
713 /* Trust the default xtal, no division */
714 /* This changes for the cx23888 products */
715 cx25840_write(client, 0x2, 0x76);
716
717 /* Bring down the regulator for AUX clk */
718 cx25840_write(client, 0x1, 0x40);
719
720 /* Disable DIF bypass */
721 cx25840_write4(client, 0x33c, 0x00000001);
722
723 /* DIF Src phase inc */
724 cx25840_write4(client, 0x340, 0x0df7df83);
725
149783b5
SD
726 /* Luma */
727 cx25840_write4(client, 0x414, 0x00107d12);
728
729 /* Chroma */
730 cx25840_write4(client, 0x420, 0x3d008282);
731
149783b5
SD
732 /* ADC2 input select */
733 cx25840_write(client, 0x102, 0x10);
734
735 /* VIN1 & VIN5 */
736 cx25840_write(client, 0x103, 0x11);
737
738 /* Enable format auto detect */
739 cx25840_write(client, 0x400, 0);
740 /* Fast subchroma lock */
741 /* White crush, Chroma AGC & Chroma Killer enabled */
742 cx25840_write(client, 0x401, 0xe8);
743
149783b5
SD
744 /* Do the firmware load in a work handler to prevent.
745 Otherwise the kernel is blocked waiting for the
746 bit-banging i2c interface to finish uploading the
747 firmware. */
748 INIT_WORK(&state->fw_work, cx25840_work_handler);
749 init_waitqueue_head(&state->fw_wait);
750 q = create_singlethread_workqueue("cx25840_fw");
751 prepare_to_wait(&state->fw_wait, &wait, TASK_UNINTERRUPTIBLE);
752 queue_work(q, &state->fw_work);
753 schedule();
754 finish_wait(&state->fw_wait, &wait);
755 destroy_workqueue(q);
756
757 cx25840_std_setup(client);
758
759 /* (re)set input */
760 set_input(client, state->vid_input, state->aud_input);
761
762 /* start microcontroller */
763 cx25840_and_or(client, 0x803, ~0x10, 0x10);
99d38909
ST
764
765 /* CC raw enable */
766 cx25840_write(client, 0x404, 0x0b);
767
768 /* CC on */
769 cx25840_write(client, 0x42f, 0x66);
770 cx25840_write4(client, 0x474, 0x1e1e601a);
149783b5
SD
771}
772
773/* ----------------------------------------------------------------------- */
774
cb5aa1c6
HV
775void cx25840_std_setup(struct i2c_client *client)
776{
9357b31c 777 struct cx25840_state *state = to_state(i2c_get_clientdata(client));
cb5aa1c6
HV
778 v4l2_std_id std = state->std;
779 int hblank, hactive, burst, vblank, vactive, sc;
780 int vblank656, src_decimation;
781 int luma_lpf, uv_lpf, comb;
782 u32 pll_int, pll_frac, pll_post;
783
784 /* datasheet startup, step 8d */
785 if (std & ~V4L2_STD_NTSC)
786 cx25840_write(client, 0x49f, 0x11);
787 else
788 cx25840_write(client, 0x49f, 0x14);
789
790 if (std & V4L2_STD_625_50) {
791 hblank = 132;
792 hactive = 720;
793 burst = 93;
794 vblank = 36;
795 vactive = 580;
796 vblank656 = 40;
797 src_decimation = 0x21f;
798 luma_lpf = 2;
799
800 if (std & V4L2_STD_SECAM) {
801 uv_lpf = 0;
802 comb = 0;
803 sc = 0x0a425f;
804 } else if (std == V4L2_STD_PAL_Nc) {
805 uv_lpf = 1;
806 comb = 0x20;
807 sc = 556453;
808 } else {
809 uv_lpf = 1;
810 comb = 0x20;
811 sc = 688739;
812 }
813 } else {
814 hactive = 720;
815 hblank = 122;
816 vactive = 487;
817 luma_lpf = 1;
818 uv_lpf = 1;
819
820 src_decimation = 0x21f;
821 if (std == V4L2_STD_PAL_60) {
822 vblank = 26;
823 vblank656 = 26;
824 burst = 0x5b;
825 luma_lpf = 2;
826 comb = 0x20;
827 sc = 688739;
828 } else if (std == V4L2_STD_PAL_M) {
829 vblank = 20;
830 vblank656 = 24;
831 burst = 0x61;
832 comb = 0x20;
833 sc = 555452;
834 } else {
835 vblank = 26;
836 vblank656 = 26;
837 burst = 0x5b;
838 comb = 0x66;
839 sc = 556063;
840 }
841 }
842
843 /* DEBUG: Displays configured PLL frequency */
2a03f034 844 if (!is_cx231xx(state)) {
95b14fb2
MCC
845 pll_int = cx25840_read(client, 0x108);
846 pll_frac = cx25840_read4(client, 0x10c) & 0x1ffffff;
847 pll_post = cx25840_read(client, 0x109);
cb5aa1c6 848 v4l_dbg(1, cx25840_debug, client,
95b14fb2
MCC
849 "PLL regs = int: %u, frac: %u, post: %u\n",
850 pll_int, pll_frac, pll_post);
851
852 if (pll_post) {
853 int fin, fsc;
854 int pll = (28636363L * ((((u64)pll_int) << 25L) + pll_frac)) >> 25L;
855
856 pll /= pll_post;
857 v4l_dbg(1, cx25840_debug, client, "PLL = %d.%06d MHz\n",
858 pll / 1000000, pll % 1000000);
859 v4l_dbg(1, cx25840_debug, client, "PLL/8 = %d.%06d MHz\n",
860 pll / 8000000, (pll / 8) % 1000000);
861
862 fin = ((u64)src_decimation * pll) >> 12;
863 v4l_dbg(1, cx25840_debug, client,
864 "ADC Sampling freq = %d.%06d MHz\n",
865 fin / 1000000, fin % 1000000);
866
867 fsc = (((u64)sc) * pll) >> 24L;
868 v4l_dbg(1, cx25840_debug, client,
869 "Chroma sub-carrier freq = %d.%06d MHz\n",
870 fsc / 1000000, fsc % 1000000);
871
72cc0671 872 v4l_dbg(1, cx25840_debug, client, "hblank %i, hactive %i, vblank %i, vactive %i, vblank656 %i, src_dec %i, burst 0x%02x, luma_lpf %i, uv_lpf %i, comb 0x%02x, sc 0x%06x\n",
95b14fb2
MCC
873 hblank, hactive, vblank, vactive, vblank656,
874 src_decimation, burst, luma_lpf, uv_lpf, comb, sc);
875 }
cb5aa1c6
HV
876 }
877
878 /* Sets horizontal blanking delay and active lines */
879 cx25840_write(client, 0x470, hblank);
880 cx25840_write(client, 0x471,
85273c38 881 (((hblank >> 8) & 0x3) | (hactive << 4)) & 0xff);
cb5aa1c6
HV
882 cx25840_write(client, 0x472, hactive >> 4);
883
884 /* Sets burst gate delay */
885 cx25840_write(client, 0x473, burst);
886
887 /* Sets vertical blanking delay and active duration */
888 cx25840_write(client, 0x474, vblank);
889 cx25840_write(client, 0x475,
85273c38 890 (((vblank >> 8) & 0x3) | (vactive << 4)) & 0xff);
cb5aa1c6
HV
891 cx25840_write(client, 0x476, vactive >> 4);
892 cx25840_write(client, 0x477, vblank656);
893
894 /* Sets src decimation rate */
85273c38
JP
895 cx25840_write(client, 0x478, src_decimation & 0xff);
896 cx25840_write(client, 0x479, (src_decimation >> 8) & 0xff);
cb5aa1c6
HV
897
898 /* Sets Luma and UV Low pass filters */
899 cx25840_write(client, 0x47a, luma_lpf << 6 | ((uv_lpf << 4) & 0x30));
900
901 /* Enables comb filters */
902 cx25840_write(client, 0x47b, comb);
903
904 /* Sets SC Step*/
905 cx25840_write(client, 0x47c, sc);
85273c38
JP
906 cx25840_write(client, 0x47d, (sc >> 8) & 0xff);
907 cx25840_write(client, 0x47e, (sc >> 16) & 0xff);
cb5aa1c6
HV
908
909 /* Sets VBI parameters */
910 if (std & V4L2_STD_625_50) {
911 cx25840_write(client, 0x47f, 0x01);
912 state->vbi_line_offset = 5;
913 } else {
914 cx25840_write(client, 0x47f, 0x00);
915 state->vbi_line_offset = 8;
916 }
917}
918
919/* ----------------------------------------------------------------------- */
920
bd985160
HV
921static void input_change(struct i2c_client *client)
922{
9357b31c 923 struct cx25840_state *state = to_state(i2c_get_clientdata(client));
081b496a 924 v4l2_std_id std = state->std;
bd985160 925
73dcddc5
HV
926 /* Follow step 8c and 8d of section 3.16 in the cx25840 datasheet */
927 if (std & V4L2_STD_SECAM) {
928 cx25840_write(client, 0x402, 0);
929 }
930 else {
931 cx25840_write(client, 0x402, 0x04);
932 cx25840_write(client, 0x49f, (std & V4L2_STD_NTSC) ? 0x14 : 0x11);
933 }
934 cx25840_and_or(client, 0x401, ~0x60, 0);
935 cx25840_and_or(client, 0x401, ~0x60, 0x60);
5af79f86
SB
936
937 /* Don't write into audio registers on cx2583x chips */
938 if (is_cx2583x(state))
939 return;
940
82677618 941 cx25840_and_or(client, 0x810, ~0x01, 1);
73dcddc5 942
39c4ad6a
HV
943 if (state->radio) {
944 cx25840_write(client, 0x808, 0xf9);
945 cx25840_write(client, 0x80b, 0x00);
946 }
947 else if (std & V4L2_STD_525_60) {
d97a11e0
HV
948 /* Certain Hauppauge PVR150 models have a hardware bug
949 that causes audio to drop out. For these models the
950 audio standard must be set explicitly.
951 To be precise: it affects cards with tuner models
952 85, 99 and 112 (model numbers from tveeprom). */
953 int hw_fix = state->pvr150_workaround;
954
955 if (std == V4L2_STD_NTSC_M_JP) {
f95006f8 956 /* Japan uses EIAJ audio standard */
d97a11e0
HV
957 cx25840_write(client, 0x808, hw_fix ? 0x2f : 0xf7);
958 } else if (std == V4L2_STD_NTSC_M_KR) {
959 /* South Korea uses A2 audio standard */
960 cx25840_write(client, 0x808, hw_fix ? 0x3f : 0xf8);
f95006f8
HV
961 } else {
962 /* Others use the BTSC audio standard */
d97a11e0 963 cx25840_write(client, 0x808, hw_fix ? 0x1f : 0xf6);
f95006f8 964 }
bd985160 965 cx25840_write(client, 0x80b, 0x00);
839e4a4a 966 } else if (std & V4L2_STD_PAL) {
3c3099d5 967 /* Autodetect audio standard and audio system */
839e4a4a 968 cx25840_write(client, 0x808, 0xff);
25985edc 969 /* Since system PAL-L is pretty much non-existent and
3c3099d5
AP
970 not used by any public broadcast network, force
971 6.5 MHz carrier to be interpreted as System DK,
972 this avoids DK audio detection instability */
e118120b 973 cx25840_write(client, 0x80b, 0x00);
839e4a4a 974 } else if (std & V4L2_STD_SECAM) {
3c3099d5 975 /* Autodetect audio standard and audio system */
839e4a4a 976 cx25840_write(client, 0x808, 0xff);
3c3099d5
AP
977 /* If only one of SECAM-DK / SECAM-L is required, then force
978 6.5MHz carrier, else autodetect it */
979 if ((std & V4L2_STD_SECAM_DK) &&
980 !(std & (V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC))) {
981 /* 6.5 MHz carrier to be interpreted as System DK */
982 cx25840_write(client, 0x80b, 0x00);
983 } else if (!(std & V4L2_STD_SECAM_DK) &&
984 (std & (V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC))) {
985 /* 6.5 MHz carrier to be interpreted as System L */
986 cx25840_write(client, 0x80b, 0x08);
987 } else {
988 /* 6.5 MHz carrier to be autodetected */
989 cx25840_write(client, 0x80b, 0x10);
990 }
bd985160
HV
991 }
992
82677618 993 cx25840_and_or(client, 0x810, ~0x01, 0);
bd985160
HV
994}
995
a8bbf12a
HV
996static int set_input(struct i2c_client *client, enum cx25840_video_input vid_input,
997 enum cx25840_audio_input aud_input)
bd985160 998{
9357b31c 999 struct cx25840_state *state = to_state(i2c_get_clientdata(client));
a8bbf12a
HV
1000 u8 is_composite = (vid_input >= CX25840_COMPOSITE1 &&
1001 vid_input <= CX25840_COMPOSITE8);
fb29ab96
DW
1002 u8 is_component = (vid_input & CX25840_COMPONENT_ON) ==
1003 CX25840_COMPONENT_ON;
74900b47
ST
1004 u8 is_dif = (vid_input & CX25840_DIF_ON) ==
1005 CX25840_DIF_ON;
1006 u8 is_svideo = (vid_input & CX25840_SVIDEO_ON) ==
1007 CX25840_SVIDEO_ON;
fb29ab96
DW
1008 int luma = vid_input & 0xf0;
1009 int chroma = vid_input & 0xf00;
a8bbf12a 1010 u8 reg;
74900b47 1011 u32 val;
bd985160 1012
f234081b
ST
1013 v4l_dbg(1, cx25840_debug, client,
1014 "decoder set video input %d, audio input %d\n",
1015 vid_input, aud_input);
bd985160 1016
f234081b
ST
1017 if (vid_input >= CX25840_VIN1_CH1) {
1018 v4l_dbg(1, cx25840_debug, client, "vid_input 0x%x\n",
1019 vid_input);
1020 reg = vid_input & 0xff;
10e43d90
KK
1021 is_composite = !is_component &&
1022 ((vid_input & CX25840_SVIDEO_ON) != CX25840_SVIDEO_ON);
f234081b
ST
1023
1024 v4l_dbg(1, cx25840_debug, client, "mux cfg 0x%x comp=%d\n",
1025 reg, is_composite);
fb29ab96 1026 } else if (is_composite) {
a8bbf12a
HV
1027 reg = 0xf0 + (vid_input - CX25840_COMPOSITE1);
1028 } else {
a8bbf12a 1029 if ((vid_input & ~0xff0) ||
45270a15 1030 luma < CX25840_SVIDEO_LUMA1 || luma > CX25840_SVIDEO_LUMA8 ||
a8bbf12a 1031 chroma < CX25840_SVIDEO_CHROMA4 || chroma > CX25840_SVIDEO_CHROMA8) {
f234081b
ST
1032 v4l_err(client, "0x%04x is not a valid video input!\n",
1033 vid_input);
a8bbf12a 1034 return -EINVAL;
bd985160 1035 }
a8bbf12a
HV
1036 reg = 0xf0 + ((luma - CX25840_SVIDEO_LUMA1) >> 4);
1037 if (chroma >= CX25840_SVIDEO_CHROMA7) {
1038 reg &= 0x3f;
1039 reg |= (chroma - CX25840_SVIDEO_CHROMA7) >> 2;
bd985160 1040 } else {
a8bbf12a
HV
1041 reg &= 0xcf;
1042 reg |= (chroma - CX25840_SVIDEO_CHROMA4) >> 4;
bd985160 1043 }
a8bbf12a 1044 }
bd985160 1045
f234081b
ST
1046 /* The caller has previously prepared the correct routing
1047 * configuration in reg (for the cx23885) so we have no
1048 * need to attempt to flip bits for earlier av decoders.
1049 */
2a03f034 1050 if (!is_cx2388x(state) && !is_cx231xx(state)) {
f234081b
ST
1051 switch (aud_input) {
1052 case CX25840_AUDIO_SERIAL:
1053 /* do nothing, use serial audio input */
1054 break;
1055 case CX25840_AUDIO4: reg &= ~0x30; break;
1056 case CX25840_AUDIO5: reg &= ~0x30; reg |= 0x10; break;
1057 case CX25840_AUDIO6: reg &= ~0x30; reg |= 0x20; break;
1058 case CX25840_AUDIO7: reg &= ~0xc0; break;
1059 case CX25840_AUDIO8: reg &= ~0xc0; reg |= 0x40; break;
bd985160 1060
f234081b
ST
1061 default:
1062 v4l_err(client, "0x%04x is not a valid audio input!\n",
1063 aud_input);
1064 return -EINVAL;
1065 }
bd985160
HV
1066 }
1067
a8bbf12a 1068 cx25840_write(client, 0x103, reg);
f234081b 1069
fb29ab96
DW
1070 /* Set INPUT_MODE to Composite, S-Video or Component */
1071 if (is_component)
1072 cx25840_and_or(client, 0x401, ~0x6, 0x6);
1073 else
1074 cx25840_and_or(client, 0x401, ~0x6, is_composite ? 0 : 0x02);
f234081b 1075
74900b47
ST
1076 if (is_cx2388x(state)) {
1077
1078 /* Enable or disable the DIF for tuner use */
1079 if (is_dif) {
1080 cx25840_and_or(client, 0x102, ~0x80, 0x80);
1081
1082 /* Set of defaults for NTSC and PAL */
1083 cx25840_write4(client, 0x31c, 0xc2262600);
1084 cx25840_write4(client, 0x320, 0xc2262600);
1085
1086 /* 18271 IF - Nobody else yet uses a different
1087 * tuner with the DIF, so these are reasonable
1088 * assumptions (HVR1250 and HVR1850 specific).
1089 */
1090 cx25840_write4(client, 0x318, 0xda262600);
1091 cx25840_write4(client, 0x33c, 0x2a24c800);
1092 cx25840_write4(client, 0x104, 0x0704dd00);
1093 } else {
1094 cx25840_write4(client, 0x300, 0x015c28f5);
1095
1096 cx25840_and_or(client, 0x102, ~0x80, 0);
1097 cx25840_write4(client, 0x340, 0xdf7df83);
1098 cx25840_write4(client, 0x104, 0x0704dd80);
1099 cx25840_write4(client, 0x314, 0x22400600);
1100 cx25840_write4(client, 0x318, 0x40002600);
1101 cx25840_write4(client, 0x324, 0x40002600);
1102 cx25840_write4(client, 0x32c, 0x0250e620);
1103 cx25840_write4(client, 0x39c, 0x01FF0B00);
1104
1105 cx25840_write4(client, 0x410, 0xffff0dbf);
1106 cx25840_write4(client, 0x414, 0x00137d03);
e6d0db1d 1107
cdf472d3
HV
1108 cx25840_write4(client, state->vbi_regs_offset + 0x42c, 0x42600000);
1109 cx25840_write4(client, state->vbi_regs_offset + 0x430, 0x0000039b);
1110 cx25840_write4(client, state->vbi_regs_offset + 0x438, 0x00000000);
ee61cd9f 1111
cdf472d3
HV
1112 cx25840_write4(client, state->vbi_regs_offset + 0x440, 0xF8E3E824);
1113 cx25840_write4(client, state->vbi_regs_offset + 0x444, 0x401040dc);
1114 cx25840_write4(client, state->vbi_regs_offset + 0x448, 0xcd3f02a0);
1115 cx25840_write4(client, state->vbi_regs_offset + 0x44c, 0x161f1000);
1116 cx25840_write4(client, state->vbi_regs_offset + 0x450, 0x00000802);
74900b47
ST
1117
1118 cx25840_write4(client, 0x91c, 0x01000000);
1119 cx25840_write4(client, 0x8e0, 0x03063870);
1120 cx25840_write4(client, 0x8d4, 0x7FFF0024);
1121 cx25840_write4(client, 0x8d0, 0x00063073);
1122
1123 cx25840_write4(client, 0x8c8, 0x00010000);
1124 cx25840_write4(client, 0x8cc, 0x00080023);
1125
1126 /* DIF BYPASS */
1127 cx25840_write4(client, 0x33c, 0x2a04c800);
1128 }
1129
1130 /* Reset the DIF */
1131 cx25840_write4(client, 0x398, 0);
1132 }
1133
2a03f034 1134 if (!is_cx2388x(state) && !is_cx231xx(state)) {
f234081b
ST
1135 /* Set CH_SEL_ADC2 to 1 if input comes from CH3 */
1136 cx25840_and_or(client, 0x102, ~0x2, (reg & 0x80) == 0 ? 2 : 0);
1137 /* Set DUAL_MODE_ADC2 to 1 if input comes from both CH2&CH3 */
1138 if ((reg & 0xc0) != 0xc0 && (reg & 0x30) != 0x30)
1139 cx25840_and_or(client, 0x102, ~0x4, 4);
1140 else
1141 cx25840_and_or(client, 0x102, ~0x4, 0);
1142 } else {
fb29ab96
DW
1143 /* Set DUAL_MODE_ADC2 to 1 if component*/
1144 cx25840_and_or(client, 0x102, ~0x4, is_component ? 0x4 : 0x0);
1145 if (is_composite) {
f234081b
ST
1146 /* ADC2 input select channel 2 */
1147 cx25840_and_or(client, 0x102, ~0x2, 0);
fb29ab96
DW
1148 } else if (!is_component) {
1149 /* S-Video */
1150 if (chroma >= CX25840_SVIDEO_CHROMA7) {
1151 /* ADC2 input select channel 3 */
1152 cx25840_and_or(client, 0x102, ~0x2, 2);
1153 } else {
1154 /* ADC2 input select channel 2 */
1155 cx25840_and_or(client, 0x102, ~0x2, 0);
1156 }
1157 }
74900b47
ST
1158
1159 /* cx23885 / SVIDEO */
1160 if (is_cx2388x(state) && is_svideo) {
1161#define AFE_CTRL (0x104)
1162#define MODE_CTRL (0x400)
1163 cx25840_and_or(client, 0x102, ~0x2, 0x2);
1164
1165 val = cx25840_read4(client, MODE_CTRL);
1166 val &= 0xFFFFF9FF;
1167
1168 /* YC */
1169 val |= 0x00000200;
1170 val &= ~0x2000;
1171 cx25840_write4(client, MODE_CTRL, val);
1172
1173 val = cx25840_read4(client, AFE_CTRL);
1174
1175 /* Chroma in select */
1176 val |= 0x00001000;
1177 val &= 0xfffffe7f;
1178 /* Clear VGA_SEL_CH2 and VGA_SEL_CH3 (bits 7 and 8).
1179 * This sets them to use video rather than audio.
1180 * Only one of the two will be in use.
1181 */
1182 cx25840_write4(client, AFE_CTRL, val);
1183 } else
1184 cx25840_and_or(client, 0x102, ~0x2, 0);
f234081b 1185 }
a8bbf12a
HV
1186
1187 state->vid_input = vid_input;
1188 state->aud_input = aud_input;
5af79f86
SB
1189 cx25840_audio_set_path(client);
1190 input_change(client);
f234081b 1191
2a03f034 1192 if (is_cx2388x(state)) {
f234081b
ST
1193 /* Audio channel 1 src : Parallel 1 */
1194 cx25840_write(client, 0x124, 0x03);
1195
1196 /* Select AFE clock pad output source */
1197 cx25840_write(client, 0x144, 0x05);
1198
1199 /* I2S_IN_CTL: I2S_IN_SONY_MODE, LEFT SAMPLE on WS=1 */
1200 cx25840_write(client, 0x914, 0xa0);
1201
149783b5
SD
1202 /* I2S_OUT_CTL:
1203 * I2S_IN_SONY_MODE, LEFT SAMPLE on WS=1
1204 * I2S_OUT_MASTER_MODE = Master
1205 */
1206 cx25840_write(client, 0x918, 0xa0);
1207 cx25840_write(client, 0x919, 0x01);
2a03f034 1208 } else if (is_cx231xx(state)) {
149783b5
SD
1209 /* Audio channel 1 src : Parallel 1 */
1210 cx25840_write(client, 0x124, 0x03);
1211
1212 /* I2S_IN_CTL: I2S_IN_SONY_MODE, LEFT SAMPLE on WS=1 */
1213 cx25840_write(client, 0x914, 0xa0);
1214
f234081b
ST
1215 /* I2S_OUT_CTL:
1216 * I2S_IN_SONY_MODE, LEFT SAMPLE on WS=1
1217 * I2S_OUT_MASTER_MODE = Master
1218 */
1219 cx25840_write(client, 0x918, 0xa0);
1220 cx25840_write(client, 0x919, 0x01);
2ccdd9a5
ST
1221 }
1222
52422e3c
ST
1223 if (is_cx2388x(state) && ((aud_input == CX25840_AUDIO7) ||
1224 (aud_input == CX25840_AUDIO6))) {
2ccdd9a5
ST
1225 /* Configure audio from LR1 or LR2 input */
1226 cx25840_write4(client, 0x910, 0);
1227 cx25840_write4(client, 0x8d0, 0x63073);
1228 } else
1229 if (is_cx2388x(state) && (aud_input == CX25840_AUDIO8)) {
1230 /* Configure audio from tuner/sif input */
1231 cx25840_write4(client, 0x910, 0x12b000c9);
1232 cx25840_write4(client, 0x8d0, 0x1f063870);
f234081b
ST
1233 }
1234
d90133ec 1235 if (is_cx23888(state)) {
74900b47
ST
1236 /* HVR1850 */
1237 /* AUD_IO_CTRL - I2S Input, Parallel1*/
1238 /* - Channel 1 src - Parallel1 (Merlin out) */
1239 /* - Channel 2 src - Parallel2 (Merlin out) */
1240 /* - Channel 3 src - Parallel3 (Merlin AC97 out) */
1241 /* - I2S source and dir - Merlin, output */
1242 cx25840_write4(client, 0x124, 0x100);
1243
1244 if (!is_dif) {
1245 /* Stop microcontroller if we don't need it
1246 * to avoid audio popping on svideo/composite use.
1247 */
1248 cx25840_and_or(client, 0x803, ~0x10, 0x00);
1249 }
1250 }
1251
bd985160
HV
1252 return 0;
1253}
1254
1255/* ----------------------------------------------------------------------- */
1256
081b496a 1257static int set_v4lstd(struct i2c_client *client)
bd985160 1258{
9357b31c 1259 struct cx25840_state *state = to_state(i2c_get_clientdata(client));
081b496a
HV
1260 u8 fmt = 0; /* zero is autodetect */
1261 u8 pal_m = 0;
468a0a54
MCC
1262
1263 /* First tests should be against specific std */
081b496a
HV
1264 if (state->std == V4L2_STD_NTSC_M_JP) {
1265 fmt = 0x2;
1266 } else if (state->std == V4L2_STD_NTSC_443) {
1267 fmt = 0x3;
1268 } else if (state->std == V4L2_STD_PAL_M) {
1269 pal_m = 1;
1270 fmt = 0x5;
1271 } else if (state->std == V4L2_STD_PAL_N) {
1272 fmt = 0x6;
1273 } else if (state->std == V4L2_STD_PAL_Nc) {
1274 fmt = 0x7;
1275 } else if (state->std == V4L2_STD_PAL_60) {
1276 fmt = 0x8;
468a0a54
MCC
1277 } else {
1278 /* Then, test against generic ones */
081b496a
HV
1279 if (state->std & V4L2_STD_NTSC)
1280 fmt = 0x1;
1281 else if (state->std & V4L2_STD_PAL)
1282 fmt = 0x4;
1283 else if (state->std & V4L2_STD_SECAM)
1284 fmt = 0xc;
bd985160
HV
1285 }
1286
839e4a4a
MCC
1287 v4l_dbg(1, cx25840_debug, client, "changing video std to fmt %i\n",fmt);
1288
73dcddc5
HV
1289 /* Follow step 9 of section 3.16 in the cx25840 datasheet.
1290 Without this PAL may display a vertical ghosting effect.
1291 This happens for example with the Yuan MPC622. */
1292 if (fmt >= 4 && fmt < 8) {
1293 /* Set format to NTSC-M */
1294 cx25840_and_or(client, 0x400, ~0xf, 1);
1295 /* Turn off LCOMB */
1296 cx25840_and_or(client, 0x47b, ~6, 0);
1297 }
bd985160 1298 cx25840_and_or(client, 0x400, ~0xf, fmt);
081b496a 1299 cx25840_and_or(client, 0x403, ~0x3, pal_m);
ba50e7e1
DH
1300 if (is_cx23888(state))
1301 cx23888_std_setup(client);
74900b47
ST
1302 else
1303 cx25840_std_setup(client);
2a03f034 1304 if (!is_cx2583x(state))
081b496a 1305 input_change(client);
bd985160
HV
1306 return 0;
1307}
1308
bd985160
HV
1309/* ----------------------------------------------------------------------- */
1310
e34e658b 1311static int cx25840_s_ctrl(struct v4l2_ctrl *ctrl)
bd985160 1312{
e34e658b 1313 struct v4l2_subdev *sd = to_sd(ctrl);
e6d0db1d 1314 struct cx25840_state *state = to_state(sd);
9357b31c 1315 struct i2c_client *client = v4l2_get_subdevdata(sd);
bd985160
HV
1316
1317 switch (ctrl->id) {
bd985160 1318 case V4L2_CID_BRIGHTNESS:
e34e658b 1319 cx25840_write(client, 0x414, ctrl->val - 128);
bd985160
HV
1320 break;
1321
1322 case V4L2_CID_CONTRAST:
e34e658b 1323 cx25840_write(client, 0x415, ctrl->val << 1);
bd985160
HV
1324 break;
1325
1326 case V4L2_CID_SATURATION:
e6d0db1d
DH
1327 if (is_cx23888(state)) {
1328 cx25840_write(client, 0x418, ctrl->val << 1);
1329 cx25840_write(client, 0x419, ctrl->val << 1);
1330 } else {
1331 cx25840_write(client, 0x420, ctrl->val << 1);
1332 cx25840_write(client, 0x421, ctrl->val << 1);
1333 }
bd985160
HV
1334 break;
1335
1336 case V4L2_CID_HUE:
e6d0db1d
DH
1337 if (is_cx23888(state))
1338 cx25840_write(client, 0x41a, ctrl->val);
1339 else
1340 cx25840_write(client, 0x422, ctrl->val);
bd985160
HV
1341 break;
1342
bd985160
HV
1343 default:
1344 return -EINVAL;
1345 }
1346
1347 return 0;
1348}
1349
1350/* ----------------------------------------------------------------------- */
1351
6e80c473
HV
1352static int cx25840_set_fmt(struct v4l2_subdev *sd,
1353 struct v4l2_subdev_pad_config *cfg,
1354 struct v4l2_subdev_format *format)
bd985160 1355{
6e80c473 1356 struct v4l2_mbus_framefmt *fmt = &format->format;
9357b31c
HV
1357 struct cx25840_state *state = to_state(sd);
1358 struct i2c_client *client = v4l2_get_subdevdata(sd);
bd985160 1359 int HSC, VSC, Vsrc, Hsrc, filter, Vlines;
081b496a 1360 int is_50Hz = !(state->std & V4L2_STD_525_60);
bd985160 1361
6e80c473 1362 if (format->pad || fmt->code != MEDIA_BUS_FMT_FIXED)
96fd004f 1363 return -EINVAL;
bd985160 1364
96fd004f
HV
1365 fmt->field = V4L2_FIELD_INTERLACED;
1366 fmt->colorspace = V4L2_COLORSPACE_SMPTE170M;
bd985160 1367
b5c5c17b
DH
1368 if (is_cx23888(state)) {
1369 Vsrc = (cx25840_read(client, 0x42a) & 0x3f) << 4;
1370 Vsrc |= (cx25840_read(client, 0x429) & 0xf0) >> 4;
1371 } else {
1372 Vsrc = (cx25840_read(client, 0x476) & 0x3f) << 4;
1373 Vsrc |= (cx25840_read(client, 0x475) & 0xf0) >> 4;
1374 }
bd985160 1375
b5c5c17b
DH
1376 if (is_cx23888(state)) {
1377 Hsrc = (cx25840_read(client, 0x426) & 0x3f) << 4;
1378 Hsrc |= (cx25840_read(client, 0x425) & 0xf0) >> 4;
1379 } else {
1380 Hsrc = (cx25840_read(client, 0x472) & 0x3f) << 4;
1381 Hsrc |= (cx25840_read(client, 0x471) & 0xf0) >> 4;
1382 }
bd985160 1383
96fd004f 1384 Vlines = fmt->height + (is_50Hz ? 4 : 7);
bd985160 1385
499ebed3
HV
1386 /*
1387 * We keep 1 margin for the Vsrc < Vlines check since the
1388 * cx23888 reports a Vsrc of 486 instead of 487 for the NTSC
1389 * height. Without that margin the cx23885 fails in this
1390 * check.
1391 */
96fd004f 1392 if ((fmt->width * 16 < Hsrc) || (Hsrc < fmt->width) ||
499ebed3 1393 (Vlines * 8 < Vsrc) || (Vsrc + 1 < Vlines)) {
96fd004f
HV
1394 v4l_err(client, "%dx%d is not a valid size!\n",
1395 fmt->width, fmt->height);
1396 return -ERANGE;
1397 }
6e80c473
HV
1398 if (format->which == V4L2_SUBDEV_FORMAT_TRY)
1399 return 0;
bd985160 1400
96fd004f
HV
1401 HSC = (Hsrc * (1 << 20)) / fmt->width - (1 << 20);
1402 VSC = (1 << 16) - (Vsrc * (1 << 9) / Vlines - (1 << 9));
1403 VSC &= 0x1fff;
1404
1405 if (fmt->width >= 385)
1406 filter = 0;
1407 else if (fmt->width > 192)
1408 filter = 1;
1409 else if (fmt->width > 96)
1410 filter = 2;
1411 else
1412 filter = 3;
1413
1414 v4l_dbg(1, cx25840_debug, client, "decoder set size %dx%d -> scale %ux%u\n",
1415 fmt->width, fmt->height, HSC, VSC);
1416
1417 /* HSCALE=HSC */
ee61cd9f
HV
1418 if (is_cx23888(state)) {
1419 cx25840_write4(client, 0x434, HSC | (1 << 24));
1420 /* VSCALE=VSC VS_INTRLACE=1 VFILT=filter */
1421 cx25840_write4(client, 0x438, VSC | (1 << 19) | (filter << 16));
1422 } else {
1423 cx25840_write(client, 0x418, HSC & 0xff);
1424 cx25840_write(client, 0x419, (HSC >> 8) & 0xff);
1425 cx25840_write(client, 0x41a, HSC >> 16);
1426 /* VSCALE=VSC */
1427 cx25840_write(client, 0x41c, VSC & 0xff);
1428 cx25840_write(client, 0x41d, VSC >> 8);
1429 /* VS_INTRLACE=1 VFILT=filter */
1430 cx25840_write(client, 0x41e, 0x8 | filter);
1431 }
96fd004f
HV
1432 return 0;
1433}
1434
bd985160
HV
1435/* ----------------------------------------------------------------------- */
1436
1a39275a
HV
1437static void log_video_status(struct i2c_client *client)
1438{
1439 static const char *const fmt_strs[] = {
1440 "0x0",
1441 "NTSC-M", "NTSC-J", "NTSC-4.43",
1442 "PAL-BDGHI", "PAL-M", "PAL-N", "PAL-Nc", "PAL-60",
1443 "0x9", "0xA", "0xB",
1444 "SECAM",
1445 "0xD", "0xE", "0xF"
1446 };
1447
9357b31c 1448 struct cx25840_state *state = to_state(i2c_get_clientdata(client));
1a39275a
HV
1449 u8 vidfmt_sel = cx25840_read(client, 0x400) & 0xf;
1450 u8 gen_stat1 = cx25840_read(client, 0x40d);
1451 u8 gen_stat2 = cx25840_read(client, 0x40e);
1452 int vid_input = state->vid_input;
1453
1454 v4l_info(client, "Video signal: %spresent\n",
1455 (gen_stat2 & 0x20) ? "" : "not ");
1456 v4l_info(client, "Detected format: %s\n",
1457 fmt_strs[gen_stat1 & 0xf]);
1458
1459 v4l_info(client, "Specified standard: %s\n",
1460 vidfmt_sel ? fmt_strs[vidfmt_sel] : "automatic detection");
1461
1462 if (vid_input >= CX25840_COMPOSITE1 &&
1463 vid_input <= CX25840_COMPOSITE8) {
1464 v4l_info(client, "Specified video input: Composite %d\n",
1465 vid_input - CX25840_COMPOSITE1 + 1);
1466 } else {
1467 v4l_info(client, "Specified video input: S-Video (Luma In%d, Chroma In%d)\n",
1468 (vid_input & 0xf0) >> 4, (vid_input & 0xf00) >> 8);
1469 }
1470
1471 v4l_info(client, "Specified audioclock freq: %d Hz\n", state->audclk_freq);
1472}
1473
1474/* ----------------------------------------------------------------------- */
1475
1476static void log_audio_status(struct i2c_client *client)
1477{
9357b31c 1478 struct cx25840_state *state = to_state(i2c_get_clientdata(client));
1a39275a
HV
1479 u8 download_ctl = cx25840_read(client, 0x803);
1480 u8 mod_det_stat0 = cx25840_read(client, 0x804);
1481 u8 mod_det_stat1 = cx25840_read(client, 0x805);
1482 u8 audio_config = cx25840_read(client, 0x808);
1483 u8 pref_mode = cx25840_read(client, 0x809);
1484 u8 afc0 = cx25840_read(client, 0x80b);
1485 u8 mute_ctl = cx25840_read(client, 0x8d3);
1486 int aud_input = state->aud_input;
1487 char *p;
1488
1489 switch (mod_det_stat0) {
1490 case 0x00: p = "mono"; break;
1491 case 0x01: p = "stereo"; break;
1492 case 0x02: p = "dual"; break;
1493 case 0x04: p = "tri"; break;
1494 case 0x10: p = "mono with SAP"; break;
1495 case 0x11: p = "stereo with SAP"; break;
1496 case 0x12: p = "dual with SAP"; break;
1497 case 0x14: p = "tri with SAP"; break;
1498 case 0xfe: p = "forced mode"; break;
1499 default: p = "not defined";
1500 }
1501 v4l_info(client, "Detected audio mode: %s\n", p);
1502
1503 switch (mod_det_stat1) {
1504 case 0x00: p = "not defined"; break;
1505 case 0x01: p = "EIAJ"; break;
1506 case 0x02: p = "A2-M"; break;
1507 case 0x03: p = "A2-BG"; break;
1508 case 0x04: p = "A2-DK1"; break;
1509 case 0x05: p = "A2-DK2"; break;
1510 case 0x06: p = "A2-DK3"; break;
1511 case 0x07: p = "A1 (6.0 MHz FM Mono)"; break;
1512 case 0x08: p = "AM-L"; break;
1513 case 0x09: p = "NICAM-BG"; break;
1514 case 0x0a: p = "NICAM-DK"; break;
1515 case 0x0b: p = "NICAM-I"; break;
1516 case 0x0c: p = "NICAM-L"; break;
1517 case 0x0d: p = "BTSC/EIAJ/A2-M Mono (4.5 MHz FMMono)"; break;
1518 case 0x0e: p = "IF FM Radio"; break;
1519 case 0x0f: p = "BTSC"; break;
1520 case 0x10: p = "high-deviation FM"; break;
1521 case 0x11: p = "very high-deviation FM"; break;
1522 case 0xfd: p = "unknown audio standard"; break;
1523 case 0xfe: p = "forced audio standard"; break;
1524 case 0xff: p = "no detected audio standard"; break;
1525 default: p = "not defined";
1526 }
1527 v4l_info(client, "Detected audio standard: %s\n", p);
1a39275a
HV
1528 v4l_info(client, "Audio microcontroller: %s\n",
1529 (download_ctl & 0x10) ?
1530 ((mute_ctl & 0x2) ? "detecting" : "running") : "stopped");
1531
1532 switch (audio_config >> 4) {
1533 case 0x00: p = "undefined"; break;
1534 case 0x01: p = "BTSC"; break;
1535 case 0x02: p = "EIAJ"; break;
1536 case 0x03: p = "A2-M"; break;
1537 case 0x04: p = "A2-BG"; break;
1538 case 0x05: p = "A2-DK1"; break;
1539 case 0x06: p = "A2-DK2"; break;
1540 case 0x07: p = "A2-DK3"; break;
1541 case 0x08: p = "A1 (6.0 MHz FM Mono)"; break;
1542 case 0x09: p = "AM-L"; break;
1543 case 0x0a: p = "NICAM-BG"; break;
1544 case 0x0b: p = "NICAM-DK"; break;
1545 case 0x0c: p = "NICAM-I"; break;
1546 case 0x0d: p = "NICAM-L"; break;
1547 case 0x0e: p = "FM radio"; break;
1548 case 0x0f: p = "automatic detection"; break;
1549 default: p = "undefined";
1550 }
1551 v4l_info(client, "Configured audio standard: %s\n", p);
1552
1553 if ((audio_config >> 4) < 0xF) {
1554 switch (audio_config & 0xF) {
1555 case 0x00: p = "MONO1 (LANGUAGE A/Mono L+R channel for BTSC, EIAJ, A2)"; break;
1556 case 0x01: p = "MONO2 (LANGUAGE B)"; break;
1557 case 0x02: p = "MONO3 (STEREO forced MONO)"; break;
1558 case 0x03: p = "MONO4 (NICAM ANALOG-Language C/Analog Fallback)"; break;
1559 case 0x04: p = "STEREO"; break;
1560 case 0x05: p = "DUAL1 (AB)"; break;
1561 case 0x06: p = "DUAL2 (AC) (FM)"; break;
1562 case 0x07: p = "DUAL3 (BC) (FM)"; break;
1563 case 0x08: p = "DUAL4 (AC) (AM)"; break;
1564 case 0x09: p = "DUAL5 (BC) (AM)"; break;
1565 case 0x0a: p = "SAP"; break;
1566 default: p = "undefined";
1567 }
1568 v4l_info(client, "Configured audio mode: %s\n", p);
1569 } else {
1570 switch (audio_config & 0xF) {
1571 case 0x00: p = "BG"; break;
1572 case 0x01: p = "DK1"; break;
1573 case 0x02: p = "DK2"; break;
1574 case 0x03: p = "DK3"; break;
1575 case 0x04: p = "I"; break;
1576 case 0x05: p = "L"; break;
1577 case 0x06: p = "BTSC"; break;
1578 case 0x07: p = "EIAJ"; break;
1579 case 0x08: p = "A2-M"; break;
1580 case 0x09: p = "FM Radio"; break;
1581 case 0x0f: p = "automatic standard and mode detection"; break;
1582 default: p = "undefined";
1583 }
1584 v4l_info(client, "Configured audio system: %s\n", p);
1585 }
1586
1587 if (aud_input) {
1588 v4l_info(client, "Specified audio input: Tuner (In%d)\n", aud_input);
1589 } else {
1590 v4l_info(client, "Specified audio input: External\n");
1591 }
1592
1593 switch (pref_mode & 0xf) {
1594 case 0: p = "mono/language A"; break;
1595 case 1: p = "language B"; break;
1596 case 2: p = "language C"; break;
1597 case 3: p = "analog fallback"; break;
1598 case 4: p = "stereo"; break;
1599 case 5: p = "language AC"; break;
1600 case 6: p = "language BC"; break;
1601 case 7: p = "language AB"; break;
1602 default: p = "undefined";
1603 }
1604 v4l_info(client, "Preferred audio mode: %s\n", p);
1605
1606 if ((audio_config & 0xf) == 0xf) {
1607 switch ((afc0 >> 3) & 0x3) {
1608 case 0: p = "system DK"; break;
1609 case 1: p = "system L"; break;
1610 case 2: p = "autodetect"; break;
1611 default: p = "undefined";
1612 }
1613 v4l_info(client, "Selected 65 MHz format: %s\n", p);
1614
1615 switch (afc0 & 0x7) {
1616 case 0: p = "chroma"; break;
1617 case 1: p = "BTSC"; break;
1618 case 2: p = "EIAJ"; break;
1619 case 3: p = "A2-M"; break;
1620 case 4: p = "autodetect"; break;
1621 default: p = "undefined";
1622 }
1623 v4l_info(client, "Selected 45 MHz format: %s\n", p);
1624 }
1625}
1626
1627/* ----------------------------------------------------------------------- */
1628
cc26b076 1629/* This load_fw operation must be called to load the driver's firmware.
6ca187ab
HV
1630 Without this the audio standard detection will fail and you will
1631 only get mono.
1632
1633 Since loading the firmware is often problematic when the driver is
1634 compiled into the kernel I recommend postponing calling this function
1635 until the first open of the video device. Another reason for
1636 postponing it is that loading this firmware takes a long time (seconds)
1637 due to the slow i2c bus speed. So it will speed up the boot process if
1638 you can avoid loading the fw as long as the video device isn't used. */
cc26b076 1639static int cx25840_load_fw(struct v4l2_subdev *sd)
bd985160 1640{
9357b31c
HV
1641 struct cx25840_state *state = to_state(sd);
1642 struct i2c_client *client = v4l2_get_subdevdata(sd);
c976bc82
HV
1643
1644 if (!state->is_initialized) {
cc26b076 1645 /* initialize and load firmware */
c976bc82 1646 state->is_initialized = 1;
2a03f034 1647 if (is_cx2583x(state))
c976bc82 1648 cx25836_initialize(client);
2a03f034 1649 else if (is_cx2388x(state))
f234081b 1650 cx23885_initialize(client);
2a03f034 1651 else if (is_cx231xx(state))
149783b5 1652 cx231xx_initialize(client);
c976bc82 1653 else
89fc4eb9 1654 cx25840_initialize(client);
c976bc82 1655 }
9357b31c
HV
1656 return 0;
1657}
c976bc82 1658
bd985160 1659#ifdef CONFIG_VIDEO_ADV_DEBUG
aecde8b5 1660static int cx25840_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
9357b31c
HV
1661{
1662 struct i2c_client *client = v4l2_get_subdevdata(sd);
f234081b 1663
aecde8b5 1664 reg->size = 1;
9357b31c
HV
1665 reg->val = cx25840_read(client, reg->reg & 0x0fff);
1666 return 0;
1667}
1668
977ba3b1 1669static int cx25840_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg)
9357b31c
HV
1670{
1671 struct i2c_client *client = v4l2_get_subdevdata(sd);
1672
9357b31c
HV
1673 cx25840_write(client, reg->reg & 0x0fff, reg->val & 0xff);
1674 return 0;
1675}
bd985160
HV
1676#endif
1677
3ccc646b
AW
1678static int cx25840_s_audio_stream(struct v4l2_subdev *sd, int enable)
1679{
1680 struct cx25840_state *state = to_state(sd);
1681 struct i2c_client *client = v4l2_get_subdevdata(sd);
1682 u8 v;
1683
1684 if (is_cx2583x(state) || is_cx2388x(state) || is_cx231xx(state))
1685 return 0;
1686
1687 v4l_dbg(1, cx25840_debug, client, "%s audio output\n",
1688 enable ? "enable" : "disable");
1689
1690 if (enable) {
1691 v = cx25840_read(client, 0x115) | 0x80;
1692 cx25840_write(client, 0x115, v);
1693 v = cx25840_read(client, 0x116) | 0x03;
1694 cx25840_write(client, 0x116, v);
1695 } else {
1696 v = cx25840_read(client, 0x115) & ~(0x80);
1697 cx25840_write(client, 0x115, v);
1698 v = cx25840_read(client, 0x116) & ~(0x03);
1699 cx25840_write(client, 0x116, v);
1700 }
1701 return 0;
1702}
1703
9357b31c
HV
1704static int cx25840_s_stream(struct v4l2_subdev *sd, int enable)
1705{
1706 struct cx25840_state *state = to_state(sd);
1707 struct i2c_client *client = v4l2_get_subdevdata(sd);
3ccc646b 1708 u8 v;
bd985160 1709
3ccc646b 1710 v4l_dbg(1, cx25840_debug, client, "%s video output\n",
9357b31c 1711 enable ? "enable" : "disable");
e69d8942
HV
1712
1713 /*
1714 * It's not clear what should be done for these devices.
1715 * The original code used the same addresses as for the cx25840, but
1716 * those addresses do something else entirely on the cx2388x and
1717 * cx231xx. Since it never did anything in the first place, just do
1718 * nothing.
1719 */
1720 if (is_cx2388x(state) || is_cx231xx(state))
1721 return 0;
1722
9357b31c 1723 if (enable) {
e69d8942
HV
1724 v = cx25840_read(client, 0x115) | 0x0c;
1725 cx25840_write(client, 0x115, v);
1726 v = cx25840_read(client, 0x116) | 0x04;
1727 cx25840_write(client, 0x116, v);
9357b31c 1728 } else {
e69d8942
HV
1729 v = cx25840_read(client, 0x115) & ~(0x0c);
1730 cx25840_write(client, 0x115, v);
1731 v = cx25840_read(client, 0x116) & ~(0x04);
1732 cx25840_write(client, 0x116, v);
9357b31c
HV
1733 }
1734 return 0;
1735}
bd985160 1736
51ada787
ST
1737/* Query the current detected video format */
1738static int cx25840_g_std(struct v4l2_subdev *sd, v4l2_std_id *std)
1739{
1740 struct i2c_client *client = v4l2_get_subdevdata(sd);
1741
1742 v4l2_std_id stds[] = {
1743 /* 0000 */ V4L2_STD_UNKNOWN,
1744
1745 /* 0001 */ V4L2_STD_NTSC_M,
1746 /* 0010 */ V4L2_STD_NTSC_M_JP,
1747 /* 0011 */ V4L2_STD_NTSC_443,
1748 /* 0100 */ V4L2_STD_PAL,
1749 /* 0101 */ V4L2_STD_PAL_M,
1750 /* 0110 */ V4L2_STD_PAL_N,
1751 /* 0111 */ V4L2_STD_PAL_Nc,
1752 /* 1000 */ V4L2_STD_PAL_60,
1753
1754 /* 1001 */ V4L2_STD_UNKNOWN,
1755 /* 1010 */ V4L2_STD_UNKNOWN,
1756 /* 1001 */ V4L2_STD_UNKNOWN,
1757 /* 1010 */ V4L2_STD_UNKNOWN,
1758 /* 1011 */ V4L2_STD_UNKNOWN,
1759 /* 1110 */ V4L2_STD_UNKNOWN,
1760 /* 1111 */ V4L2_STD_UNKNOWN
1761 };
1762
1763 u32 fmt = (cx25840_read4(client, 0x40c) >> 8) & 0xf;
1764 *std = stds[ fmt ];
1765
1766 v4l_dbg(1, cx25840_debug, client, "g_std fmt = %x, v4l2_std_id = 0x%x\n",
1767 fmt, (unsigned int)stds[ fmt ]);
1768
1769 return 0;
1770}
1771
a21df45d
ST
1772static int cx25840_g_input_status(struct v4l2_subdev *sd, u32 *status)
1773{
1774 struct i2c_client *client = v4l2_get_subdevdata(sd);
1775
1776 /* A limited function that checks for signal status and returns
1777 * the state.
1778 */
1779
1780 /* Check for status of Horizontal lock (SRC lock isn't reliable) */
1781 if ((cx25840_read4(client, 0x40c) & 0x00010000) == 0)
1782 *status |= V4L2_IN_ST_NO_SIGNAL;
1783
1784 return 0;
1785}
1786
9357b31c
HV
1787static int cx25840_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
1788{
1789 struct cx25840_state *state = to_state(sd);
1790 struct i2c_client *client = v4l2_get_subdevdata(sd);
d92c20e0 1791
9357b31c
HV
1792 if (state->radio == 0 && state->std == std)
1793 return 0;
1794 state->radio = 0;
1795 state->std = std;
1796 return set_v4lstd(client);
1797}
e2b8cf4c 1798
9357b31c
HV
1799static int cx25840_s_radio(struct v4l2_subdev *sd)
1800{
1801 struct cx25840_state *state = to_state(sd);
d92c20e0 1802
9357b31c
HV
1803 state->radio = 1;
1804 return 0;
1805}
bd985160 1806
5325b427
HV
1807static int cx25840_s_video_routing(struct v4l2_subdev *sd,
1808 u32 input, u32 output, u32 config)
9357b31c
HV
1809{
1810 struct cx25840_state *state = to_state(sd);
1811 struct i2c_client *client = v4l2_get_subdevdata(sd);
3faeeae4 1812
ba50e7e1
DH
1813 if (is_cx23888(state))
1814 cx23888_std_setup(client);
74900b47 1815
5325b427 1816 return set_input(client, input, state->aud_input);
9357b31c 1817}
bd985160 1818
5325b427
HV
1819static int cx25840_s_audio_routing(struct v4l2_subdev *sd,
1820 u32 input, u32 output, u32 config)
9357b31c
HV
1821{
1822 struct cx25840_state *state = to_state(sd);
1823 struct i2c_client *client = v4l2_get_subdevdata(sd);
bd985160 1824
ba50e7e1
DH
1825 if (is_cx23888(state))
1826 cx23888_std_setup(client);
5325b427 1827 return set_input(client, state->vid_input, input);
9357b31c 1828}
bd985160 1829
b530a447 1830static int cx25840_s_frequency(struct v4l2_subdev *sd, const struct v4l2_frequency *freq)
9357b31c 1831{
9357b31c 1832 struct i2c_client *client = v4l2_get_subdevdata(sd);
a8bbf12a 1833
5af79f86 1834 input_change(client);
9357b31c
HV
1835 return 0;
1836}
a8bbf12a 1837
9357b31c
HV
1838static int cx25840_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
1839{
1840 struct cx25840_state *state = to_state(sd);
1841 struct i2c_client *client = v4l2_get_subdevdata(sd);
1842 u8 vpres = cx25840_read(client, 0x40e) & 0x20;
1843 u8 mode;
1844 int val = 0;
bd985160 1845
9357b31c
HV
1846 if (state->radio)
1847 return 0;
bd985160 1848
9357b31c 1849 vt->signal = vpres ? 0xffff : 0x0;
2a03f034 1850 if (is_cx2583x(state))
9357b31c 1851 return 0;
3faeeae4 1852
9357b31c
HV
1853 vt->capability |=
1854 V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_LANG1 |
1855 V4L2_TUNER_CAP_LANG2 | V4L2_TUNER_CAP_SAP;
e2b8cf4c 1856
9357b31c 1857 mode = cx25840_read(client, 0x804);
bd985160 1858
9357b31c
HV
1859 /* get rxsubchans and audmode */
1860 if ((mode & 0xf) == 1)
1861 val |= V4L2_TUNER_SUB_STEREO;
1862 else
1863 val |= V4L2_TUNER_SUB_MONO;
bd985160 1864
9357b31c
HV
1865 if (mode == 2 || mode == 4)
1866 val = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
bd985160 1867
9357b31c
HV
1868 if (mode & 0x10)
1869 val |= V4L2_TUNER_SUB_SAP;
bd985160 1870
9357b31c
HV
1871 vt->rxsubchans = val;
1872 vt->audmode = state->audmode;
1873 return 0;
1874}
bd985160 1875
2f73c7c5 1876static int cx25840_s_tuner(struct v4l2_subdev *sd, const struct v4l2_tuner *vt)
9357b31c
HV
1877{
1878 struct cx25840_state *state = to_state(sd);
1879 struct i2c_client *client = v4l2_get_subdevdata(sd);
bd985160 1880
2a03f034 1881 if (state->radio || is_cx2583x(state))
9357b31c 1882 return 0;
8a4b275f 1883
9357b31c 1884 switch (vt->audmode) {
bd985160 1885 case V4L2_TUNER_MODE_MONO:
8a4b275f
HV
1886 /* mono -> mono
1887 stereo -> mono
1888 bilingual -> lang1 */
bd985160
HV
1889 cx25840_and_or(client, 0x809, ~0xf, 0x00);
1890 break;
301e22d6 1891 case V4L2_TUNER_MODE_STEREO:
8a4b275f
HV
1892 case V4L2_TUNER_MODE_LANG1:
1893 /* mono -> mono
1894 stereo -> stereo
1895 bilingual -> lang1 */
bd985160
HV
1896 cx25840_and_or(client, 0x809, ~0xf, 0x04);
1897 break;
301e22d6 1898 case V4L2_TUNER_MODE_LANG1_LANG2:
8a4b275f
HV
1899 /* mono -> mono
1900 stereo -> stereo
1901 bilingual -> lang1/lang2 */
1902 cx25840_and_or(client, 0x809, ~0xf, 0x07);
1903 break;
bd985160 1904 case V4L2_TUNER_MODE_LANG2:
8a4b275f 1905 /* mono -> mono
301e22d6 1906 stereo -> stereo
8a4b275f 1907 bilingual -> lang2 */
bd985160
HV
1908 cx25840_and_or(client, 0x809, ~0xf, 0x01);
1909 break;
8a4b275f
HV
1910 default:
1911 return -EINVAL;
9357b31c
HV
1912 }
1913 state->audmode = vt->audmode;
1914 return 0;
1915}
bd985160 1916
9357b31c
HV
1917static int cx25840_reset(struct v4l2_subdev *sd, u32 val)
1918{
1919 struct cx25840_state *state = to_state(sd);
1920 struct i2c_client *client = v4l2_get_subdevdata(sd);
bd985160 1921
2a03f034 1922 if (is_cx2583x(state))
9357b31c 1923 cx25836_initialize(client);
2a03f034 1924 else if (is_cx2388x(state))
9357b31c 1925 cx23885_initialize(client);
2a03f034 1926 else if (is_cx231xx(state))
149783b5 1927 cx231xx_initialize(client);
9357b31c
HV
1928 else
1929 cx25840_initialize(client);
1930 return 0;
1931}
bd985160 1932
9357b31c
HV
1933static int cx25840_log_status(struct v4l2_subdev *sd)
1934{
1935 struct cx25840_state *state = to_state(sd);
1936 struct i2c_client *client = v4l2_get_subdevdata(sd);
bd985160 1937
9357b31c 1938 log_video_status(client);
2a03f034 1939 if (!is_cx2583x(state))
9357b31c 1940 log_audio_status(client);
52fd3dda 1941 cx25840_ir_log_status(sd);
e34e658b 1942 v4l2_ctrl_handler_log_status(&state->hdl, sd->name);
3faeeae4 1943 return 0;
bd985160
HV
1944}
1945
52fd3dda
AW
1946static int cx23885_irq_handler(struct v4l2_subdev *sd, u32 status,
1947 bool *handled)
1948{
1949 struct cx25840_state *state = to_state(sd);
1950 struct i2c_client *c = v4l2_get_subdevdata(sd);
1951 u8 irq_stat, aud_stat, aud_en, ir_stat, ir_en;
1952 u32 vid_stat, aud_mc_stat;
1953 bool block_handled;
1954 int ret = 0;
1955
1956 irq_stat = cx25840_read(c, CX23885_PIN_CTRL_IRQ_REG);
1957 v4l_dbg(2, cx25840_debug, c, "AV Core IRQ status (entry): %s %s %s\n",
1958 irq_stat & CX23885_PIN_CTRL_IRQ_IR_STAT ? "ir" : " ",
1959 irq_stat & CX23885_PIN_CTRL_IRQ_AUD_STAT ? "aud" : " ",
1960 irq_stat & CX23885_PIN_CTRL_IRQ_VID_STAT ? "vid" : " ");
1961
1962 if ((is_cx23885(state) || is_cx23887(state))) {
1963 ir_stat = cx25840_read(c, CX25840_IR_STATS_REG);
1964 ir_en = cx25840_read(c, CX25840_IR_IRQEN_REG);
1965 v4l_dbg(2, cx25840_debug, c,
1966 "AV Core ir IRQ status: %#04x disables: %#04x\n",
1967 ir_stat, ir_en);
1968 if (irq_stat & CX23885_PIN_CTRL_IRQ_IR_STAT) {
1969 block_handled = false;
1970 ret = cx25840_ir_irq_handler(sd,
1971 status, &block_handled);
1972 if (block_handled)
1973 *handled = true;
1974 }
1975 }
1976
1977 aud_stat = cx25840_read(c, CX25840_AUD_INT_STAT_REG);
1978 aud_en = cx25840_read(c, CX25840_AUD_INT_CTRL_REG);
1979 v4l_dbg(2, cx25840_debug, c,
1980 "AV Core audio IRQ status: %#04x disables: %#04x\n",
1981 aud_stat, aud_en);
1982 aud_mc_stat = cx25840_read4(c, CX23885_AUD_MC_INT_MASK_REG);
1983 v4l_dbg(2, cx25840_debug, c,
1984 "AV Core audio MC IRQ status: %#06x enables: %#06x\n",
1985 aud_mc_stat >> CX23885_AUD_MC_INT_STAT_SHFT,
1986 aud_mc_stat & CX23885_AUD_MC_INT_CTRL_BITS);
1987 if (irq_stat & CX23885_PIN_CTRL_IRQ_AUD_STAT) {
1988 if (aud_stat) {
1989 cx25840_write(c, CX25840_AUD_INT_STAT_REG, aud_stat);
1990 *handled = true;
1991 }
1992 }
1993
1994 vid_stat = cx25840_read4(c, CX25840_VID_INT_STAT_REG);
1995 v4l_dbg(2, cx25840_debug, c,
1996 "AV Core video IRQ status: %#06x disables: %#06x\n",
1997 vid_stat & CX25840_VID_INT_STAT_BITS,
1998 vid_stat >> CX25840_VID_INT_MASK_SHFT);
1999 if (irq_stat & CX23885_PIN_CTRL_IRQ_VID_STAT) {
2000 if (vid_stat & CX25840_VID_INT_STAT_BITS) {
2001 cx25840_write4(c, CX25840_VID_INT_STAT_REG, vid_stat);
2002 *handled = true;
2003 }
2004 }
2005
2006 irq_stat = cx25840_read(c, CX23885_PIN_CTRL_IRQ_REG);
2007 v4l_dbg(2, cx25840_debug, c, "AV Core IRQ status (exit): %s %s %s\n",
2008 irq_stat & CX23885_PIN_CTRL_IRQ_IR_STAT ? "ir" : " ",
2009 irq_stat & CX23885_PIN_CTRL_IRQ_AUD_STAT ? "aud" : " ",
2010 irq_stat & CX23885_PIN_CTRL_IRQ_VID_STAT ? "vid" : " ");
2011
2012 return ret;
2013}
2014
2015static int cx25840_irq_handler(struct v4l2_subdev *sd, u32 status,
2016 bool *handled)
2017{
2018 struct cx25840_state *state = to_state(sd);
2019
2020 *handled = false;
2021
2022 /* Only support the CX2388[578] AV Core for now */
2023 if (is_cx2388x(state))
2024 return cx23885_irq_handler(sd, status, handled);
2025
2026 return -ENODEV;
2027}
2028
9357b31c
HV
2029/* ----------------------------------------------------------------------- */
2030
74900b47
ST
2031#define DIF_PLL_FREQ_WORD (0x300)
2032#define DIF_BPF_COEFF01 (0x348)
2033#define DIF_BPF_COEFF23 (0x34c)
2034#define DIF_BPF_COEFF45 (0x350)
2035#define DIF_BPF_COEFF67 (0x354)
2036#define DIF_BPF_COEFF89 (0x358)
2037#define DIF_BPF_COEFF1011 (0x35c)
2038#define DIF_BPF_COEFF1213 (0x360)
2039#define DIF_BPF_COEFF1415 (0x364)
2040#define DIF_BPF_COEFF1617 (0x368)
2041#define DIF_BPF_COEFF1819 (0x36c)
2042#define DIF_BPF_COEFF2021 (0x370)
2043#define DIF_BPF_COEFF2223 (0x374)
2044#define DIF_BPF_COEFF2425 (0x378)
2045#define DIF_BPF_COEFF2627 (0x37c)
2046#define DIF_BPF_COEFF2829 (0x380)
2047#define DIF_BPF_COEFF3031 (0x384)
2048#define DIF_BPF_COEFF3233 (0x388)
2049#define DIF_BPF_COEFF3435 (0x38c)
2050#define DIF_BPF_COEFF36 (0x390)
2051
efe1724a 2052static void cx23885_dif_setup(struct i2c_client *client, u32 ifHz)
74900b47
ST
2053{
2054 u64 pll_freq;
2055 u32 pll_freq_word;
2056
2057 v4l_dbg(1, cx25840_debug, client, "%s(%d)\n", __func__, ifHz);
2058
2059 /* Assuming TV */
2060 /* Calculate the PLL frequency word based on the adjusted ifHz */
3308e2b5 2061 pll_freq = div_u64((u64)ifHz * 268435456, 50000000);
74900b47
ST
2062 pll_freq_word = (u32)pll_freq;
2063
2064 cx25840_write4(client, DIF_PLL_FREQ_WORD, pll_freq_word);
2065
2066 /* Round down to the nearest 100KHz */
2067 ifHz = (ifHz / 100000) * 100000;
2068
2069 if (ifHz < 3000000)
2070 ifHz = 3000000;
2071
2072 if (ifHz > 16000000)
2073 ifHz = 16000000;
2074
2075 v4l_dbg(1, cx25840_debug, client, "%s(%d) again\n", __func__, ifHz);
2076
2077 switch (ifHz) {
2078 case 3000000:
2079 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000002);
2080 cx25840_write4(client, DIF_BPF_COEFF23, 0x00080012);
2081 cx25840_write4(client, DIF_BPF_COEFF45, 0x001e0024);
2082 cx25840_write4(client, DIF_BPF_COEFF67, 0x001bfff8);
2083 cx25840_write4(client, DIF_BPF_COEFF89, 0xffb4ff50);
2084 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfed8fe68);
2085 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe24fe34);
2086 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfebaffc7);
2087 cx25840_write4(client, DIF_BPF_COEFF1617, 0x014d031f);
2088 cx25840_write4(client, DIF_BPF_COEFF1819, 0x04f0065d);
2089 cx25840_write4(client, DIF_BPF_COEFF2021, 0x07010688);
2090 cx25840_write4(client, DIF_BPF_COEFF2223, 0x04c901d6);
2091 cx25840_write4(client, DIF_BPF_COEFF2425, 0xfe00f9d3);
2092 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf600f342);
2093 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf235f337);
2094 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf64efb22);
2095 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0105070f);
2096 cx25840_write4(client, DIF_BPF_COEFF3435, 0x0c460fce);
2097 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2098 break;
2099
2100 case 3100000:
2101 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000001);
2102 cx25840_write4(client, DIF_BPF_COEFF23, 0x00070012);
2103 cx25840_write4(client, DIF_BPF_COEFF45, 0x00220032);
2104 cx25840_write4(client, DIF_BPF_COEFF67, 0x00370026);
2105 cx25840_write4(client, DIF_BPF_COEFF89, 0xfff0ff91);
2106 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff0efe7c);
2107 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe01fdcc);
2108 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfe0afedb);
2109 cx25840_write4(client, DIF_BPF_COEFF1617, 0x00440224);
2110 cx25840_write4(client, DIF_BPF_COEFF1819, 0x0434060c);
2111 cx25840_write4(client, DIF_BPF_COEFF2021, 0x0738074e);
2112 cx25840_write4(client, DIF_BPF_COEFF2223, 0x06090361);
2113 cx25840_write4(client, DIF_BPF_COEFF2425, 0xff99fb39);
2114 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf6fef3b6);
2115 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf21af2a5);
2116 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf573fa33);
2117 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0034067d);
2118 cx25840_write4(client, DIF_BPF_COEFF3435, 0x0bfb0fb9);
2119 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2120 break;
2121
2122 case 3200000:
2123 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000000);
2124 cx25840_write4(client, DIF_BPF_COEFF23, 0x0004000e);
2125 cx25840_write4(client, DIF_BPF_COEFF45, 0x00200038);
2126 cx25840_write4(client, DIF_BPF_COEFF67, 0x004c004f);
2127 cx25840_write4(client, DIF_BPF_COEFF89, 0x002fffdf);
2128 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff5cfeb6);
2129 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe0dfd92);
2130 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd7ffe03);
2131 cx25840_write4(client, DIF_BPF_COEFF1617, 0xff36010a);
2132 cx25840_write4(client, DIF_BPF_COEFF1819, 0x03410575);
2133 cx25840_write4(client, DIF_BPF_COEFF2021, 0x072607d2);
2134 cx25840_write4(client, DIF_BPF_COEFF2223, 0x071804d5);
2135 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0134fcb7);
2136 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf81ff451);
2137 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf223f22e);
2138 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf4a7f94b);
2139 cx25840_write4(client, DIF_BPF_COEFF3233, 0xff6405e8);
2140 cx25840_write4(client, DIF_BPF_COEFF3435, 0x0bae0fa4);
2141 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2142 break;
2143
2144 case 3300000:
2145 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000ffff);
2146 cx25840_write4(client, DIF_BPF_COEFF23, 0x00000008);
2147 cx25840_write4(client, DIF_BPF_COEFF45, 0x001a0036);
2148 cx25840_write4(client, DIF_BPF_COEFF67, 0x0056006d);
2149 cx25840_write4(client, DIF_BPF_COEFF89, 0x00670030);
2150 cx25840_write4(client, DIF_BPF_COEFF1011, 0xffbdff10);
2151 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe46fd8d);
2152 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd25fd4f);
2153 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfe35ffe0);
2154 cx25840_write4(client, DIF_BPF_COEFF1819, 0x0224049f);
2155 cx25840_write4(client, DIF_BPF_COEFF2021, 0x06c9080e);
2156 cx25840_write4(client, DIF_BPF_COEFF2223, 0x07ef0627);
2157 cx25840_write4(client, DIF_BPF_COEFF2425, 0x02c9fe45);
2158 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf961f513);
2159 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf250f1d2);
2160 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf3ecf869);
2161 cx25840_write4(client, DIF_BPF_COEFF3233, 0xfe930552);
2162 cx25840_write4(client, DIF_BPF_COEFF3435, 0x0b5f0f8f);
2163 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2164 break;
2165
2166 case 3400000:
2167 cx25840_write4(client, DIF_BPF_COEFF01, 0xfffffffe);
2168 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffd0001);
2169 cx25840_write4(client, DIF_BPF_COEFF45, 0x000f002c);
2170 cx25840_write4(client, DIF_BPF_COEFF67, 0x0054007d);
2171 cx25840_write4(client, DIF_BPF_COEFF89, 0x0093007c);
2172 cx25840_write4(client, DIF_BPF_COEFF1011, 0x0024ff82);
2173 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfea6fdbb);
2174 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd03fcca);
2175 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfd51feb9);
2176 cx25840_write4(client, DIF_BPF_COEFF1819, 0x00eb0392);
2177 cx25840_write4(client, DIF_BPF_COEFF2021, 0x06270802);
2178 cx25840_write4(client, DIF_BPF_COEFF2223, 0x08880750);
2179 cx25840_write4(client, DIF_BPF_COEFF2425, 0x044dffdb);
2180 cx25840_write4(client, DIF_BPF_COEFF2627, 0xfabdf5f8);
2181 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf2a0f193);
2182 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf342f78f);
2183 cx25840_write4(client, DIF_BPF_COEFF3233, 0xfdc404b9);
2184 cx25840_write4(client, DIF_BPF_COEFF3435, 0x0b0e0f78);
2185 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2186 break;
2187
2188 case 3500000:
2189 cx25840_write4(client, DIF_BPF_COEFF01, 0xfffffffd);
2190 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffafff9);
2191 cx25840_write4(client, DIF_BPF_COEFF45, 0x0002001b);
2192 cx25840_write4(client, DIF_BPF_COEFF67, 0x0046007d);
2193 cx25840_write4(client, DIF_BPF_COEFF89, 0x00ad00ba);
2194 cx25840_write4(client, DIF_BPF_COEFF1011, 0x00870000);
2195 cx25840_write4(client, DIF_BPF_COEFF1213, 0xff26fe1a);
2196 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd1bfc7e);
2197 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc99fda4);
2198 cx25840_write4(client, DIF_BPF_COEFF1819, 0xffa5025c);
2199 cx25840_write4(client, DIF_BPF_COEFF2021, 0x054507ad);
2200 cx25840_write4(client, DIF_BPF_COEFF2223, 0x08dd0847);
2201 cx25840_write4(client, DIF_BPF_COEFF2425, 0x05b80172);
2202 cx25840_write4(client, DIF_BPF_COEFF2627, 0xfc2ef6ff);
2203 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf313f170);
2204 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf2abf6bd);
2205 cx25840_write4(client, DIF_BPF_COEFF3233, 0xfcf6041f);
2206 cx25840_write4(client, DIF_BPF_COEFF3435, 0x0abc0f61);
2207 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2208 break;
2209
2210 case 3600000:
2211 cx25840_write4(client, DIF_BPF_COEFF01, 0xfffffffd);
2212 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff8fff3);
2213 cx25840_write4(client, DIF_BPF_COEFF45, 0xfff50006);
2214 cx25840_write4(client, DIF_BPF_COEFF67, 0x002f006c);
2215 cx25840_write4(client, DIF_BPF_COEFF89, 0x00b200e3);
2216 cx25840_write4(client, DIF_BPF_COEFF1011, 0x00dc007e);
2217 cx25840_write4(client, DIF_BPF_COEFF1213, 0xffb9fea0);
2218 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd6bfc71);
2219 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc17fcb1);
2220 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfe65010b);
2221 cx25840_write4(client, DIF_BPF_COEFF2021, 0x042d0713);
2222 cx25840_write4(client, DIF_BPF_COEFF2223, 0x08ec0906);
2223 cx25840_write4(client, DIF_BPF_COEFF2425, 0x07020302);
2224 cx25840_write4(client, DIF_BPF_COEFF2627, 0xfdaff823);
2225 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf3a7f16a);
2226 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf228f5f5);
2227 cx25840_write4(client, DIF_BPF_COEFF3233, 0xfc2a0384);
2228 cx25840_write4(client, DIF_BPF_COEFF3435, 0x0a670f4a);
2229 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2230 break;
2231
2232 case 3700000:
2233 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
2234 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff7ffef);
2235 cx25840_write4(client, DIF_BPF_COEFF45, 0xffe9fff1);
2236 cx25840_write4(client, DIF_BPF_COEFF67, 0x0010004d);
2237 cx25840_write4(client, DIF_BPF_COEFF89, 0x00a100f2);
2238 cx25840_write4(client, DIF_BPF_COEFF1011, 0x011a00f0);
2239 cx25840_write4(client, DIF_BPF_COEFF1213, 0x0053ff44);
2240 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfdedfca2);
2241 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfbd3fbef);
2242 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfd39ffae);
2243 cx25840_write4(client, DIF_BPF_COEFF2021, 0x02ea0638);
2244 cx25840_write4(client, DIF_BPF_COEFF2223, 0x08b50987);
2245 cx25840_write4(client, DIF_BPF_COEFF2425, 0x08230483);
2246 cx25840_write4(client, DIF_BPF_COEFF2627, 0xff39f960);
2247 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf45bf180);
2248 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf1b8f537);
2249 cx25840_write4(client, DIF_BPF_COEFF3233, 0xfb6102e7);
2250 cx25840_write4(client, DIF_BPF_COEFF3435, 0x0a110f32);
2251 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2252 break;
2253
2254 case 3800000:
2255 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffe);
2256 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff9ffee);
2257 cx25840_write4(client, DIF_BPF_COEFF45, 0xffe1ffdd);
2258 cx25840_write4(client, DIF_BPF_COEFF67, 0xfff00024);
2259 cx25840_write4(client, DIF_BPF_COEFF89, 0x007c00e5);
2260 cx25840_write4(client, DIF_BPF_COEFF1011, 0x013a014a);
2261 cx25840_write4(client, DIF_BPF_COEFF1213, 0x00e6fff8);
2262 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfe98fd0f);
2263 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfbd3fb67);
2264 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfc32fe54);
2265 cx25840_write4(client, DIF_BPF_COEFF2021, 0x01880525);
2266 cx25840_write4(client, DIF_BPF_COEFF2223, 0x083909c7);
2267 cx25840_write4(client, DIF_BPF_COEFF2425, 0x091505ee);
2268 cx25840_write4(client, DIF_BPF_COEFF2627, 0x00c7fab3);
2269 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf52df1b4);
2270 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf15df484);
2271 cx25840_write4(client, DIF_BPF_COEFF3233, 0xfa9b0249);
2272 cx25840_write4(client, DIF_BPF_COEFF3435, 0x09ba0f19);
2273 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2274 break;
2275
2276 case 3900000:
2277 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000000);
2278 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffbfff0);
2279 cx25840_write4(client, DIF_BPF_COEFF45, 0xffdeffcf);
2280 cx25840_write4(client, DIF_BPF_COEFF67, 0xffd1fff6);
2281 cx25840_write4(client, DIF_BPF_COEFF89, 0x004800be);
2282 cx25840_write4(client, DIF_BPF_COEFF1011, 0x01390184);
2283 cx25840_write4(client, DIF_BPF_COEFF1213, 0x016300ac);
2284 cx25840_write4(client, DIF_BPF_COEFF1415, 0xff5efdb1);
2285 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc17fb23);
2286 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfb5cfd0d);
2287 cx25840_write4(client, DIF_BPF_COEFF2021, 0x001703e4);
2288 cx25840_write4(client, DIF_BPF_COEFF2223, 0x077b09c4);
2289 cx25840_write4(client, DIF_BPF_COEFF2425, 0x09d2073c);
2290 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0251fc18);
2291 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf61cf203);
2292 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf118f3dc);
2293 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf9d801aa);
2294 cx25840_write4(client, DIF_BPF_COEFF3435, 0x09600eff);
2295 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2296 break;
2297
2298 case 4000000:
2299 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000001);
2300 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffefff4);
2301 cx25840_write4(client, DIF_BPF_COEFF45, 0xffe1ffc8);
2302 cx25840_write4(client, DIF_BPF_COEFF67, 0xffbaffca);
2303 cx25840_write4(client, DIF_BPF_COEFF89, 0x000b0082);
2304 cx25840_write4(client, DIF_BPF_COEFF1011, 0x01170198);
2305 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01c10152);
2306 cx25840_write4(client, DIF_BPF_COEFF1415, 0x0030fe7b);
2307 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc99fb24);
2308 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfac3fbe9);
2309 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfea5027f);
2310 cx25840_write4(client, DIF_BPF_COEFF2223, 0x0683097f);
2311 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0a560867);
2312 cx25840_write4(client, DIF_BPF_COEFF2627, 0x03d2fd89);
2313 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf723f26f);
2314 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf0e8f341);
2315 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf919010a);
2316 cx25840_write4(client, DIF_BPF_COEFF3435, 0x09060ee5);
2317 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2318 break;
2319
2320 case 4100000:
2321 cx25840_write4(client, DIF_BPF_COEFF01, 0x00010002);
2322 cx25840_write4(client, DIF_BPF_COEFF23, 0x0002fffb);
2323 cx25840_write4(client, DIF_BPF_COEFF45, 0xffe8ffca);
2324 cx25840_write4(client, DIF_BPF_COEFF67, 0xffacffa4);
2325 cx25840_write4(client, DIF_BPF_COEFF89, 0xffcd0036);
2326 cx25840_write4(client, DIF_BPF_COEFF1011, 0x00d70184);
2327 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01f601dc);
2328 cx25840_write4(client, DIF_BPF_COEFF1415, 0x00ffff60);
2329 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfd51fb6d);
2330 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa6efaf5);
2331 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfd410103);
2332 cx25840_write4(client, DIF_BPF_COEFF2223, 0x055708f9);
2333 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0a9e0969);
2334 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0543ff02);
2335 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf842f2f5);
2336 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf0cef2b2);
2337 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf85e006b);
2338 cx25840_write4(client, DIF_BPF_COEFF3435, 0x08aa0ecb);
2339 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2340 break;
2341
2342 case 4200000:
2343 cx25840_write4(client, DIF_BPF_COEFF01, 0x00010003);
2344 cx25840_write4(client, DIF_BPF_COEFF23, 0x00050003);
2345 cx25840_write4(client, DIF_BPF_COEFF45, 0xfff3ffd3);
2346 cx25840_write4(client, DIF_BPF_COEFF67, 0xffaaff8b);
2347 cx25840_write4(client, DIF_BPF_COEFF89, 0xff95ffe5);
2348 cx25840_write4(client, DIF_BPF_COEFF1011, 0x0080014a);
2349 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01fe023f);
2350 cx25840_write4(client, DIF_BPF_COEFF1415, 0x01ba0050);
2351 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfe35fbf8);
2352 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa62fa3b);
2353 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfbf9ff7e);
2354 cx25840_write4(client, DIF_BPF_COEFF2223, 0x04010836);
2355 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0aa90a3d);
2356 cx25840_write4(client, DIF_BPF_COEFF2627, 0x069f007f);
2357 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf975f395);
2358 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf0cbf231);
2359 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf7a9ffcb);
2360 cx25840_write4(client, DIF_BPF_COEFF3435, 0x084c0eaf);
2361 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2362 break;
2363
2364 case 4300000:
2365 cx25840_write4(client, DIF_BPF_COEFF01, 0x00010003);
2366 cx25840_write4(client, DIF_BPF_COEFF23, 0x0008000a);
2367 cx25840_write4(client, DIF_BPF_COEFF45, 0x0000ffe4);
2368 cx25840_write4(client, DIF_BPF_COEFF67, 0xffb4ff81);
2369 cx25840_write4(client, DIF_BPF_COEFF89, 0xff6aff96);
2370 cx25840_write4(client, DIF_BPF_COEFF1011, 0x001c00f0);
2371 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01d70271);
2372 cx25840_write4(client, DIF_BPF_COEFF1415, 0x0254013b);
2373 cx25840_write4(client, DIF_BPF_COEFF1617, 0xff36fcbd);
2374 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa9ff9c5);
2375 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfadbfdfe);
2376 cx25840_write4(client, DIF_BPF_COEFF2223, 0x028c073b);
2377 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0a750adf);
2378 cx25840_write4(client, DIF_BPF_COEFF2627, 0x07e101fa);
2379 cx25840_write4(client, DIF_BPF_COEFF2829, 0xfab8f44e);
2380 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf0ddf1be);
2381 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf6f9ff2b);
2382 cx25840_write4(client, DIF_BPF_COEFF3435, 0x07ed0e94);
2383 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2384 break;
2385
2386 case 4400000:
2387 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
2388 cx25840_write4(client, DIF_BPF_COEFF23, 0x0009000f);
2389 cx25840_write4(client, DIF_BPF_COEFF45, 0x000efff8);
2390 cx25840_write4(client, DIF_BPF_COEFF67, 0xffc9ff87);
2391 cx25840_write4(client, DIF_BPF_COEFF89, 0xff52ff54);
2392 cx25840_write4(client, DIF_BPF_COEFF1011, 0xffb5007e);
2393 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01860270);
2394 cx25840_write4(client, DIF_BPF_COEFF1415, 0x02c00210);
2395 cx25840_write4(client, DIF_BPF_COEFF1617, 0x0044fdb2);
2396 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfb22f997);
2397 cx25840_write4(client, DIF_BPF_COEFF2021, 0xf9f2fc90);
2398 cx25840_write4(client, DIF_BPF_COEFF2223, 0x0102060f);
2399 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0a050b4c);
2400 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0902036e);
2401 cx25840_write4(client, DIF_BPF_COEFF2829, 0xfc0af51e);
2402 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf106f15a);
2403 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf64efe8b);
2404 cx25840_write4(client, DIF_BPF_COEFF3435, 0x078d0e77);
2405 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2406 break;
2407
2408 case 4500000:
2409 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000002);
2410 cx25840_write4(client, DIF_BPF_COEFF23, 0x00080012);
2411 cx25840_write4(client, DIF_BPF_COEFF45, 0x0019000e);
2412 cx25840_write4(client, DIF_BPF_COEFF67, 0xffe5ff9e);
2413 cx25840_write4(client, DIF_BPF_COEFF89, 0xff4fff25);
2414 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff560000);
2415 cx25840_write4(client, DIF_BPF_COEFF1213, 0x0112023b);
2416 cx25840_write4(client, DIF_BPF_COEFF1415, 0x02f702c0);
2417 cx25840_write4(client, DIF_BPF_COEFF1617, 0x014dfec8);
2418 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfbe5f9b3);
2419 cx25840_write4(client, DIF_BPF_COEFF2021, 0xf947fb41);
2420 cx25840_write4(client, DIF_BPF_COEFF2223, 0xff7004b9);
2421 cx25840_write4(client, DIF_BPF_COEFF2425, 0x095a0b81);
2422 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0a0004d8);
2423 cx25840_write4(client, DIF_BPF_COEFF2829, 0xfd65f603);
2424 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf144f104);
2425 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf5aafdec);
2426 cx25840_write4(client, DIF_BPF_COEFF3435, 0x072b0e5a);
2427 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2428 break;
2429
2430 case 4600000:
2431 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000001);
2432 cx25840_write4(client, DIF_BPF_COEFF23, 0x00060012);
2433 cx25840_write4(client, DIF_BPF_COEFF45, 0x00200022);
2434 cx25840_write4(client, DIF_BPF_COEFF67, 0x0005ffc1);
2435 cx25840_write4(client, DIF_BPF_COEFF89, 0xff61ff10);
2436 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff09ff82);
2437 cx25840_write4(client, DIF_BPF_COEFF1213, 0x008601d7);
2438 cx25840_write4(client, DIF_BPF_COEFF1415, 0x02f50340);
2439 cx25840_write4(client, DIF_BPF_COEFF1617, 0x0241fff0);
2440 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfcddfa19);
2441 cx25840_write4(client, DIF_BPF_COEFF2021, 0xf8e2fa1e);
2442 cx25840_write4(client, DIF_BPF_COEFF2223, 0xfde30343);
2443 cx25840_write4(client, DIF_BPF_COEFF2425, 0x08790b7f);
2444 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0ad50631);
2445 cx25840_write4(client, DIF_BPF_COEFF2829, 0xfec7f6fc);
2446 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf198f0bd);
2447 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf50dfd4e);
2448 cx25840_write4(client, DIF_BPF_COEFF3435, 0x06c90e3d);
2449 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2450 break;
2451
2452 case 4700000:
2453 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000ffff);
2454 cx25840_write4(client, DIF_BPF_COEFF23, 0x0003000f);
2455 cx25840_write4(client, DIF_BPF_COEFF45, 0x00220030);
2456 cx25840_write4(client, DIF_BPF_COEFF67, 0x0025ffed);
2457 cx25840_write4(client, DIF_BPF_COEFF89, 0xff87ff15);
2458 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfed6ff10);
2459 cx25840_write4(client, DIF_BPF_COEFF1213, 0xffed014c);
2460 cx25840_write4(client, DIF_BPF_COEFF1415, 0x02b90386);
2461 cx25840_write4(client, DIF_BPF_COEFF1617, 0x03110119);
2462 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfdfefac4);
2463 cx25840_write4(client, DIF_BPF_COEFF2021, 0xf8c6f92f);
2464 cx25840_write4(client, DIF_BPF_COEFF2223, 0xfc6701b7);
2465 cx25840_write4(client, DIF_BPF_COEFF2425, 0x07670b44);
2466 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0b7e0776);
2467 cx25840_write4(client, DIF_BPF_COEFF2829, 0x002df807);
2468 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf200f086);
2469 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf477fcb1);
2470 cx25840_write4(client, DIF_BPF_COEFF3435, 0x06650e1e);
2471 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2472 break;
2473
2474 case 4800000:
2475 cx25840_write4(client, DIF_BPF_COEFF01, 0xfffffffe);
2476 cx25840_write4(client, DIF_BPF_COEFF23, 0xffff0009);
2477 cx25840_write4(client, DIF_BPF_COEFF45, 0x001e0038);
2478 cx25840_write4(client, DIF_BPF_COEFF67, 0x003f001b);
2479 cx25840_write4(client, DIF_BPF_COEFF89, 0xffbcff36);
2480 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfec2feb6);
2481 cx25840_write4(client, DIF_BPF_COEFF1213, 0xff5600a5);
2482 cx25840_write4(client, DIF_BPF_COEFF1415, 0x0248038d);
2483 cx25840_write4(client, DIF_BPF_COEFF1617, 0x03b00232);
2484 cx25840_write4(client, DIF_BPF_COEFF1819, 0xff39fbab);
2485 cx25840_write4(client, DIF_BPF_COEFF2021, 0xf8f4f87f);
2486 cx25840_write4(client, DIF_BPF_COEFF2223, 0xfb060020);
2487 cx25840_write4(client, DIF_BPF_COEFF2425, 0x062a0ad2);
2488 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0bf908a3);
2489 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0192f922);
2490 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf27df05e);
2491 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf3e8fc14);
2492 cx25840_write4(client, DIF_BPF_COEFF3435, 0x06000e00);
2493 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2494 break;
2495
2496 case 4900000:
2497 cx25840_write4(client, DIF_BPF_COEFF01, 0xfffffffd);
2498 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffc0002);
2499 cx25840_write4(client, DIF_BPF_COEFF45, 0x00160037);
2500 cx25840_write4(client, DIF_BPF_COEFF67, 0x00510046);
2501 cx25840_write4(client, DIF_BPF_COEFF89, 0xfff9ff6d);
2502 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfed0fe7c);
2503 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfecefff0);
2504 cx25840_write4(client, DIF_BPF_COEFF1415, 0x01aa0356);
2505 cx25840_write4(client, DIF_BPF_COEFF1617, 0x0413032b);
2506 cx25840_write4(client, DIF_BPF_COEFF1819, 0x007ffcc5);
2507 cx25840_write4(client, DIF_BPF_COEFF2021, 0xf96cf812);
2508 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf9cefe87);
2509 cx25840_write4(client, DIF_BPF_COEFF2425, 0x04c90a2c);
2510 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0c4309b4);
2511 cx25840_write4(client, DIF_BPF_COEFF2829, 0x02f3fa4a);
2512 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf30ef046);
2513 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf361fb7a);
2514 cx25840_write4(client, DIF_BPF_COEFF3435, 0x059b0de0);
2515 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2516 break;
2517
2518 case 5000000:
2519 cx25840_write4(client, DIF_BPF_COEFF01, 0xfffffffd);
2520 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff9fffa);
2521 cx25840_write4(client, DIF_BPF_COEFF45, 0x000a002d);
2522 cx25840_write4(client, DIF_BPF_COEFF67, 0x00570067);
2523 cx25840_write4(client, DIF_BPF_COEFF89, 0x0037ffb5);
2524 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfefffe68);
2525 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe62ff3d);
2526 cx25840_write4(client, DIF_BPF_COEFF1415, 0x00ec02e3);
2527 cx25840_write4(client, DIF_BPF_COEFF1617, 0x043503f6);
2528 cx25840_write4(client, DIF_BPF_COEFF1819, 0x01befe05);
2529 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfa27f7ee);
2530 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf8c6fcf8);
2531 cx25840_write4(client, DIF_BPF_COEFF2425, 0x034c0954);
2532 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0c5c0aa4);
2533 cx25840_write4(client, DIF_BPF_COEFF2829, 0x044cfb7e);
2534 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf3b1f03f);
2535 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf2e2fae1);
2536 cx25840_write4(client, DIF_BPF_COEFF3435, 0x05340dc0);
2537 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2538 break;
2539
2540 case 5100000:
2541 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
2542 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff8fff4);
2543 cx25840_write4(client, DIF_BPF_COEFF45, 0xfffd001e);
2544 cx25840_write4(client, DIF_BPF_COEFF67, 0x0051007b);
2545 cx25840_write4(client, DIF_BPF_COEFF89, 0x006e0006);
2546 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff48fe7c);
2547 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe1bfe9a);
2548 cx25840_write4(client, DIF_BPF_COEFF1415, 0x001d023e);
2549 cx25840_write4(client, DIF_BPF_COEFF1617, 0x04130488);
2550 cx25840_write4(client, DIF_BPF_COEFF1819, 0x02e6ff5b);
2551 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfb1ef812);
2552 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf7f7fb7f);
2553 cx25840_write4(client, DIF_BPF_COEFF2425, 0x01bc084e);
2554 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0c430b72);
2555 cx25840_write4(client, DIF_BPF_COEFF2829, 0x059afcba);
2556 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf467f046);
2557 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf26cfa4a);
2558 cx25840_write4(client, DIF_BPF_COEFF3435, 0x04cd0da0);
2559 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2560 break;
2561
2562 case 5200000:
2563 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffe);
2564 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff8ffef);
2565 cx25840_write4(client, DIF_BPF_COEFF45, 0xfff00009);
2566 cx25840_write4(client, DIF_BPF_COEFF67, 0x003f007f);
2567 cx25840_write4(client, DIF_BPF_COEFF89, 0x00980056);
2568 cx25840_write4(client, DIF_BPF_COEFF1011, 0xffa5feb6);
2569 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe00fe15);
2570 cx25840_write4(client, DIF_BPF_COEFF1415, 0xff4b0170);
2571 cx25840_write4(client, DIF_BPF_COEFF1617, 0x03b004d7);
2572 cx25840_write4(client, DIF_BPF_COEFF1819, 0x03e800b9);
2573 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfc48f87f);
2574 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf768fa23);
2575 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0022071f);
2576 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0bf90c1b);
2577 cx25840_write4(client, DIF_BPF_COEFF2829, 0x06dafdfd);
2578 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf52df05e);
2579 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf1fef9b5);
2580 cx25840_write4(client, DIF_BPF_COEFF3435, 0x04640d7f);
2581 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2582 break;
2583
2584 case 5300000:
2585 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000ffff);
2586 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff9ffee);
2587 cx25840_write4(client, DIF_BPF_COEFF45, 0xffe6fff3);
2588 cx25840_write4(client, DIF_BPF_COEFF67, 0x00250072);
2589 cx25840_write4(client, DIF_BPF_COEFF89, 0x00af009c);
2590 cx25840_write4(client, DIF_BPF_COEFF1011, 0x000cff10);
2591 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe13fdb8);
2592 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfe870089);
2593 cx25840_write4(client, DIF_BPF_COEFF1617, 0x031104e1);
2594 cx25840_write4(client, DIF_BPF_COEFF1819, 0x04b8020f);
2595 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfd98f92f);
2596 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf71df8f0);
2597 cx25840_write4(client, DIF_BPF_COEFF2425, 0xfe8805ce);
2598 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0b7e0c9c);
2599 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0808ff44);
2600 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf603f086);
2601 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf19af922);
2602 cx25840_write4(client, DIF_BPF_COEFF3435, 0x03fb0d5e);
2603 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2604 break;
2605
2606 case 5400000:
2607 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000001);
2608 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffcffef);
2609 cx25840_write4(client, DIF_BPF_COEFF45, 0xffe0ffe0);
2610 cx25840_write4(client, DIF_BPF_COEFF67, 0x00050056);
2611 cx25840_write4(client, DIF_BPF_COEFF89, 0x00b000d1);
2612 cx25840_write4(client, DIF_BPF_COEFF1011, 0x0071ff82);
2613 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe53fd8c);
2614 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfddfff99);
2615 cx25840_write4(client, DIF_BPF_COEFF1617, 0x024104a3);
2616 cx25840_write4(client, DIF_BPF_COEFF1819, 0x054a034d);
2617 cx25840_write4(client, DIF_BPF_COEFF2021, 0xff01fa1e);
2618 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf717f7ed);
2619 cx25840_write4(client, DIF_BPF_COEFF2425, 0xfcf50461);
2620 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0ad50cf4);
2621 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0921008d);
2622 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf6e7f0bd);
2623 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf13ff891);
2624 cx25840_write4(client, DIF_BPF_COEFF3435, 0x03920d3b);
2625 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2626 break;
2627
2628 case 5500000:
2629 cx25840_write4(client, DIF_BPF_COEFF01, 0x00010002);
2630 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffffff3);
2631 cx25840_write4(client, DIF_BPF_COEFF45, 0xffdeffd1);
2632 cx25840_write4(client, DIF_BPF_COEFF67, 0xffe5002f);
2633 cx25840_write4(client, DIF_BPF_COEFF89, 0x009c00ed);
2634 cx25840_write4(client, DIF_BPF_COEFF1011, 0x00cb0000);
2635 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfebafd94);
2636 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd61feb0);
2637 cx25840_write4(client, DIF_BPF_COEFF1617, 0x014d0422);
2638 cx25840_write4(client, DIF_BPF_COEFF1819, 0x05970464);
2639 cx25840_write4(client, DIF_BPF_COEFF2021, 0x0074fb41);
2640 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf759f721);
2641 cx25840_write4(client, DIF_BPF_COEFF2425, 0xfb7502de);
2642 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0a000d21);
2643 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0a2201d4);
2644 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf7d9f104);
2645 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf0edf804);
2646 cx25840_write4(client, DIF_BPF_COEFF3435, 0x03280d19);
2647 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2648 break;
2649
2650 case 5600000:
2651 cx25840_write4(client, DIF_BPF_COEFF01, 0x00010003);
2652 cx25840_write4(client, DIF_BPF_COEFF23, 0x0003fffa);
2653 cx25840_write4(client, DIF_BPF_COEFF45, 0xffe3ffc9);
2654 cx25840_write4(client, DIF_BPF_COEFF67, 0xffc90002);
2655 cx25840_write4(client, DIF_BPF_COEFF89, 0x007500ef);
2656 cx25840_write4(client, DIF_BPF_COEFF1011, 0x010e007e);
2657 cx25840_write4(client, DIF_BPF_COEFF1213, 0xff3dfdcf);
2658 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd16fddd);
2659 cx25840_write4(client, DIF_BPF_COEFF1617, 0x00440365);
2660 cx25840_write4(client, DIF_BPF_COEFF1819, 0x059b0548);
2661 cx25840_write4(client, DIF_BPF_COEFF2021, 0x01e3fc90);
2662 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf7dff691);
2663 cx25840_write4(client, DIF_BPF_COEFF2425, 0xfa0f014d);
2664 cx25840_write4(client, DIF_BPF_COEFF2627, 0x09020d23);
2665 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0b0a0318);
2666 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf8d7f15a);
2667 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf0a5f779);
2668 cx25840_write4(client, DIF_BPF_COEFF3435, 0x02bd0cf6);
2669 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2670 break;
2671
2672 case 5700000:
2673 cx25840_write4(client, DIF_BPF_COEFF01, 0x00010003);
2674 cx25840_write4(client, DIF_BPF_COEFF23, 0x00060001);
2675 cx25840_write4(client, DIF_BPF_COEFF45, 0xffecffc9);
2676 cx25840_write4(client, DIF_BPF_COEFF67, 0xffb4ffd4);
2677 cx25840_write4(client, DIF_BPF_COEFF89, 0x004000d5);
2678 cx25840_write4(client, DIF_BPF_COEFF1011, 0x013600f0);
2679 cx25840_write4(client, DIF_BPF_COEFF1213, 0xffd3fe39);
2680 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd04fd31);
2681 cx25840_write4(client, DIF_BPF_COEFF1617, 0xff360277);
2682 cx25840_write4(client, DIF_BPF_COEFF1819, 0x055605ef);
2683 cx25840_write4(client, DIF_BPF_COEFF2021, 0x033efdfe);
2684 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf8a5f642);
2685 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf8cbffb6);
2686 cx25840_write4(client, DIF_BPF_COEFF2627, 0x07e10cfb);
2687 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0bd50456);
2688 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf9dff1be);
2689 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf067f6f2);
2690 cx25840_write4(client, DIF_BPF_COEFF3435, 0x02520cd2);
2691 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2692 break;
2693
2694 case 5800000:
2695 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
2696 cx25840_write4(client, DIF_BPF_COEFF23, 0x00080009);
2697 cx25840_write4(client, DIF_BPF_COEFF45, 0xfff8ffd2);
2698 cx25840_write4(client, DIF_BPF_COEFF67, 0xffaaffac);
2699 cx25840_write4(client, DIF_BPF_COEFF89, 0x000200a3);
2700 cx25840_write4(client, DIF_BPF_COEFF1011, 0x013c014a);
2701 cx25840_write4(client, DIF_BPF_COEFF1213, 0x006dfec9);
2702 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd2bfcb7);
2703 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfe350165);
2704 cx25840_write4(client, DIF_BPF_COEFF1819, 0x04cb0651);
2705 cx25840_write4(client, DIF_BPF_COEFF2021, 0x0477ff7e);
2706 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf9a5f635);
2707 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf7b1fe20);
2708 cx25840_write4(client, DIF_BPF_COEFF2627, 0x069f0ca8);
2709 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0c81058b);
2710 cx25840_write4(client, DIF_BPF_COEFF3031, 0xfaf0f231);
2711 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf033f66d);
2712 cx25840_write4(client, DIF_BPF_COEFF3435, 0x01e60cae);
2713 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2714 break;
2715
2716 case 5900000:
2717 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000002);
2718 cx25840_write4(client, DIF_BPF_COEFF23, 0x0009000e);
2719 cx25840_write4(client, DIF_BPF_COEFF45, 0x0005ffe1);
2720 cx25840_write4(client, DIF_BPF_COEFF67, 0xffacff90);
2721 cx25840_write4(client, DIF_BPF_COEFF89, 0xffc5005f);
2722 cx25840_write4(client, DIF_BPF_COEFF1011, 0x01210184);
2723 cx25840_write4(client, DIF_BPF_COEFF1213, 0x00fcff72);
2724 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd8afc77);
2725 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfd51003f);
2726 cx25840_write4(client, DIF_BPF_COEFF1819, 0x04020669);
2727 cx25840_write4(client, DIF_BPF_COEFF2021, 0x05830103);
2728 cx25840_write4(client, DIF_BPF_COEFF2223, 0xfad7f66b);
2729 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf6c8fc93);
2730 cx25840_write4(client, DIF_BPF_COEFF2627, 0x05430c2b);
2731 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0d0d06b5);
2732 cx25840_write4(client, DIF_BPF_COEFF3031, 0xfc08f2b2);
2733 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf00af5ec);
2734 cx25840_write4(client, DIF_BPF_COEFF3435, 0x017b0c89);
2735 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2736 break;
2737
2738 case 6000000:
2739 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000001);
2740 cx25840_write4(client, DIF_BPF_COEFF23, 0x00070012);
2741 cx25840_write4(client, DIF_BPF_COEFF45, 0x0012fff5);
2742 cx25840_write4(client, DIF_BPF_COEFF67, 0xffbaff82);
2743 cx25840_write4(client, DIF_BPF_COEFF89, 0xff8e000f);
2744 cx25840_write4(client, DIF_BPF_COEFF1011, 0x00e80198);
2745 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01750028);
2746 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfe18fc75);
2747 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc99ff15);
2748 cx25840_write4(client, DIF_BPF_COEFF1819, 0x03050636);
2749 cx25840_write4(client, DIF_BPF_COEFF2021, 0x0656027f);
2750 cx25840_write4(client, DIF_BPF_COEFF2223, 0xfc32f6e2);
2751 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf614fb17);
2752 cx25840_write4(client, DIF_BPF_COEFF2627, 0x03d20b87);
2753 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0d7707d2);
2754 cx25840_write4(client, DIF_BPF_COEFF3031, 0xfd26f341);
2755 cx25840_write4(client, DIF_BPF_COEFF3233, 0xefeaf56f);
2756 cx25840_write4(client, DIF_BPF_COEFF3435, 0x010f0c64);
2757 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2758 break;
2759
2760 case 6100000:
2761 cx25840_write4(client, DIF_BPF_COEFF01, 0xffff0000);
2762 cx25840_write4(client, DIF_BPF_COEFF23, 0x00050012);
2763 cx25840_write4(client, DIF_BPF_COEFF45, 0x001c000b);
2764 cx25840_write4(client, DIF_BPF_COEFF67, 0xffd1ff84);
2765 cx25840_write4(client, DIF_BPF_COEFF89, 0xff66ffbe);
2766 cx25840_write4(client, DIF_BPF_COEFF1011, 0x00960184);
2767 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01cd00da);
2768 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfeccfcb2);
2769 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc17fdf9);
2770 cx25840_write4(client, DIF_BPF_COEFF1819, 0x01e005bc);
2771 cx25840_write4(client, DIF_BPF_COEFF2021, 0x06e703e4);
2772 cx25840_write4(client, DIF_BPF_COEFF2223, 0xfdabf798);
2773 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf599f9b3);
2774 cx25840_write4(client, DIF_BPF_COEFF2627, 0x02510abd);
2775 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0dbf08df);
2776 cx25840_write4(client, DIF_BPF_COEFF3031, 0xfe48f3dc);
2777 cx25840_write4(client, DIF_BPF_COEFF3233, 0xefd5f4f6);
2778 cx25840_write4(client, DIF_BPF_COEFF3435, 0x00a20c3e);
2779 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2780 break;
2781
2782 case 6200000:
2783 cx25840_write4(client, DIF_BPF_COEFF01, 0xfffffffe);
2784 cx25840_write4(client, DIF_BPF_COEFF23, 0x0002000f);
2785 cx25840_write4(client, DIF_BPF_COEFF45, 0x0021001f);
2786 cx25840_write4(client, DIF_BPF_COEFF67, 0xfff0ff97);
2787 cx25840_write4(client, DIF_BPF_COEFF89, 0xff50ff74);
2788 cx25840_write4(client, DIF_BPF_COEFF1011, 0x0034014a);
2789 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01fa0179);
2790 cx25840_write4(client, DIF_BPF_COEFF1415, 0xff97fd2a);
2791 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfbd3fcfa);
2792 cx25840_write4(client, DIF_BPF_COEFF1819, 0x00a304fe);
2793 cx25840_write4(client, DIF_BPF_COEFF2021, 0x07310525);
2794 cx25840_write4(client, DIF_BPF_COEFF2223, 0xff37f886);
2795 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf55cf86e);
2796 cx25840_write4(client, DIF_BPF_COEFF2627, 0x00c709d0);
2797 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0de209db);
2798 cx25840_write4(client, DIF_BPF_COEFF3031, 0xff6df484);
2799 cx25840_write4(client, DIF_BPF_COEFF3233, 0xefcbf481);
2800 cx25840_write4(client, DIF_BPF_COEFF3435, 0x00360c18);
2801 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2802 break;
2803
2804 case 6300000:
2805 cx25840_write4(client, DIF_BPF_COEFF01, 0xfffffffd);
2806 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffe000a);
2807 cx25840_write4(client, DIF_BPF_COEFF45, 0x0021002f);
2808 cx25840_write4(client, DIF_BPF_COEFF67, 0x0010ffb8);
2809 cx25840_write4(client, DIF_BPF_COEFF89, 0xff50ff3b);
2810 cx25840_write4(client, DIF_BPF_COEFF1011, 0xffcc00f0);
2811 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01fa01fa);
2812 cx25840_write4(client, DIF_BPF_COEFF1415, 0x0069fdd4);
2813 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfbd3fc26);
2814 cx25840_write4(client, DIF_BPF_COEFF1819, 0xff5d0407);
2815 cx25840_write4(client, DIF_BPF_COEFF2021, 0x07310638);
2816 cx25840_write4(client, DIF_BPF_COEFF2223, 0x00c9f9a8);
2817 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf55cf74e);
2818 cx25840_write4(client, DIF_BPF_COEFF2627, 0xff3908c3);
2819 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0de20ac3);
2820 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0093f537);
2821 cx25840_write4(client, DIF_BPF_COEFF3233, 0xefcbf410);
2822 cx25840_write4(client, DIF_BPF_COEFF3435, 0xffca0bf2);
2823 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2824 break;
2825
2826 case 6400000:
2827 cx25840_write4(client, DIF_BPF_COEFF01, 0xfffffffd);
2828 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffb0003);
2829 cx25840_write4(client, DIF_BPF_COEFF45, 0x001c0037);
2830 cx25840_write4(client, DIF_BPF_COEFF67, 0x002fffe2);
2831 cx25840_write4(client, DIF_BPF_COEFF89, 0xff66ff17);
2832 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff6a007e);
2833 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01cd0251);
2834 cx25840_write4(client, DIF_BPF_COEFF1415, 0x0134fea5);
2835 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc17fb8b);
2836 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfe2002e0);
2837 cx25840_write4(client, DIF_BPF_COEFF2021, 0x06e70713);
2838 cx25840_write4(client, DIF_BPF_COEFF2223, 0x0255faf5);
2839 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf599f658);
2840 cx25840_write4(client, DIF_BPF_COEFF2627, 0xfdaf0799);
2841 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0dbf0b96);
2842 cx25840_write4(client, DIF_BPF_COEFF3031, 0x01b8f5f5);
2843 cx25840_write4(client, DIF_BPF_COEFF3233, 0xefd5f3a3);
2844 cx25840_write4(client, DIF_BPF_COEFF3435, 0xff5e0bca);
2845 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2846 break;
2847
2848 case 6500000:
2849 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
2850 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff9fffb);
2851 cx25840_write4(client, DIF_BPF_COEFF45, 0x00120037);
2852 cx25840_write4(client, DIF_BPF_COEFF67, 0x00460010);
2853 cx25840_write4(client, DIF_BPF_COEFF89, 0xff8eff0f);
2854 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff180000);
2855 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01750276);
2856 cx25840_write4(client, DIF_BPF_COEFF1415, 0x01e8ff8d);
2857 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc99fb31);
2858 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfcfb0198);
2859 cx25840_write4(client, DIF_BPF_COEFF2021, 0x065607ad);
2860 cx25840_write4(client, DIF_BPF_COEFF2223, 0x03cefc64);
2861 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf614f592);
2862 cx25840_write4(client, DIF_BPF_COEFF2627, 0xfc2e0656);
2863 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0d770c52);
2864 cx25840_write4(client, DIF_BPF_COEFF3031, 0x02daf6bd);
2865 cx25840_write4(client, DIF_BPF_COEFF3233, 0xefeaf33b);
2866 cx25840_write4(client, DIF_BPF_COEFF3435, 0xfef10ba3);
2867 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2868 break;
2869
2870 case 6600000:
2871 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffe);
2872 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff7fff5);
2873 cx25840_write4(client, DIF_BPF_COEFF45, 0x0005002f);
2874 cx25840_write4(client, DIF_BPF_COEFF67, 0x0054003c);
2875 cx25840_write4(client, DIF_BPF_COEFF89, 0xffc5ff22);
2876 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfedfff82);
2877 cx25840_write4(client, DIF_BPF_COEFF1213, 0x00fc0267);
2878 cx25840_write4(client, DIF_BPF_COEFF1415, 0x0276007e);
2879 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfd51fb1c);
2880 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfbfe003e);
2881 cx25840_write4(client, DIF_BPF_COEFF2021, 0x05830802);
2882 cx25840_write4(client, DIF_BPF_COEFF2223, 0x0529fdec);
2883 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf6c8f4fe);
2884 cx25840_write4(client, DIF_BPF_COEFF2627, 0xfabd04ff);
2885 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0d0d0cf6);
2886 cx25840_write4(client, DIF_BPF_COEFF3031, 0x03f8f78f);
2887 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf00af2d7);
2888 cx25840_write4(client, DIF_BPF_COEFF3435, 0xfe850b7b);
2889 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2890 break;
2891
2892 case 6700000:
2893 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000ffff);
2894 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff8fff0);
2895 cx25840_write4(client, DIF_BPF_COEFF45, 0xfff80020);
2896 cx25840_write4(client, DIF_BPF_COEFF67, 0x00560060);
2897 cx25840_write4(client, DIF_BPF_COEFF89, 0x0002ff4e);
2898 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfec4ff10);
2899 cx25840_write4(client, DIF_BPF_COEFF1213, 0x006d0225);
2900 cx25840_write4(client, DIF_BPF_COEFF1415, 0x02d50166);
2901 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfe35fb4e);
2902 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfb35fee1);
2903 cx25840_write4(client, DIF_BPF_COEFF2021, 0x0477080e);
2904 cx25840_write4(client, DIF_BPF_COEFF2223, 0x065bff82);
2905 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf7b1f4a0);
2906 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf9610397);
2907 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0c810d80);
2908 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0510f869);
2909 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf033f278);
2910 cx25840_write4(client, DIF_BPF_COEFF3435, 0xfe1a0b52);
2911 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2912 break;
2913
2914 case 6800000:
2915 cx25840_write4(client, DIF_BPF_COEFF01, 0x00010000);
2916 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffaffee);
2917 cx25840_write4(client, DIF_BPF_COEFF45, 0xffec000c);
2918 cx25840_write4(client, DIF_BPF_COEFF67, 0x004c0078);
2919 cx25840_write4(client, DIF_BPF_COEFF89, 0x0040ff8e);
2920 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfecafeb6);
2921 cx25840_write4(client, DIF_BPF_COEFF1213, 0xffd301b6);
2922 cx25840_write4(client, DIF_BPF_COEFF1415, 0x02fc0235);
2923 cx25840_write4(client, DIF_BPF_COEFF1617, 0xff36fbc5);
2924 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfaaafd90);
2925 cx25840_write4(client, DIF_BPF_COEFF2021, 0x033e07d2);
2926 cx25840_write4(client, DIF_BPF_COEFF2223, 0x075b011b);
2927 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf8cbf47a);
2928 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf81f0224);
2929 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0bd50def);
2930 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0621f94b);
2931 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf067f21e);
2932 cx25840_write4(client, DIF_BPF_COEFF3435, 0xfdae0b29);
2933 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2934 break;
2935
2936 case 6900000:
2937 cx25840_write4(client, DIF_BPF_COEFF01, 0x00010001);
2938 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffdffef);
2939 cx25840_write4(client, DIF_BPF_COEFF45, 0xffe3fff6);
2940 cx25840_write4(client, DIF_BPF_COEFF67, 0x0037007f);
2941 cx25840_write4(client, DIF_BPF_COEFF89, 0x0075ffdc);
2942 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfef2fe7c);
2943 cx25840_write4(client, DIF_BPF_COEFF1213, 0xff3d0122);
2944 cx25840_write4(client, DIF_BPF_COEFF1415, 0x02ea02dd);
2945 cx25840_write4(client, DIF_BPF_COEFF1617, 0x0044fc79);
2946 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa65fc5d);
2947 cx25840_write4(client, DIF_BPF_COEFF2021, 0x01e3074e);
2948 cx25840_write4(client, DIF_BPF_COEFF2223, 0x082102ad);
2949 cx25840_write4(client, DIF_BPF_COEFF2425, 0xfa0ff48c);
2950 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf6fe00a9);
2951 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0b0a0e43);
2952 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0729fa33);
2953 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf0a5f1c9);
2954 cx25840_write4(client, DIF_BPF_COEFF3435, 0xfd430b00);
2955 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2956 break;
2957
2958 case 7000000:
2959 cx25840_write4(client, DIF_BPF_COEFF01, 0x00010002);
2960 cx25840_write4(client, DIF_BPF_COEFF23, 0x0001fff3);
2961 cx25840_write4(client, DIF_BPF_COEFF45, 0xffdeffe2);
2962 cx25840_write4(client, DIF_BPF_COEFF67, 0x001b0076);
2963 cx25840_write4(client, DIF_BPF_COEFF89, 0x009c002d);
2964 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff35fe68);
2965 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfeba0076);
2966 cx25840_write4(client, DIF_BPF_COEFF1415, 0x029f0352);
2967 cx25840_write4(client, DIF_BPF_COEFF1617, 0x014dfd60);
2968 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa69fb53);
2969 cx25840_write4(client, DIF_BPF_COEFF2021, 0x00740688);
2970 cx25840_write4(client, DIF_BPF_COEFF2223, 0x08a7042d);
2971 cx25840_write4(client, DIF_BPF_COEFF2425, 0xfb75f4d6);
2972 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf600ff2d);
2973 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0a220e7a);
2974 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0827fb22);
2975 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf0edf17a);
2976 cx25840_write4(client, DIF_BPF_COEFF3435, 0xfcd80ad6);
2977 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
2978 break;
2979
2980 case 7100000:
2981 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
2982 cx25840_write4(client, DIF_BPF_COEFF23, 0x0004fff9);
2983 cx25840_write4(client, DIF_BPF_COEFF45, 0xffe0ffd2);
2984 cx25840_write4(client, DIF_BPF_COEFF67, 0xfffb005e);
2985 cx25840_write4(client, DIF_BPF_COEFF89, 0x00b0007a);
2986 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff8ffe7c);
2987 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe53ffc1);
2988 cx25840_write4(client, DIF_BPF_COEFF1415, 0x0221038c);
2989 cx25840_write4(client, DIF_BPF_COEFF1617, 0x0241fe6e);
2990 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfab6fa80);
2991 cx25840_write4(client, DIF_BPF_COEFF2021, 0xff010587);
2992 cx25840_write4(client, DIF_BPF_COEFF2223, 0x08e90590);
2993 cx25840_write4(client, DIF_BPF_COEFF2425, 0xfcf5f556);
2994 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf52bfdb3);
2995 cx25840_write4(client, DIF_BPF_COEFF2829, 0x09210e95);
2996 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0919fc15);
2997 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf13ff12f);
2998 cx25840_write4(client, DIF_BPF_COEFF3435, 0xfc6e0aab);
2999 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3000 break;
3001
3002 case 7200000:
3003 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
3004 cx25840_write4(client, DIF_BPF_COEFF23, 0x00070000);
3005 cx25840_write4(client, DIF_BPF_COEFF45, 0xffe6ffc9);
3006 cx25840_write4(client, DIF_BPF_COEFF67, 0xffdb0039);
3007 cx25840_write4(client, DIF_BPF_COEFF89, 0x00af00b8);
3008 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfff4feb6);
3009 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe13ff10);
3010 cx25840_write4(client, DIF_BPF_COEFF1415, 0x01790388);
3011 cx25840_write4(client, DIF_BPF_COEFF1617, 0x0311ff92);
3012 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfb48f9ed);
3013 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfd980453);
3014 cx25840_write4(client, DIF_BPF_COEFF2223, 0x08e306cd);
3015 cx25840_write4(client, DIF_BPF_COEFF2425, 0xfe88f60a);
3016 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf482fc40);
3017 cx25840_write4(client, DIF_BPF_COEFF2829, 0x08080e93);
3018 cx25840_write4(client, DIF_BPF_COEFF3031, 0x09fdfd0c);
3019 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf19af0ea);
3020 cx25840_write4(client, DIF_BPF_COEFF3435, 0xfc050a81);
3021 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3022 break;
3023
3024 case 7300000:
3025 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000002);
3026 cx25840_write4(client, DIF_BPF_COEFF23, 0x00080008);
3027 cx25840_write4(client, DIF_BPF_COEFF45, 0xfff0ffc9);
3028 cx25840_write4(client, DIF_BPF_COEFF67, 0xffc1000d);
3029 cx25840_write4(client, DIF_BPF_COEFF89, 0x009800e2);
3030 cx25840_write4(client, DIF_BPF_COEFF1011, 0x005bff10);
3031 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe00fe74);
3032 cx25840_write4(client, DIF_BPF_COEFF1415, 0x00b50345);
3033 cx25840_write4(client, DIF_BPF_COEFF1617, 0x03b000bc);
3034 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfc18f9a1);
3035 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfc4802f9);
3036 cx25840_write4(client, DIF_BPF_COEFF2223, 0x089807dc);
3037 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0022f6f0);
3038 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf407fada);
3039 cx25840_write4(client, DIF_BPF_COEFF2829, 0x06da0e74);
3040 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0ad3fe06);
3041 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf1fef0ab);
3042 cx25840_write4(client, DIF_BPF_COEFF3435, 0xfb9c0a55);
3043 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3044 break;
3045
3046 case 7400000:
3047 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000001);
3048 cx25840_write4(client, DIF_BPF_COEFF23, 0x0008000e);
3049 cx25840_write4(client, DIF_BPF_COEFF45, 0xfffdffd0);
3050 cx25840_write4(client, DIF_BPF_COEFF67, 0xffafffdf);
3051 cx25840_write4(client, DIF_BPF_COEFF89, 0x006e00f2);
3052 cx25840_write4(client, DIF_BPF_COEFF1011, 0x00b8ff82);
3053 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe1bfdf8);
3054 cx25840_write4(client, DIF_BPF_COEFF1415, 0xffe302c8);
3055 cx25840_write4(client, DIF_BPF_COEFF1617, 0x041301dc);
3056 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfd1af99e);
3057 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfb1e0183);
3058 cx25840_write4(client, DIF_BPF_COEFF2223, 0x080908b5);
3059 cx25840_write4(client, DIF_BPF_COEFF2425, 0x01bcf801);
3060 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf3bdf985);
3061 cx25840_write4(client, DIF_BPF_COEFF2829, 0x059a0e38);
3062 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0b99ff03);
3063 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf26cf071);
3064 cx25840_write4(client, DIF_BPF_COEFF3435, 0xfb330a2a);
3065 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3066 break;
3067
3068 case 7500000:
3069 cx25840_write4(client, DIF_BPF_COEFF01, 0xffff0000);
3070 cx25840_write4(client, DIF_BPF_COEFF23, 0x00070011);
3071 cx25840_write4(client, DIF_BPF_COEFF45, 0x000affdf);
3072 cx25840_write4(client, DIF_BPF_COEFF67, 0xffa9ffb5);
3073 cx25840_write4(client, DIF_BPF_COEFF89, 0x003700e6);
3074 cx25840_write4(client, DIF_BPF_COEFF1011, 0x01010000);
3075 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe62fda8);
3076 cx25840_write4(client, DIF_BPF_COEFF1415, 0xff140219);
3077 cx25840_write4(client, DIF_BPF_COEFF1617, 0x043502e1);
3078 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfe42f9e6);
3079 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfa270000);
3080 cx25840_write4(client, DIF_BPF_COEFF2223, 0x073a0953);
3081 cx25840_write4(client, DIF_BPF_COEFF2425, 0x034cf939);
3082 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf3a4f845);
3083 cx25840_write4(client, DIF_BPF_COEFF2829, 0x044c0de1);
3084 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0c4f0000);
3085 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf2e2f03c);
3086 cx25840_write4(client, DIF_BPF_COEFF3435, 0xfacc09fe);
3087 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3088 break;
3089
3090 case 7600000:
3091 cx25840_write4(client, DIF_BPF_COEFF01, 0xffffffff);
3092 cx25840_write4(client, DIF_BPF_COEFF23, 0x00040012);
3093 cx25840_write4(client, DIF_BPF_COEFF45, 0x0016fff3);
3094 cx25840_write4(client, DIF_BPF_COEFF67, 0xffafff95);
3095 cx25840_write4(client, DIF_BPF_COEFF89, 0xfff900c0);
3096 cx25840_write4(client, DIF_BPF_COEFF1011, 0x0130007e);
3097 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfecefd89);
3098 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfe560146);
3099 cx25840_write4(client, DIF_BPF_COEFF1617, 0x041303bc);
3100 cx25840_write4(client, DIF_BPF_COEFF1819, 0xff81fa76);
3101 cx25840_write4(client, DIF_BPF_COEFF2021, 0xf96cfe7d);
3102 cx25840_write4(client, DIF_BPF_COEFF2223, 0x063209b1);
3103 cx25840_write4(client, DIF_BPF_COEFF2425, 0x04c9fa93);
3104 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf3bdf71e);
3105 cx25840_write4(client, DIF_BPF_COEFF2829, 0x02f30d6e);
3106 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0cf200fd);
3107 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf361f00e);
3108 cx25840_write4(client, DIF_BPF_COEFF3435, 0xfa6509d1);
3109 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3110 break;
3111
3112 case 7700000:
3113 cx25840_write4(client, DIF_BPF_COEFF01, 0xfffffffe);
3114 cx25840_write4(client, DIF_BPF_COEFF23, 0x00010010);
3115 cx25840_write4(client, DIF_BPF_COEFF45, 0x001e0008);
3116 cx25840_write4(client, DIF_BPF_COEFF67, 0xffc1ff84);
3117 cx25840_write4(client, DIF_BPF_COEFF89, 0xffbc0084);
3118 cx25840_write4(client, DIF_BPF_COEFF1011, 0x013e00f0);
3119 cx25840_write4(client, DIF_BPF_COEFF1213, 0xff56fd9f);
3120 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfdb8005c);
3121 cx25840_write4(client, DIF_BPF_COEFF1617, 0x03b00460);
3122 cx25840_write4(client, DIF_BPF_COEFF1819, 0x00c7fb45);
3123 cx25840_write4(client, DIF_BPF_COEFF2021, 0xf8f4fd07);
3124 cx25840_write4(client, DIF_BPF_COEFF2223, 0x04fa09ce);
3125 cx25840_write4(client, DIF_BPF_COEFF2425, 0x062afc07);
3126 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf407f614);
3127 cx25840_write4(client, DIF_BPF_COEFF2829, 0x01920ce0);
3128 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0d8301fa);
3129 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf3e8efe5);
3130 cx25840_write4(client, DIF_BPF_COEFF3435, 0xfa0009a4);
3131 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3132 break;
3133
3134 case 7800000:
3135 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
3136 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffd000b);
3137 cx25840_write4(client, DIF_BPF_COEFF45, 0x0022001d);
3138 cx25840_write4(client, DIF_BPF_COEFF67, 0xffdbff82);
3139 cx25840_write4(client, DIF_BPF_COEFF89, 0xff870039);
3140 cx25840_write4(client, DIF_BPF_COEFF1011, 0x012a014a);
3141 cx25840_write4(client, DIF_BPF_COEFF1213, 0xffedfde7);
3142 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd47ff6b);
3143 cx25840_write4(client, DIF_BPF_COEFF1617, 0x031104c6);
3144 cx25840_write4(client, DIF_BPF_COEFF1819, 0x0202fc4c);
3145 cx25840_write4(client, DIF_BPF_COEFF2021, 0xf8c6fbad);
3146 cx25840_write4(client, DIF_BPF_COEFF2223, 0x039909a7);
3147 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0767fd8e);
3148 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf482f52b);
3149 cx25840_write4(client, DIF_BPF_COEFF2829, 0x002d0c39);
3150 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0e0002f4);
3151 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf477efc2);
3152 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf99b0977);
3153 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3154 break;
3155
3156 case 7900000:
3157 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
3158 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffa0004);
3159 cx25840_write4(client, DIF_BPF_COEFF45, 0x0020002d);
3160 cx25840_write4(client, DIF_BPF_COEFF67, 0xfffbff91);
3161 cx25840_write4(client, DIF_BPF_COEFF89, 0xff61ffe8);
3162 cx25840_write4(client, DIF_BPF_COEFF1011, 0x00f70184);
3163 cx25840_write4(client, DIF_BPF_COEFF1213, 0x0086fe5c);
3164 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd0bfe85);
3165 cx25840_write4(client, DIF_BPF_COEFF1617, 0x024104e5);
3166 cx25840_write4(client, DIF_BPF_COEFF1819, 0x0323fd7d);
3167 cx25840_write4(client, DIF_BPF_COEFF2021, 0xf8e2fa79);
3168 cx25840_write4(client, DIF_BPF_COEFF2223, 0x021d093f);
3169 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0879ff22);
3170 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf52bf465);
3171 cx25840_write4(client, DIF_BPF_COEFF2829, 0xfec70b79);
3172 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0e6803eb);
3173 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf50defa5);
3174 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf937094a);
3175 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3176 break;
3177
3178 case 8000000:
3179 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffe);
3180 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff8fffd);
3181 cx25840_write4(client, DIF_BPF_COEFF45, 0x00190036);
3182 cx25840_write4(client, DIF_BPF_COEFF67, 0x001bffaf);
3183 cx25840_write4(client, DIF_BPF_COEFF89, 0xff4fff99);
3184 cx25840_write4(client, DIF_BPF_COEFF1011, 0x00aa0198);
3185 cx25840_write4(client, DIF_BPF_COEFF1213, 0x0112fef3);
3186 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd09fdb9);
3187 cx25840_write4(client, DIF_BPF_COEFF1617, 0x014d04be);
3188 cx25840_write4(client, DIF_BPF_COEFF1819, 0x041bfecc);
3189 cx25840_write4(client, DIF_BPF_COEFF2021, 0xf947f978);
3190 cx25840_write4(client, DIF_BPF_COEFF2223, 0x00900897);
3191 cx25840_write4(client, DIF_BPF_COEFF2425, 0x095a00b9);
3192 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf600f3c5);
3193 cx25840_write4(client, DIF_BPF_COEFF2829, 0xfd650aa3);
3194 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0ebc04de);
3195 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf5aaef8e);
3196 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf8d5091c);
3197 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3198 break;
3199
3200 case 8100000:
3201 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000ffff);
3202 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff7fff6);
3203 cx25840_write4(client, DIF_BPF_COEFF45, 0x000e0038);
3204 cx25840_write4(client, DIF_BPF_COEFF67, 0x0037ffd7);
3205 cx25840_write4(client, DIF_BPF_COEFF89, 0xff52ff56);
3206 cx25840_write4(client, DIF_BPF_COEFF1011, 0x004b0184);
3207 cx25840_write4(client, DIF_BPF_COEFF1213, 0x0186ffa1);
3208 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd40fd16);
3209 cx25840_write4(client, DIF_BPF_COEFF1617, 0x00440452);
3210 cx25840_write4(client, DIF_BPF_COEFF1819, 0x04de0029);
3211 cx25840_write4(client, DIF_BPF_COEFF2021, 0xf9f2f8b2);
3212 cx25840_write4(client, DIF_BPF_COEFF2223, 0xfefe07b5);
3213 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0a05024d);
3214 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf6fef34d);
3215 cx25840_write4(client, DIF_BPF_COEFF2829, 0xfc0a09b8);
3216 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0efa05cd);
3217 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf64eef7d);
3218 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf87308ed);
3219 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3220 break;
3221
3222 case 8200000:
3223 cx25840_write4(client, DIF_BPF_COEFF01, 0x00010000);
3224 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff8fff0);
3225 cx25840_write4(client, DIF_BPF_COEFF45, 0x00000031);
3226 cx25840_write4(client, DIF_BPF_COEFF67, 0x004c0005);
3227 cx25840_write4(client, DIF_BPF_COEFF89, 0xff6aff27);
3228 cx25840_write4(client, DIF_BPF_COEFF1011, 0xffe4014a);
3229 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01d70057);
3230 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfdacfca6);
3231 cx25840_write4(client, DIF_BPF_COEFF1617, 0xff3603a7);
3232 cx25840_write4(client, DIF_BPF_COEFF1819, 0x05610184);
3233 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfadbf82e);
3234 cx25840_write4(client, DIF_BPF_COEFF2223, 0xfd74069f);
3235 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0a7503d6);
3236 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf81ff2ff);
3237 cx25840_write4(client, DIF_BPF_COEFF2829, 0xfab808b9);
3238 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0f2306b5);
3239 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf6f9ef72);
3240 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf81308bf);
3241 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3242 break;
3243
3244 case 8300000:
3245 cx25840_write4(client, DIF_BPF_COEFF01, 0x00010001);
3246 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffbffee);
3247 cx25840_write4(client, DIF_BPF_COEFF45, 0xfff30022);
3248 cx25840_write4(client, DIF_BPF_COEFF67, 0x00560032);
3249 cx25840_write4(client, DIF_BPF_COEFF89, 0xff95ff10);
3250 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff8000f0);
3251 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01fe0106);
3252 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfe46fc71);
3253 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfe3502c7);
3254 cx25840_write4(client, DIF_BPF_COEFF1819, 0x059e02ce);
3255 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfbf9f7f2);
3256 cx25840_write4(client, DIF_BPF_COEFF2223, 0xfbff055b);
3257 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0aa9054c);
3258 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf961f2db);
3259 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf97507aa);
3260 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0f350797);
3261 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf7a9ef6d);
3262 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf7b40890);
3263 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3264 break;
3265
3266 case 8400000:
3267 cx25840_write4(client, DIF_BPF_COEFF01, 0x00010002);
3268 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffeffee);
3269 cx25840_write4(client, DIF_BPF_COEFF45, 0xffe8000f);
3270 cx25840_write4(client, DIF_BPF_COEFF67, 0x00540058);
3271 cx25840_write4(client, DIF_BPF_COEFF89, 0xffcdff14);
3272 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff29007e);
3273 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01f6019e);
3274 cx25840_write4(client, DIF_BPF_COEFF1415, 0xff01fc7c);
3275 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfd5101bf);
3276 cx25840_write4(client, DIF_BPF_COEFF1819, 0x059203f6);
3277 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfd41f7fe);
3278 cx25840_write4(client, DIF_BPF_COEFF2223, 0xfaa903f3);
3279 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0a9e06a9);
3280 cx25840_write4(client, DIF_BPF_COEFF2627, 0xfabdf2e2);
3281 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf842068b);
3282 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0f320871);
3283 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf85eef6e);
3284 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf7560860);
3285 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3286 break;
3287
3288 case 8500000:
3289 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
3290 cx25840_write4(client, DIF_BPF_COEFF23, 0x0002fff2);
3291 cx25840_write4(client, DIF_BPF_COEFF45, 0xffe1fff9);
3292 cx25840_write4(client, DIF_BPF_COEFF67, 0x00460073);
3293 cx25840_write4(client, DIF_BPF_COEFF89, 0x000bff34);
3294 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfee90000);
3295 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01c10215);
3296 cx25840_write4(client, DIF_BPF_COEFF1415, 0xffd0fcc5);
3297 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc99009d);
3298 cx25840_write4(client, DIF_BPF_COEFF1819, 0x053d04f1);
3299 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfea5f853);
3300 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf97d0270);
3301 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0a5607e4);
3302 cx25840_write4(client, DIF_BPF_COEFF2627, 0xfc2ef314);
3303 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf723055f);
3304 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0f180943);
3305 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf919ef75);
3306 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf6fa0830);
3307 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3308 break;
3309
3310 case 8600000:
3311 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
3312 cx25840_write4(client, DIF_BPF_COEFF23, 0x0005fff8);
3313 cx25840_write4(client, DIF_BPF_COEFF45, 0xffdeffe4);
3314 cx25840_write4(client, DIF_BPF_COEFF67, 0x002f007f);
3315 cx25840_write4(client, DIF_BPF_COEFF89, 0x0048ff6b);
3316 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfec7ff82);
3317 cx25840_write4(client, DIF_BPF_COEFF1213, 0x0163025f);
3318 cx25840_write4(client, DIF_BPF_COEFF1415, 0x00a2fd47);
3319 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc17ff73);
3320 cx25840_write4(client, DIF_BPF_COEFF1819, 0x04a405b2);
3321 cx25840_write4(client, DIF_BPF_COEFF2021, 0x0017f8ed);
3322 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf88500dc);
3323 cx25840_write4(client, DIF_BPF_COEFF2425, 0x09d208f9);
3324 cx25840_write4(client, DIF_BPF_COEFF2627, 0xfdaff370);
3325 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf61c0429);
3326 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0ee80a0b);
3327 cx25840_write4(client, DIF_BPF_COEFF3233, 0xf9d8ef82);
3328 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf6a00800);
3329 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3330 break;
3331
3332 case 8700000:
3333 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
3334 cx25840_write4(client, DIF_BPF_COEFF23, 0x0007ffff);
3335 cx25840_write4(client, DIF_BPF_COEFF45, 0xffe1ffd4);
3336 cx25840_write4(client, DIF_BPF_COEFF67, 0x0010007a);
3337 cx25840_write4(client, DIF_BPF_COEFF89, 0x007cffb2);
3338 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfec6ff10);
3339 cx25840_write4(client, DIF_BPF_COEFF1213, 0x00e60277);
3340 cx25840_write4(client, DIF_BPF_COEFF1415, 0x0168fdf9);
3341 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfbd3fe50);
3342 cx25840_write4(client, DIF_BPF_COEFF1819, 0x03ce0631);
3343 cx25840_write4(client, DIF_BPF_COEFF2021, 0x0188f9c8);
3344 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf7c7ff43);
3345 cx25840_write4(client, DIF_BPF_COEFF2425, 0x091509e3);
3346 cx25840_write4(client, DIF_BPF_COEFF2627, 0xff39f3f6);
3347 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf52d02ea);
3348 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0ea30ac9);
3349 cx25840_write4(client, DIF_BPF_COEFF3233, 0xfa9bef95);
3350 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf64607d0);
3351 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3352 break;
3353
3354 case 8800000:
3355 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000002);
3356 cx25840_write4(client, DIF_BPF_COEFF23, 0x00090007);
3357 cx25840_write4(client, DIF_BPF_COEFF45, 0xffe9ffca);
3358 cx25840_write4(client, DIF_BPF_COEFF67, 0xfff00065);
3359 cx25840_write4(client, DIF_BPF_COEFF89, 0x00a10003);
3360 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfee6feb6);
3361 cx25840_write4(client, DIF_BPF_COEFF1213, 0x0053025b);
3362 cx25840_write4(client, DIF_BPF_COEFF1415, 0x0213fed0);
3363 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfbd3fd46);
3364 cx25840_write4(client, DIF_BPF_COEFF1819, 0x02c70668);
3365 cx25840_write4(client, DIF_BPF_COEFF2021, 0x02eafadb);
3366 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf74bfdae);
3367 cx25840_write4(client, DIF_BPF_COEFF2425, 0x08230a9c);
3368 cx25840_write4(client, DIF_BPF_COEFF2627, 0x00c7f4a3);
3369 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf45b01a6);
3370 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0e480b7c);
3371 cx25840_write4(client, DIF_BPF_COEFF3233, 0xfb61efae);
3372 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf5ef079f);
3373 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3374 break;
3375
3376 case 8900000:
3377 cx25840_write4(client, DIF_BPF_COEFF01, 0xffff0000);
3378 cx25840_write4(client, DIF_BPF_COEFF23, 0x0008000d);
3379 cx25840_write4(client, DIF_BPF_COEFF45, 0xfff5ffc8);
3380 cx25840_write4(client, DIF_BPF_COEFF67, 0xffd10043);
3381 cx25840_write4(client, DIF_BPF_COEFF89, 0x00b20053);
3382 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff24fe7c);
3383 cx25840_write4(client, DIF_BPF_COEFF1213, 0xffb9020c);
3384 cx25840_write4(client, DIF_BPF_COEFF1415, 0x0295ffbb);
3385 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc17fc64);
3386 cx25840_write4(client, DIF_BPF_COEFF1819, 0x019b0654);
3387 cx25840_write4(client, DIF_BPF_COEFF2021, 0x042dfc1c);
3388 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf714fc2a);
3389 cx25840_write4(client, DIF_BPF_COEFF2425, 0x07020b21);
3390 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0251f575);
3391 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf3a7005e);
3392 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0dd80c24);
3393 cx25840_write4(client, DIF_BPF_COEFF3233, 0xfc2aefcd);
3394 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf599076e);
3395 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3396 break;
3397
3398 case 9000000:
3399 cx25840_write4(client, DIF_BPF_COEFF01, 0xffffffff);
3400 cx25840_write4(client, DIF_BPF_COEFF23, 0x00060011);
3401 cx25840_write4(client, DIF_BPF_COEFF45, 0x0002ffcf);
3402 cx25840_write4(client, DIF_BPF_COEFF67, 0xffba0018);
3403 cx25840_write4(client, DIF_BPF_COEFF89, 0x00ad009a);
3404 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff79fe68);
3405 cx25840_write4(client, DIF_BPF_COEFF1213, 0xff260192);
3406 cx25840_write4(client, DIF_BPF_COEFF1415, 0x02e500ab);
3407 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc99fbb6);
3408 cx25840_write4(client, DIF_BPF_COEFF1819, 0x005b05f7);
3409 cx25840_write4(client, DIF_BPF_COEFF2021, 0x0545fd81);
3410 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf723fabf);
3411 cx25840_write4(client, DIF_BPF_COEFF2425, 0x05b80b70);
3412 cx25840_write4(client, DIF_BPF_COEFF2627, 0x03d2f669);
3413 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf313ff15);
3414 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0d550cbf);
3415 cx25840_write4(client, DIF_BPF_COEFF3233, 0xfcf6eff2);
3416 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf544073d);
3417 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3418 break;
3419
3420 case 9100000:
3421 cx25840_write4(client, DIF_BPF_COEFF01, 0xfffffffe);
3422 cx25840_write4(client, DIF_BPF_COEFF23, 0x00030012);
3423 cx25840_write4(client, DIF_BPF_COEFF45, 0x000fffdd);
3424 cx25840_write4(client, DIF_BPF_COEFF67, 0xffacffea);
3425 cx25840_write4(client, DIF_BPF_COEFF89, 0x009300cf);
3426 cx25840_write4(client, DIF_BPF_COEFF1011, 0xffdcfe7c);
3427 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfea600f7);
3428 cx25840_write4(client, DIF_BPF_COEFF1415, 0x02fd0190);
3429 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfd51fb46);
3430 cx25840_write4(client, DIF_BPF_COEFF1819, 0xff150554);
3431 cx25840_write4(client, DIF_BPF_COEFF2021, 0x0627fefd);
3432 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf778f978);
3433 cx25840_write4(client, DIF_BPF_COEFF2425, 0x044d0b87);
3434 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0543f77d);
3435 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf2a0fdcf);
3436 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0cbe0d4e);
3437 cx25840_write4(client, DIF_BPF_COEFF3233, 0xfdc4f01d);
3438 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf4f2070b);
3439 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3440 break;
3441
3442 case 9200000:
3443 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
3444 cx25840_write4(client, DIF_BPF_COEFF23, 0x00000010);
3445 cx25840_write4(client, DIF_BPF_COEFF45, 0x001afff0);
3446 cx25840_write4(client, DIF_BPF_COEFF67, 0xffaaffbf);
3447 cx25840_write4(client, DIF_BPF_COEFF89, 0x006700ed);
3448 cx25840_write4(client, DIF_BPF_COEFF1011, 0x0043feb6);
3449 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe460047);
3450 cx25840_write4(client, DIF_BPF_COEFF1415, 0x02db0258);
3451 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfe35fb1b);
3452 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfddc0473);
3453 cx25840_write4(client, DIF_BPF_COEFF2021, 0x06c90082);
3454 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf811f85e);
3455 cx25840_write4(client, DIF_BPF_COEFF2425, 0x02c90b66);
3456 cx25840_write4(client, DIF_BPF_COEFF2627, 0x069ff8ad);
3457 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf250fc8d);
3458 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0c140dcf);
3459 cx25840_write4(client, DIF_BPF_COEFF3233, 0xfe93f04d);
3460 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf4a106d9);
3461 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3462 break;
3463
3464 case 9300000:
3465 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
3466 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffc000c);
3467 cx25840_write4(client, DIF_BPF_COEFF45, 0x00200006);
3468 cx25840_write4(client, DIF_BPF_COEFF67, 0xffb4ff9c);
3469 cx25840_write4(client, DIF_BPF_COEFF89, 0x002f00ef);
3470 cx25840_write4(client, DIF_BPF_COEFF1011, 0x00a4ff10);
3471 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe0dff92);
3472 cx25840_write4(client, DIF_BPF_COEFF1415, 0x028102f7);
3473 cx25840_write4(client, DIF_BPF_COEFF1617, 0xff36fb37);
3474 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfcbf035e);
3475 cx25840_write4(client, DIF_BPF_COEFF2021, 0x07260202);
3476 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf8e8f778);
3477 cx25840_write4(client, DIF_BPF_COEFF2425, 0x01340b0d);
3478 cx25840_write4(client, DIF_BPF_COEFF2627, 0x07e1f9f4);
3479 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf223fb51);
3480 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0b590e42);
3481 cx25840_write4(client, DIF_BPF_COEFF3233, 0xff64f083);
3482 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf45206a7);
3483 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3484 break;
3485
3486 case 9400000:
3487 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
3488 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff90005);
3489 cx25840_write4(client, DIF_BPF_COEFF45, 0x0022001a);
3490 cx25840_write4(client, DIF_BPF_COEFF67, 0xffc9ff86);
3491 cx25840_write4(client, DIF_BPF_COEFF89, 0xfff000d7);
3492 cx25840_write4(client, DIF_BPF_COEFF1011, 0x00f2ff82);
3493 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe01fee5);
3494 cx25840_write4(client, DIF_BPF_COEFF1415, 0x01f60362);
3495 cx25840_write4(client, DIF_BPF_COEFF1617, 0x0044fb99);
3496 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfbcc0222);
3497 cx25840_write4(client, DIF_BPF_COEFF2021, 0x07380370);
3498 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf9f7f6cc);
3499 cx25840_write4(client, DIF_BPF_COEFF2425, 0xff990a7e);
3500 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0902fb50);
3501 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf21afa1f);
3502 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0a8d0ea6);
3503 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0034f0bf);
3504 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf4050675);
3505 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3506 break;
3507
3508 case 9500000:
3509 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffe);
3510 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff8fffe);
3511 cx25840_write4(client, DIF_BPF_COEFF45, 0x001e002b);
3512 cx25840_write4(client, DIF_BPF_COEFF67, 0xffe5ff81);
3513 cx25840_write4(client, DIF_BPF_COEFF89, 0xffb400a5);
3514 cx25840_write4(client, DIF_BPF_COEFF1011, 0x01280000);
3515 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe24fe50);
3516 cx25840_write4(client, DIF_BPF_COEFF1415, 0x01460390);
3517 cx25840_write4(client, DIF_BPF_COEFF1617, 0x014dfc3a);
3518 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfb1000ce);
3519 cx25840_write4(client, DIF_BPF_COEFF2021, 0x070104bf);
3520 cx25840_write4(client, DIF_BPF_COEFF2223, 0xfb37f65f);
3521 cx25840_write4(client, DIF_BPF_COEFF2425, 0xfe0009bc);
3522 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0a00fcbb);
3523 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf235f8f8);
3524 cx25840_write4(client, DIF_BPF_COEFF3031, 0x09b20efc);
3525 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0105f101);
3526 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf3ba0642);
3527 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3528 break;
3529
3530 case 9600000:
3531 cx25840_write4(client, DIF_BPF_COEFF01, 0x0001ffff);
3532 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff8fff7);
3533 cx25840_write4(client, DIF_BPF_COEFF45, 0x00150036);
3534 cx25840_write4(client, DIF_BPF_COEFF67, 0x0005ff8c);
3535 cx25840_write4(client, DIF_BPF_COEFF89, 0xff810061);
3536 cx25840_write4(client, DIF_BPF_COEFF1011, 0x013d007e);
3537 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe71fddf);
3538 cx25840_write4(client, DIF_BPF_COEFF1415, 0x007c0380);
3539 cx25840_write4(client, DIF_BPF_COEFF1617, 0x0241fd13);
3540 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa94ff70);
3541 cx25840_write4(client, DIF_BPF_COEFF2021, 0x068005e2);
3542 cx25840_write4(client, DIF_BPF_COEFF2223, 0xfc9bf633);
3543 cx25840_write4(client, DIF_BPF_COEFF2425, 0xfc7308ca);
3544 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0ad5fe30);
3545 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf274f7e0);
3546 cx25840_write4(client, DIF_BPF_COEFF3031, 0x08c90f43);
3547 cx25840_write4(client, DIF_BPF_COEFF3233, 0x01d4f147);
3548 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf371060f);
3549 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3550 break;
3551
3552 case 9700000:
3553 cx25840_write4(client, DIF_BPF_COEFF01, 0x00010001);
3554 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff9fff1);
3555 cx25840_write4(client, DIF_BPF_COEFF45, 0x00090038);
3556 cx25840_write4(client, DIF_BPF_COEFF67, 0x0025ffa7);
3557 cx25840_write4(client, DIF_BPF_COEFF89, 0xff5e0012);
3558 cx25840_write4(client, DIF_BPF_COEFF1011, 0x013200f0);
3559 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfee3fd9b);
3560 cx25840_write4(client, DIF_BPF_COEFF1415, 0xffaa0331);
3561 cx25840_write4(client, DIF_BPF_COEFF1617, 0x0311fe15);
3562 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa60fe18);
3563 cx25840_write4(client, DIF_BPF_COEFF2021, 0x05bd06d1);
3564 cx25840_write4(client, DIF_BPF_COEFF2223, 0xfe1bf64a);
3565 cx25840_write4(client, DIF_BPF_COEFF2425, 0xfafa07ae);
3566 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0b7effab);
3567 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf2d5f6d7);
3568 cx25840_write4(client, DIF_BPF_COEFF3031, 0x07d30f7a);
3569 cx25840_write4(client, DIF_BPF_COEFF3233, 0x02a3f194);
3570 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf32905dc);
3571 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3572 break;
3573
3574 case 9800000:
3575 cx25840_write4(client, DIF_BPF_COEFF01, 0x00010002);
3576 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffcffee);
3577 cx25840_write4(client, DIF_BPF_COEFF45, 0xfffb0032);
3578 cx25840_write4(client, DIF_BPF_COEFF67, 0x003fffcd);
3579 cx25840_write4(client, DIF_BPF_COEFF89, 0xff4effc1);
3580 cx25840_write4(client, DIF_BPF_COEFF1011, 0x0106014a);
3581 cx25840_write4(client, DIF_BPF_COEFF1213, 0xff6efd8a);
3582 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfedd02aa);
3583 cx25840_write4(client, DIF_BPF_COEFF1617, 0x03b0ff34);
3584 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa74fcd7);
3585 cx25840_write4(client, DIF_BPF_COEFF2021, 0x04bf0781);
3586 cx25840_write4(client, DIF_BPF_COEFF2223, 0xffaaf6a3);
3587 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf99e066b);
3588 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0bf90128);
3589 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf359f5e1);
3590 cx25840_write4(client, DIF_BPF_COEFF3031, 0x06d20fa2);
3591 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0370f1e5);
3592 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf2e405a8);
3593 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3594 break;
3595
3596 case 9900000:
3597 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
3598 cx25840_write4(client, DIF_BPF_COEFF23, 0xffffffee);
3599 cx25840_write4(client, DIF_BPF_COEFF45, 0xffef0024);
3600 cx25840_write4(client, DIF_BPF_COEFF67, 0x0051fffa);
3601 cx25840_write4(client, DIF_BPF_COEFF89, 0xff54ff77);
3602 cx25840_write4(client, DIF_BPF_COEFF1011, 0x00be0184);
3603 cx25840_write4(client, DIF_BPF_COEFF1213, 0x0006fdad);
3604 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfe2701f3);
3605 cx25840_write4(client, DIF_BPF_COEFF1617, 0x0413005e);
3606 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfad1fbba);
3607 cx25840_write4(client, DIF_BPF_COEFF2021, 0x039007ee);
3608 cx25840_write4(client, DIF_BPF_COEFF2223, 0x013bf73d);
3609 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf868050a);
3610 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0c4302a1);
3611 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf3fdf4fe);
3612 cx25840_write4(client, DIF_BPF_COEFF3031, 0x05c70fba);
3613 cx25840_write4(client, DIF_BPF_COEFF3233, 0x043bf23c);
3614 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf2a10575);
3615 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3616 break;
3617
3618 case 10000000:
3619 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
3620 cx25840_write4(client, DIF_BPF_COEFF23, 0x0003fff1);
3621 cx25840_write4(client, DIF_BPF_COEFF45, 0xffe50011);
3622 cx25840_write4(client, DIF_BPF_COEFF67, 0x00570027);
3623 cx25840_write4(client, DIF_BPF_COEFF89, 0xff70ff3c);
3624 cx25840_write4(client, DIF_BPF_COEFF1011, 0x00620198);
3625 cx25840_write4(client, DIF_BPF_COEFF1213, 0x009efe01);
3626 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd95011a);
3627 cx25840_write4(client, DIF_BPF_COEFF1617, 0x04350183);
3628 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfb71fad0);
3629 cx25840_write4(client, DIF_BPF_COEFF2021, 0x023c0812);
3630 cx25840_write4(client, DIF_BPF_COEFF2223, 0x02c3f811);
3631 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf75e0390);
3632 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0c5c0411);
3633 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf4c1f432);
3634 cx25840_write4(client, DIF_BPF_COEFF3031, 0x04b30fc1);
3635 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0503f297);
3636 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf2610541);
3637 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3638 break;
3639
3640 case 10100000:
3641 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
3642 cx25840_write4(client, DIF_BPF_COEFF23, 0x0006fff7);
3643 cx25840_write4(client, DIF_BPF_COEFF45, 0xffdffffc);
3644 cx25840_write4(client, DIF_BPF_COEFF67, 0x00510050);
3645 cx25840_write4(client, DIF_BPF_COEFF89, 0xff9dff18);
3646 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfffc0184);
3647 cx25840_write4(client, DIF_BPF_COEFF1213, 0x0128fe80);
3648 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd32002e);
3649 cx25840_write4(client, DIF_BPF_COEFF1617, 0x04130292);
3650 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfc4dfa21);
3651 cx25840_write4(client, DIF_BPF_COEFF2021, 0x00d107ee);
3652 cx25840_write4(client, DIF_BPF_COEFF2223, 0x0435f91c);
3653 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf6850205);
3654 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0c430573);
3655 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf5a1f37d);
3656 cx25840_write4(client, DIF_BPF_COEFF3031, 0x03990fba);
3657 cx25840_write4(client, DIF_BPF_COEFF3233, 0x05c7f2f8);
3658 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf222050d);
3659 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3660 break;
3661
3662 case 10200000:
3663 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000002);
3664 cx25840_write4(client, DIF_BPF_COEFF23, 0x0008fffe);
3665 cx25840_write4(client, DIF_BPF_COEFF45, 0xffdfffe7);
3666 cx25840_write4(client, DIF_BPF_COEFF67, 0x003f006e);
3667 cx25840_write4(client, DIF_BPF_COEFF89, 0xffd6ff0f);
3668 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff96014a);
3669 cx25840_write4(client, DIF_BPF_COEFF1213, 0x0197ff1f);
3670 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd05ff3e);
3671 cx25840_write4(client, DIF_BPF_COEFF1617, 0x03b0037c);
3672 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfd59f9b7);
3673 cx25840_write4(client, DIF_BPF_COEFF2021, 0xff5d0781);
3674 cx25840_write4(client, DIF_BPF_COEFF2223, 0x0585fa56);
3675 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf5e4006f);
3676 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0bf906c4);
3677 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf69df2e0);
3678 cx25840_write4(client, DIF_BPF_COEFF3031, 0x02790fa2);
3679 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0688f35d);
3680 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf1e604d8);
3681 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3682 break;
3683
3684 case 10300000:
3685 cx25840_write4(client, DIF_BPF_COEFF01, 0xffff0001);
3686 cx25840_write4(client, DIF_BPF_COEFF23, 0x00090005);
3687 cx25840_write4(client, DIF_BPF_COEFF45, 0xffe4ffd6);
3688 cx25840_write4(client, DIF_BPF_COEFF67, 0x0025007e);
3689 cx25840_write4(client, DIF_BPF_COEFF89, 0x0014ff20);
3690 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff3c00f0);
3691 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01e1ffd0);
3692 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd12fe5c);
3693 cx25840_write4(client, DIF_BPF_COEFF1617, 0x03110433);
3694 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfe88f996);
3695 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfdf106d1);
3696 cx25840_write4(client, DIF_BPF_COEFF2223, 0x06aafbb7);
3697 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf57efed8);
3698 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0b7e07ff);
3699 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf7b0f25e);
3700 cx25840_write4(client, DIF_BPF_COEFF3031, 0x01560f7a);
3701 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0745f3c7);
3702 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf1ac04a4);
3703 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3704 break;
3705
3706 case 10400000:
3707 cx25840_write4(client, DIF_BPF_COEFF01, 0xffffffff);
3708 cx25840_write4(client, DIF_BPF_COEFF23, 0x0008000c);
3709 cx25840_write4(client, DIF_BPF_COEFF45, 0xffedffcb);
3710 cx25840_write4(client, DIF_BPF_COEFF67, 0x0005007d);
3711 cx25840_write4(client, DIF_BPF_COEFF89, 0x0050ff4c);
3712 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfef6007e);
3713 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01ff0086);
3714 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd58fd97);
3715 cx25840_write4(client, DIF_BPF_COEFF1617, 0x024104ad);
3716 cx25840_write4(client, DIF_BPF_COEFF1819, 0xffcaf9c0);
3717 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfc9905e2);
3718 cx25840_write4(client, DIF_BPF_COEFF2223, 0x079afd35);
3719 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf555fd46);
3720 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0ad50920);
3721 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf8d9f1f6);
3722 cx25840_write4(client, DIF_BPF_COEFF3031, 0x00310f43);
3723 cx25840_write4(client, DIF_BPF_COEFF3233, 0x07fdf435);
3724 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf174046f);
3725 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3726 break;
3727
3728 case 10500000:
3729 cx25840_write4(client, DIF_BPF_COEFF01, 0xfffffffe);
3730 cx25840_write4(client, DIF_BPF_COEFF23, 0x00050011);
3731 cx25840_write4(client, DIF_BPF_COEFF45, 0xfffaffc8);
3732 cx25840_write4(client, DIF_BPF_COEFF67, 0xffe5006b);
3733 cx25840_write4(client, DIF_BPF_COEFF89, 0x0082ff8c);
3734 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfecc0000);
3735 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01f00130);
3736 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfdd2fcfc);
3737 cx25840_write4(client, DIF_BPF_COEFF1617, 0x014d04e3);
3738 cx25840_write4(client, DIF_BPF_COEFF1819, 0x010efa32);
3739 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfb6404bf);
3740 cx25840_write4(client, DIF_BPF_COEFF2223, 0x084efec5);
3741 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf569fbc2);
3742 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0a000a23);
3743 cx25840_write4(client, DIF_BPF_COEFF2829, 0xfa15f1ab);
3744 cx25840_write4(client, DIF_BPF_COEFF3031, 0xff0b0efc);
3745 cx25840_write4(client, DIF_BPF_COEFF3233, 0x08b0f4a7);
3746 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf13f043a);
3747 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3748 break;
3749
3750 case 10600000:
3751 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
3752 cx25840_write4(client, DIF_BPF_COEFF23, 0x00020012);
3753 cx25840_write4(client, DIF_BPF_COEFF45, 0x0007ffcd);
3754 cx25840_write4(client, DIF_BPF_COEFF67, 0xffc9004c);
3755 cx25840_write4(client, DIF_BPF_COEFF89, 0x00a4ffd9);
3756 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfec3ff82);
3757 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01b401c1);
3758 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfe76fc97);
3759 cx25840_write4(client, DIF_BPF_COEFF1617, 0x004404d2);
3760 cx25840_write4(client, DIF_BPF_COEFF1819, 0x0245fae8);
3761 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfa5f0370);
3762 cx25840_write4(client, DIF_BPF_COEFF2223, 0x08c1005f);
3763 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf5bcfa52);
3764 cx25840_write4(client, DIF_BPF_COEFF2627, 0x09020b04);
3765 cx25840_write4(client, DIF_BPF_COEFF2829, 0xfb60f17b);
3766 cx25840_write4(client, DIF_BPF_COEFF3031, 0xfde70ea6);
3767 cx25840_write4(client, DIF_BPF_COEFF3233, 0x095df51e);
3768 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf10c0405);
3769 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3770 break;
3771
3772 case 10700000:
3773 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
3774 cx25840_write4(client, DIF_BPF_COEFF23, 0xffff0011);
3775 cx25840_write4(client, DIF_BPF_COEFF45, 0x0014ffdb);
3776 cx25840_write4(client, DIF_BPF_COEFF67, 0xffb40023);
3777 cx25840_write4(client, DIF_BPF_COEFF89, 0x00b2002a);
3778 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfedbff10);
3779 cx25840_write4(client, DIF_BPF_COEFF1213, 0x0150022d);
3780 cx25840_write4(client, DIF_BPF_COEFF1415, 0xff38fc6f);
3781 cx25840_write4(client, DIF_BPF_COEFF1617, 0xff36047b);
3782 cx25840_write4(client, DIF_BPF_COEFF1819, 0x035efbda);
3783 cx25840_write4(client, DIF_BPF_COEFF2021, 0xf9940202);
3784 cx25840_write4(client, DIF_BPF_COEFF2223, 0x08ee01f5);
3785 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf649f8fe);
3786 cx25840_write4(client, DIF_BPF_COEFF2627, 0x07e10bc2);
3787 cx25840_write4(client, DIF_BPF_COEFF2829, 0xfcb6f169);
3788 cx25840_write4(client, DIF_BPF_COEFF3031, 0xfcc60e42);
3789 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0a04f599);
3790 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf0db03d0);
3791 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3792 break;
3793
3794 case 10800000:
3795 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
3796 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffb000d);
3797 cx25840_write4(client, DIF_BPF_COEFF45, 0x001dffed);
3798 cx25840_write4(client, DIF_BPF_COEFF67, 0xffaafff5);
3799 cx25840_write4(client, DIF_BPF_COEFF89, 0x00aa0077);
3800 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff13feb6);
3801 cx25840_write4(client, DIF_BPF_COEFF1213, 0x00ce026b);
3802 cx25840_write4(client, DIF_BPF_COEFF1415, 0x000afc85);
3803 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfe3503e3);
3804 cx25840_write4(client, DIF_BPF_COEFF1819, 0x044cfcfb);
3805 cx25840_write4(client, DIF_BPF_COEFF2021, 0xf90c0082);
3806 cx25840_write4(client, DIF_BPF_COEFF2223, 0x08d5037f);
3807 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf710f7cc);
3808 cx25840_write4(client, DIF_BPF_COEFF2627, 0x069f0c59);
3809 cx25840_write4(client, DIF_BPF_COEFF2829, 0xfe16f173);
3810 cx25840_write4(client, DIF_BPF_COEFF3031, 0xfbaa0dcf);
3811 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0aa5f617);
3812 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf0ad039b);
3813 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3814 break;
3815
3816 case 10900000:
3817 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffe);
3818 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff90006);
3819 cx25840_write4(client, DIF_BPF_COEFF45, 0x00210003);
3820 cx25840_write4(client, DIF_BPF_COEFF67, 0xffacffc8);
3821 cx25840_write4(client, DIF_BPF_COEFF89, 0x008e00b6);
3822 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff63fe7c);
3823 cx25840_write4(client, DIF_BPF_COEFF1213, 0x003a0275);
3824 cx25840_write4(client, DIF_BPF_COEFF1415, 0x00dafcda);
3825 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfd510313);
3826 cx25840_write4(client, DIF_BPF_COEFF1819, 0x0501fe40);
3827 cx25840_write4(client, DIF_BPF_COEFF2021, 0xf8cbfefd);
3828 cx25840_write4(client, DIF_BPF_COEFF2223, 0x087604f0);
3829 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf80af6c2);
3830 cx25840_write4(client, DIF_BPF_COEFF2627, 0x05430cc8);
3831 cx25840_write4(client, DIF_BPF_COEFF2829, 0xff7af19a);
3832 cx25840_write4(client, DIF_BPF_COEFF3031, 0xfa940d4e);
3833 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0b3ff699);
3834 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf0810365);
3835 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3836 break;
3837
3838 case 11000000:
3839 cx25840_write4(client, DIF_BPF_COEFF01, 0x0001ffff);
3840 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff8ffff);
3841 cx25840_write4(client, DIF_BPF_COEFF45, 0x00210018);
3842 cx25840_write4(client, DIF_BPF_COEFF67, 0xffbaffa3);
3843 cx25840_write4(client, DIF_BPF_COEFF89, 0x006000e1);
3844 cx25840_write4(client, DIF_BPF_COEFF1011, 0xffc4fe68);
3845 cx25840_write4(client, DIF_BPF_COEFF1213, 0xffa0024b);
3846 cx25840_write4(client, DIF_BPF_COEFF1415, 0x019afd66);
3847 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc990216);
3848 cx25840_write4(client, DIF_BPF_COEFF1819, 0x0575ff99);
3849 cx25840_write4(client, DIF_BPF_COEFF2021, 0xf8d4fd81);
3850 cx25840_write4(client, DIF_BPF_COEFF2223, 0x07d40640);
3851 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf932f5e6);
3852 cx25840_write4(client, DIF_BPF_COEFF2627, 0x03d20d0d);
3853 cx25840_write4(client, DIF_BPF_COEFF2829, 0x00dff1de);
3854 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf9860cbf);
3855 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0bd1f71e);
3856 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf058032f);
3857 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3858 break;
3859
3860 case 11100000:
3861 cx25840_write4(client, DIF_BPF_COEFF01, 0x00010000);
3862 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff8fff8);
3863 cx25840_write4(client, DIF_BPF_COEFF45, 0x001b0029);
3864 cx25840_write4(client, DIF_BPF_COEFF67, 0xffd1ff8a);
3865 cx25840_write4(client, DIF_BPF_COEFF89, 0x002600f2);
3866 cx25840_write4(client, DIF_BPF_COEFF1011, 0x002cfe7c);
3867 cx25840_write4(client, DIF_BPF_COEFF1213, 0xff0f01f0);
3868 cx25840_write4(client, DIF_BPF_COEFF1415, 0x023bfe20);
3869 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc1700fa);
3870 cx25840_write4(client, DIF_BPF_COEFF1819, 0x05a200f7);
3871 cx25840_write4(client, DIF_BPF_COEFF2021, 0xf927fc1c);
3872 cx25840_write4(client, DIF_BPF_COEFF2223, 0x06f40765);
3873 cx25840_write4(client, DIF_BPF_COEFF2425, 0xfa82f53b);
3874 cx25840_write4(client, DIF_BPF_COEFF2627, 0x02510d27);
3875 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0243f23d);
3876 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf8810c24);
3877 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0c5cf7a7);
3878 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf03102fa);
3879 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3880 break;
3881
3882 case 11200000:
3883 cx25840_write4(client, DIF_BPF_COEFF01, 0x00010002);
3884 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffafff2);
3885 cx25840_write4(client, DIF_BPF_COEFF45, 0x00110035);
3886 cx25840_write4(client, DIF_BPF_COEFF67, 0xfff0ff81);
3887 cx25840_write4(client, DIF_BPF_COEFF89, 0xffe700e7);
3888 cx25840_write4(client, DIF_BPF_COEFF1011, 0x008ffeb6);
3889 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe94016d);
3890 cx25840_write4(client, DIF_BPF_COEFF1415, 0x02b0fefb);
3891 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfbd3ffd1);
3892 cx25840_write4(client, DIF_BPF_COEFF1819, 0x05850249);
3893 cx25840_write4(client, DIF_BPF_COEFF2021, 0xf9c1fadb);
3894 cx25840_write4(client, DIF_BPF_COEFF2223, 0x05de0858);
3895 cx25840_write4(client, DIF_BPF_COEFF2425, 0xfbf2f4c4);
3896 cx25840_write4(client, DIF_BPF_COEFF2627, 0x00c70d17);
3897 cx25840_write4(client, DIF_BPF_COEFF2829, 0x03a0f2b8);
3898 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf7870b7c);
3899 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0cdff833);
3900 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf00d02c4);
3901 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3902 break;
3903
3904 case 11300000:
3905 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
3906 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffdffee);
3907 cx25840_write4(client, DIF_BPF_COEFF45, 0x00040038);
3908 cx25840_write4(client, DIF_BPF_COEFF67, 0x0010ff88);
3909 cx25840_write4(client, DIF_BPF_COEFF89, 0xffac00c2);
3910 cx25840_write4(client, DIF_BPF_COEFF1011, 0x00e2ff10);
3911 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe3900cb);
3912 cx25840_write4(client, DIF_BPF_COEFF1415, 0x02f1ffe9);
3913 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfbd3feaa);
3914 cx25840_write4(client, DIF_BPF_COEFF1819, 0x05210381);
3915 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfa9cf9c8);
3916 cx25840_write4(client, DIF_BPF_COEFF2223, 0x04990912);
3917 cx25840_write4(client, DIF_BPF_COEFF2425, 0xfd7af484);
3918 cx25840_write4(client, DIF_BPF_COEFF2627, 0xff390cdb);
3919 cx25840_write4(client, DIF_BPF_COEFF2829, 0x04f4f34d);
3920 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf69a0ac9);
3921 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0d5af8c1);
3922 cx25840_write4(client, DIF_BPF_COEFF3435, 0xefec028e);
3923 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3924 break;
3925
3926 case 11400000:
3927 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
3928 cx25840_write4(client, DIF_BPF_COEFF23, 0x0000ffee);
3929 cx25840_write4(client, DIF_BPF_COEFF45, 0xfff60033);
3930 cx25840_write4(client, DIF_BPF_COEFF67, 0x002fff9f);
3931 cx25840_write4(client, DIF_BPF_COEFF89, 0xff7b0087);
3932 cx25840_write4(client, DIF_BPF_COEFF1011, 0x011eff82);
3933 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe080018);
3934 cx25840_write4(client, DIF_BPF_COEFF1415, 0x02f900d8);
3935 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc17fd96);
3936 cx25840_write4(client, DIF_BPF_COEFF1819, 0x04790490);
3937 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfbadf8ed);
3938 cx25840_write4(client, DIF_BPF_COEFF2223, 0x032f098e);
3939 cx25840_write4(client, DIF_BPF_COEFF2425, 0xff10f47d);
3940 cx25840_write4(client, DIF_BPF_COEFF2627, 0xfdaf0c75);
3941 cx25840_write4(client, DIF_BPF_COEFF2829, 0x063cf3fc);
3942 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf5ba0a0b);
3943 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0dccf952);
3944 cx25840_write4(client, DIF_BPF_COEFF3435, 0xefcd0258);
3945 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3946 break;
3947
3948 case 11500000:
3949 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
3950 cx25840_write4(client, DIF_BPF_COEFF23, 0x0004fff1);
3951 cx25840_write4(client, DIF_BPF_COEFF45, 0xffea0026);
3952 cx25840_write4(client, DIF_BPF_COEFF67, 0x0046ffc3);
3953 cx25840_write4(client, DIF_BPF_COEFF89, 0xff5a003c);
3954 cx25840_write4(client, DIF_BPF_COEFF1011, 0x013b0000);
3955 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe04ff63);
3956 cx25840_write4(client, DIF_BPF_COEFF1415, 0x02c801b8);
3957 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc99fca6);
3958 cx25840_write4(client, DIF_BPF_COEFF1819, 0x0397056a);
3959 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfcecf853);
3960 cx25840_write4(client, DIF_BPF_COEFF2223, 0x01ad09c9);
3961 cx25840_write4(client, DIF_BPF_COEFF2425, 0x00acf4ad);
3962 cx25840_write4(client, DIF_BPF_COEFF2627, 0xfc2e0be7);
3963 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0773f4c2);
3964 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf4e90943);
3965 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0e35f9e6);
3966 cx25840_write4(client, DIF_BPF_COEFF3435, 0xefb10221);
3967 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3968 break;
3969
3970 case 11600000:
3971 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000002);
3972 cx25840_write4(client, DIF_BPF_COEFF23, 0x0007fff6);
3973 cx25840_write4(client, DIF_BPF_COEFF45, 0xffe20014);
3974 cx25840_write4(client, DIF_BPF_COEFF67, 0x0054ffee);
3975 cx25840_write4(client, DIF_BPF_COEFF89, 0xff4effeb);
3976 cx25840_write4(client, DIF_BPF_COEFF1011, 0x0137007e);
3977 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe2efebb);
3978 cx25840_write4(client, DIF_BPF_COEFF1415, 0x0260027a);
3979 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfd51fbe6);
3980 cx25840_write4(client, DIF_BPF_COEFF1819, 0x02870605);
3981 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfe4af7fe);
3982 cx25840_write4(client, DIF_BPF_COEFF2223, 0x001d09c1);
3983 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0243f515);
3984 cx25840_write4(client, DIF_BPF_COEFF2627, 0xfabd0b32);
3985 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0897f59e);
3986 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf4280871);
3987 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0e95fa7c);
3988 cx25840_write4(client, DIF_BPF_COEFF3435, 0xef9701eb);
3989 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
3990 break;
3991
3992 case 11700000:
3993 cx25840_write4(client, DIF_BPF_COEFF01, 0xffff0001);
3994 cx25840_write4(client, DIF_BPF_COEFF23, 0x0008fffd);
3995 cx25840_write4(client, DIF_BPF_COEFF45, 0xffdeffff);
3996 cx25840_write4(client, DIF_BPF_COEFF67, 0x0056001d);
3997 cx25840_write4(client, DIF_BPF_COEFF89, 0xff57ff9c);
3998 cx25840_write4(client, DIF_BPF_COEFF1011, 0x011300f0);
3999 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe82fe2e);
4000 cx25840_write4(client, DIF_BPF_COEFF1415, 0x01ca0310);
4001 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfe35fb62);
4002 cx25840_write4(client, DIF_BPF_COEFF1819, 0x0155065a);
4003 cx25840_write4(client, DIF_BPF_COEFF2021, 0xffbaf7f2);
4004 cx25840_write4(client, DIF_BPF_COEFF2223, 0xfe8c0977);
4005 cx25840_write4(client, DIF_BPF_COEFF2425, 0x03cef5b2);
4006 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf9610a58);
4007 cx25840_write4(client, DIF_BPF_COEFF2829, 0x09a5f68f);
4008 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf3790797);
4009 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0eebfb14);
4010 cx25840_write4(client, DIF_BPF_COEFF3435, 0xef8001b5);
4011 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4012 break;
4013
4014 case 11800000:
4015 cx25840_write4(client, DIF_BPF_COEFF01, 0xffff0000);
4016 cx25840_write4(client, DIF_BPF_COEFF23, 0x00080004);
4017 cx25840_write4(client, DIF_BPF_COEFF45, 0xffe0ffe9);
4018 cx25840_write4(client, DIF_BPF_COEFF67, 0x004c0047);
4019 cx25840_write4(client, DIF_BPF_COEFF89, 0xff75ff58);
4020 cx25840_write4(client, DIF_BPF_COEFF1011, 0x00d1014a);
4021 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfef9fdc8);
4022 cx25840_write4(client, DIF_BPF_COEFF1415, 0x0111036f);
4023 cx25840_write4(client, DIF_BPF_COEFF1617, 0xff36fb21);
4024 cx25840_write4(client, DIF_BPF_COEFF1819, 0x00120665);
4025 cx25840_write4(client, DIF_BPF_COEFF2021, 0x012df82e);
4026 cx25840_write4(client, DIF_BPF_COEFF2223, 0xfd0708ec);
4027 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0542f682);
4028 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf81f095c);
4029 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0a9af792);
4030 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf2db06b5);
4031 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0f38fbad);
4032 cx25840_write4(client, DIF_BPF_COEFF3435, 0xef6c017e);
4033 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4034 break;
4035
4036 case 11900000:
4037 cx25840_write4(client, DIF_BPF_COEFF01, 0xffffffff);
4038 cx25840_write4(client, DIF_BPF_COEFF23, 0x0007000b);
4039 cx25840_write4(client, DIF_BPF_COEFF45, 0xffe7ffd8);
4040 cx25840_write4(client, DIF_BPF_COEFF67, 0x00370068);
4041 cx25840_write4(client, DIF_BPF_COEFF89, 0xffa4ff28);
4042 cx25840_write4(client, DIF_BPF_COEFF1011, 0x00790184);
4043 cx25840_write4(client, DIF_BPF_COEFF1213, 0xff87fd91);
4044 cx25840_write4(client, DIF_BPF_COEFF1415, 0x00430392);
4045 cx25840_write4(client, DIF_BPF_COEFF1617, 0x0044fb26);
4046 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfece0626);
4047 cx25840_write4(client, DIF_BPF_COEFF2021, 0x0294f8b2);
4048 cx25840_write4(client, DIF_BPF_COEFF2223, 0xfb990825);
4049 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0698f77f);
4050 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf6fe0842);
4051 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0b73f8a7);
4052 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf25105cd);
4053 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0f7bfc48);
4054 cx25840_write4(client, DIF_BPF_COEFF3435, 0xef5a0148);
4055 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4056 break;
4057
4058 case 12000000:
4059 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffe);
4060 cx25840_write4(client, DIF_BPF_COEFF23, 0x00050010);
4061 cx25840_write4(client, DIF_BPF_COEFF45, 0xfff2ffcc);
4062 cx25840_write4(client, DIF_BPF_COEFF67, 0x001b007b);
4063 cx25840_write4(client, DIF_BPF_COEFF89, 0xffdfff10);
4064 cx25840_write4(client, DIF_BPF_COEFF1011, 0x00140198);
4065 cx25840_write4(client, DIF_BPF_COEFF1213, 0x0020fd8e);
4066 cx25840_write4(client, DIF_BPF_COEFF1415, 0xff710375);
4067 cx25840_write4(client, DIF_BPF_COEFF1617, 0x014dfb73);
4068 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfd9a059f);
4069 cx25840_write4(client, DIF_BPF_COEFF2021, 0x03e0f978);
4070 cx25840_write4(client, DIF_BPF_COEFF2223, 0xfa4e0726);
4071 cx25840_write4(client, DIF_BPF_COEFF2425, 0x07c8f8a7);
4072 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf600070c);
4073 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0c2ff9c9);
4074 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf1db04de);
4075 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0fb4fce5);
4076 cx25840_write4(client, DIF_BPF_COEFF3435, 0xef4b0111);
4077 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4078 break;
4079
4080 case 12100000:
4081 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
4082 cx25840_write4(client, DIF_BPF_COEFF23, 0x00010012);
4083 cx25840_write4(client, DIF_BPF_COEFF45, 0xffffffc8);
4084 cx25840_write4(client, DIF_BPF_COEFF67, 0xfffb007e);
4085 cx25840_write4(client, DIF_BPF_COEFF89, 0x001dff14);
4086 cx25840_write4(client, DIF_BPF_COEFF1011, 0xffad0184);
4087 cx25840_write4(client, DIF_BPF_COEFF1213, 0x00b7fdbe);
4088 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfea9031b);
4089 cx25840_write4(client, DIF_BPF_COEFF1617, 0x0241fc01);
4090 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfc8504d6);
4091 cx25840_write4(client, DIF_BPF_COEFF2021, 0x0504fa79);
4092 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf93005f6);
4093 cx25840_write4(client, DIF_BPF_COEFF2425, 0x08caf9f2);
4094 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf52b05c0);
4095 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0ccbfaf9);
4096 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf17903eb);
4097 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0fe3fd83);
4098 cx25840_write4(client, DIF_BPF_COEFF3435, 0xef3f00db);
4099 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4100 break;
4101
4102 case 12200000:
4103 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
4104 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffe0011);
4105 cx25840_write4(client, DIF_BPF_COEFF45, 0x000cffcc);
4106 cx25840_write4(client, DIF_BPF_COEFF67, 0xffdb0071);
4107 cx25840_write4(client, DIF_BPF_COEFF89, 0x0058ff32);
4108 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff4f014a);
4109 cx25840_write4(client, DIF_BPF_COEFF1213, 0x013cfe1f);
4110 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfdfb028a);
4111 cx25840_write4(client, DIF_BPF_COEFF1617, 0x0311fcc9);
4112 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfb9d03d6);
4113 cx25840_write4(client, DIF_BPF_COEFF2021, 0x05f4fbad);
4114 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf848049d);
4115 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0999fb5b);
4116 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf4820461);
4117 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0d46fc32);
4118 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf12d02f4);
4119 cx25840_write4(client, DIF_BPF_COEFF3233, 0x1007fe21);
4120 cx25840_write4(client, DIF_BPF_COEFF3435, 0xef3600a4);
4121 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4122 break;
4123
4124 case 12300000:
4125 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffe);
4126 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffa000e);
4127 cx25840_write4(client, DIF_BPF_COEFF45, 0x0017ffd9);
4128 cx25840_write4(client, DIF_BPF_COEFF67, 0xffc10055);
4129 cx25840_write4(client, DIF_BPF_COEFF89, 0x0088ff68);
4130 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff0400f0);
4131 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01a6fea7);
4132 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd7501cc);
4133 cx25840_write4(client, DIF_BPF_COEFF1617, 0x03b0fdc0);
4134 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfaef02a8);
4135 cx25840_write4(client, DIF_BPF_COEFF2021, 0x06a7fd07);
4136 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf79d0326);
4137 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0a31fcda);
4138 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf40702f3);
4139 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0d9ffd72);
4140 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf0f601fa);
4141 cx25840_write4(client, DIF_BPF_COEFF3233, 0x1021fec0);
4142 cx25840_write4(client, DIF_BPF_COEFF3435, 0xef2f006d);
4143 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4144 break;
4145
4146 case 12400000:
4147 cx25840_write4(client, DIF_BPF_COEFF01, 0x0001ffff);
4148 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff80007);
4149 cx25840_write4(client, DIF_BPF_COEFF45, 0x001fffeb);
4150 cx25840_write4(client, DIF_BPF_COEFF67, 0xffaf002d);
4151 cx25840_write4(client, DIF_BPF_COEFF89, 0x00a8ffb0);
4152 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfed3007e);
4153 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01e9ff4c);
4154 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd2000ee);
4155 cx25840_write4(client, DIF_BPF_COEFF1617, 0x0413fed8);
4156 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa82015c);
4157 cx25840_write4(client, DIF_BPF_COEFF2021, 0x0715fe7d);
4158 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf7340198);
4159 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0a8dfe69);
4160 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf3bd017c);
4161 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0dd5feb8);
4162 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf0d500fd);
4163 cx25840_write4(client, DIF_BPF_COEFF3233, 0x1031ff60);
4164 cx25840_write4(client, DIF_BPF_COEFF3435, 0xef2b0037);
4165 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4166 break;
4167
4168 case 12500000:
4169 cx25840_write4(client, DIF_BPF_COEFF01, 0x00010000);
4170 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff70000);
4171 cx25840_write4(client, DIF_BPF_COEFF45, 0x00220000);
4172 cx25840_write4(client, DIF_BPF_COEFF67, 0xffa90000);
4173 cx25840_write4(client, DIF_BPF_COEFF89, 0x00b30000);
4174 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfec20000);
4175 cx25840_write4(client, DIF_BPF_COEFF1213, 0x02000000);
4176 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd030000);
4177 cx25840_write4(client, DIF_BPF_COEFF1617, 0x04350000);
4178 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa5e0000);
4179 cx25840_write4(client, DIF_BPF_COEFF2021, 0x073b0000);
4180 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf7110000);
4181 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0aac0000);
4182 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf3a40000);
4183 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0de70000);
4184 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf0c90000);
4185 cx25840_write4(client, DIF_BPF_COEFF3233, 0x10360000);
4186 cx25840_write4(client, DIF_BPF_COEFF3435, 0xef290000);
4187 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4188 break;
4189
4190 case 12600000:
4191 cx25840_write4(client, DIF_BPF_COEFF01, 0x00010001);
4192 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff8fff9);
4193 cx25840_write4(client, DIF_BPF_COEFF45, 0x001f0015);
4194 cx25840_write4(client, DIF_BPF_COEFF67, 0xffafffd3);
4195 cx25840_write4(client, DIF_BPF_COEFF89, 0x00a80050);
4196 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfed3ff82);
4197 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01e900b4);
4198 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd20ff12);
4199 cx25840_write4(client, DIF_BPF_COEFF1617, 0x04130128);
4200 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa82fea4);
4201 cx25840_write4(client, DIF_BPF_COEFF2021, 0x07150183);
4202 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf734fe68);
4203 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0a8d0197);
4204 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf3bdfe84);
4205 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0dd50148);
4206 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf0d5ff03);
4207 cx25840_write4(client, DIF_BPF_COEFF3233, 0x103100a0);
4208 cx25840_write4(client, DIF_BPF_COEFF3435, 0xef2bffc9);
4209 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4210 break;
4211
4212 case 12700000:
4213 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000002);
4214 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffafff2);
4215 cx25840_write4(client, DIF_BPF_COEFF45, 0x00170027);
4216 cx25840_write4(client, DIF_BPF_COEFF67, 0xffc1ffab);
4217 cx25840_write4(client, DIF_BPF_COEFF89, 0x00880098);
4218 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff04ff10);
4219 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01a60159);
4220 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd75fe34);
4221 cx25840_write4(client, DIF_BPF_COEFF1617, 0x03b00240);
4222 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfaeffd58);
4223 cx25840_write4(client, DIF_BPF_COEFF2021, 0x06a702f9);
4224 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf79dfcda);
4225 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0a310326);
4226 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf407fd0d);
4227 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0d9f028e);
4228 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf0f6fe06);
4229 cx25840_write4(client, DIF_BPF_COEFF3233, 0x10210140);
4230 cx25840_write4(client, DIF_BPF_COEFF3435, 0xef2fff93);
4231 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4232 break;
4233
4234 case 12800000:
4235 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
4236 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffeffef);
4237 cx25840_write4(client, DIF_BPF_COEFF45, 0x000c0034);
4238 cx25840_write4(client, DIF_BPF_COEFF67, 0xffdbff8f);
4239 cx25840_write4(client, DIF_BPF_COEFF89, 0x005800ce);
4240 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff4ffeb6);
4241 cx25840_write4(client, DIF_BPF_COEFF1213, 0x013c01e1);
4242 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfdfbfd76);
4243 cx25840_write4(client, DIF_BPF_COEFF1617, 0x03110337);
4244 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfb9dfc2a);
4245 cx25840_write4(client, DIF_BPF_COEFF2021, 0x05f40453);
4246 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf848fb63);
4247 cx25840_write4(client, DIF_BPF_COEFF2425, 0x099904a5);
4248 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf482fb9f);
4249 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0d4603ce);
4250 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf12dfd0c);
4251 cx25840_write4(client, DIF_BPF_COEFF3233, 0x100701df);
4252 cx25840_write4(client, DIF_BPF_COEFF3435, 0xef36ff5c);
4253 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4254 break;
4255
4256 case 12900000:
4257 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
4258 cx25840_write4(client, DIF_BPF_COEFF23, 0x0001ffee);
4259 cx25840_write4(client, DIF_BPF_COEFF45, 0xffff0038);
4260 cx25840_write4(client, DIF_BPF_COEFF67, 0xfffbff82);
4261 cx25840_write4(client, DIF_BPF_COEFF89, 0x001d00ec);
4262 cx25840_write4(client, DIF_BPF_COEFF1011, 0xffadfe7c);
4263 cx25840_write4(client, DIF_BPF_COEFF1213, 0x00b70242);
4264 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfea9fce5);
4265 cx25840_write4(client, DIF_BPF_COEFF1617, 0x024103ff);
4266 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfc85fb2a);
4267 cx25840_write4(client, DIF_BPF_COEFF2021, 0x05040587);
4268 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf930fa0a);
4269 cx25840_write4(client, DIF_BPF_COEFF2425, 0x08ca060e);
4270 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf52bfa40);
4271 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0ccb0507);
4272 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf179fc15);
4273 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0fe3027d);
4274 cx25840_write4(client, DIF_BPF_COEFF3435, 0xef3fff25);
4275 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4276 break;
4277
4278 case 13000000:
4279 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000002);
4280 cx25840_write4(client, DIF_BPF_COEFF23, 0x0005fff0);
4281 cx25840_write4(client, DIF_BPF_COEFF45, 0xfff20034);
4282 cx25840_write4(client, DIF_BPF_COEFF67, 0x001bff85);
4283 cx25840_write4(client, DIF_BPF_COEFF89, 0xffdf00f0);
4284 cx25840_write4(client, DIF_BPF_COEFF1011, 0x0014fe68);
4285 cx25840_write4(client, DIF_BPF_COEFF1213, 0x00200272);
4286 cx25840_write4(client, DIF_BPF_COEFF1415, 0xff71fc8b);
4287 cx25840_write4(client, DIF_BPF_COEFF1617, 0x014d048d);
4288 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfd9afa61);
4289 cx25840_write4(client, DIF_BPF_COEFF2021, 0x03e00688);
4290 cx25840_write4(client, DIF_BPF_COEFF2223, 0xfa4ef8da);
4291 cx25840_write4(client, DIF_BPF_COEFF2425, 0x07c80759);
4292 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf600f8f4);
4293 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0c2f0637);
4294 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf1dbfb22);
4295 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0fb4031b);
4296 cx25840_write4(client, DIF_BPF_COEFF3435, 0xef4bfeef);
4297 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4298 break;
4299
4300 case 13100000:
4301 cx25840_write4(client, DIF_BPF_COEFF01, 0xffff0001);
4302 cx25840_write4(client, DIF_BPF_COEFF23, 0x0007fff5);
4303 cx25840_write4(client, DIF_BPF_COEFF45, 0xffe70028);
4304 cx25840_write4(client, DIF_BPF_COEFF67, 0x0037ff98);
4305 cx25840_write4(client, DIF_BPF_COEFF89, 0xffa400d8);
4306 cx25840_write4(client, DIF_BPF_COEFF1011, 0x0079fe7c);
4307 cx25840_write4(client, DIF_BPF_COEFF1213, 0xff87026f);
4308 cx25840_write4(client, DIF_BPF_COEFF1415, 0x0043fc6e);
4309 cx25840_write4(client, DIF_BPF_COEFF1617, 0x004404da);
4310 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfecef9da);
4311 cx25840_write4(client, DIF_BPF_COEFF2021, 0x0294074e);
4312 cx25840_write4(client, DIF_BPF_COEFF2223, 0xfb99f7db);
4313 cx25840_write4(client, DIF_BPF_COEFF2425, 0x06980881);
4314 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf6fef7be);
4315 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0b730759);
4316 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf251fa33);
4317 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0f7b03b8);
4318 cx25840_write4(client, DIF_BPF_COEFF3435, 0xef5afeb8);
4319 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4320 break;
4321
4322 case 13200000:
4323 cx25840_write4(client, DIF_BPF_COEFF01, 0xffff0000);
4324 cx25840_write4(client, DIF_BPF_COEFF23, 0x0008fffc);
4325 cx25840_write4(client, DIF_BPF_COEFF45, 0xffe00017);
4326 cx25840_write4(client, DIF_BPF_COEFF67, 0x004cffb9);
4327 cx25840_write4(client, DIF_BPF_COEFF89, 0xff7500a8);
4328 cx25840_write4(client, DIF_BPF_COEFF1011, 0x00d1feb6);
4329 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfef90238);
4330 cx25840_write4(client, DIF_BPF_COEFF1415, 0x0111fc91);
4331 cx25840_write4(client, DIF_BPF_COEFF1617, 0xff3604df);
4332 cx25840_write4(client, DIF_BPF_COEFF1819, 0x0012f99b);
4333 cx25840_write4(client, DIF_BPF_COEFF2021, 0x012d07d2);
4334 cx25840_write4(client, DIF_BPF_COEFF2223, 0xfd07f714);
4335 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0542097e);
4336 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf81ff6a4);
4337 cx25840_write4(client, DIF_BPF_COEFF2829, 0x0a9a086e);
4338 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf2dbf94b);
4339 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0f380453);
4340 cx25840_write4(client, DIF_BPF_COEFF3435, 0xef6cfe82);
4341 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4342 break;
4343
4344 case 13300000:
4345 cx25840_write4(client, DIF_BPF_COEFF01, 0xffffffff);
4346 cx25840_write4(client, DIF_BPF_COEFF23, 0x00080003);
4347 cx25840_write4(client, DIF_BPF_COEFF45, 0xffde0001);
4348 cx25840_write4(client, DIF_BPF_COEFF67, 0x0056ffe3);
4349 cx25840_write4(client, DIF_BPF_COEFF89, 0xff570064);
4350 cx25840_write4(client, DIF_BPF_COEFF1011, 0x0113ff10);
4351 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe8201d2);
4352 cx25840_write4(client, DIF_BPF_COEFF1415, 0x01cafcf0);
4353 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfe35049e);
4354 cx25840_write4(client, DIF_BPF_COEFF1819, 0x0155f9a6);
4355 cx25840_write4(client, DIF_BPF_COEFF2021, 0xffba080e);
4356 cx25840_write4(client, DIF_BPF_COEFF2223, 0xfe8cf689);
4357 cx25840_write4(client, DIF_BPF_COEFF2425, 0x03ce0a4e);
4358 cx25840_write4(client, DIF_BPF_COEFF2627, 0xf961f5a8);
4359 cx25840_write4(client, DIF_BPF_COEFF2829, 0x09a50971);
4360 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf379f869);
4361 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0eeb04ec);
4362 cx25840_write4(client, DIF_BPF_COEFF3435, 0xef80fe4b);
4363 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4364 break;
4365
4366 case 13400000:
4367 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffe);
4368 cx25840_write4(client, DIF_BPF_COEFF23, 0x0007000a);
4369 cx25840_write4(client, DIF_BPF_COEFF45, 0xffe2ffec);
4370 cx25840_write4(client, DIF_BPF_COEFF67, 0x00540012);
4371 cx25840_write4(client, DIF_BPF_COEFF89, 0xff4e0015);
4372 cx25840_write4(client, DIF_BPF_COEFF1011, 0x0137ff82);
4373 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe2e0145);
4374 cx25840_write4(client, DIF_BPF_COEFF1415, 0x0260fd86);
4375 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfd51041a);
4376 cx25840_write4(client, DIF_BPF_COEFF1819, 0x0287f9fb);
4377 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfe4a0802);
4378 cx25840_write4(client, DIF_BPF_COEFF2223, 0x001df63f);
4379 cx25840_write4(client, DIF_BPF_COEFF2425, 0x02430aeb);
4380 cx25840_write4(client, DIF_BPF_COEFF2627, 0xfabdf4ce);
4381 cx25840_write4(client, DIF_BPF_COEFF2829, 0x08970a62);
4382 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf428f78f);
4383 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0e950584);
4384 cx25840_write4(client, DIF_BPF_COEFF3435, 0xef97fe15);
4385 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4386 break;
4387
4388 case 13500000:
4389 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
4390 cx25840_write4(client, DIF_BPF_COEFF23, 0x0004000f);
4391 cx25840_write4(client, DIF_BPF_COEFF45, 0xffeaffda);
4392 cx25840_write4(client, DIF_BPF_COEFF67, 0x0046003d);
4393 cx25840_write4(client, DIF_BPF_COEFF89, 0xff5affc4);
4394 cx25840_write4(client, DIF_BPF_COEFF1011, 0x013b0000);
4395 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe04009d);
4396 cx25840_write4(client, DIF_BPF_COEFF1415, 0x02c8fe48);
4397 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc99035a);
4398 cx25840_write4(client, DIF_BPF_COEFF1819, 0x0397fa96);
4399 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfcec07ad);
4400 cx25840_write4(client, DIF_BPF_COEFF2223, 0x01adf637);
4401 cx25840_write4(client, DIF_BPF_COEFF2425, 0x00ac0b53);
4402 cx25840_write4(client, DIF_BPF_COEFF2627, 0xfc2ef419);
4403 cx25840_write4(client, DIF_BPF_COEFF2829, 0x07730b3e);
4404 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf4e9f6bd);
4405 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0e35061a);
4406 cx25840_write4(client, DIF_BPF_COEFF3435, 0xefb1fddf);
4407 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4408 break;
4409
4410 case 13600000:
4411 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
4412 cx25840_write4(client, DIF_BPF_COEFF23, 0x00000012);
4413 cx25840_write4(client, DIF_BPF_COEFF45, 0xfff6ffcd);
4414 cx25840_write4(client, DIF_BPF_COEFF67, 0x002f0061);
4415 cx25840_write4(client, DIF_BPF_COEFF89, 0xff7bff79);
4416 cx25840_write4(client, DIF_BPF_COEFF1011, 0x011e007e);
4417 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe08ffe8);
4418 cx25840_write4(client, DIF_BPF_COEFF1415, 0x02f9ff28);
4419 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc17026a);
4420 cx25840_write4(client, DIF_BPF_COEFF1819, 0x0479fb70);
4421 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfbad0713);
4422 cx25840_write4(client, DIF_BPF_COEFF2223, 0x032ff672);
4423 cx25840_write4(client, DIF_BPF_COEFF2425, 0xff100b83);
4424 cx25840_write4(client, DIF_BPF_COEFF2627, 0xfdaff38b);
4425 cx25840_write4(client, DIF_BPF_COEFF2829, 0x063c0c04);
4426 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf5baf5f5);
4427 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0dcc06ae);
4428 cx25840_write4(client, DIF_BPF_COEFF3435, 0xefcdfda8);
4429 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4430 break;
4431
4432 case 13700000:
4433 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
4434 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffd0012);
4435 cx25840_write4(client, DIF_BPF_COEFF45, 0x0004ffc8);
4436 cx25840_write4(client, DIF_BPF_COEFF67, 0x00100078);
4437 cx25840_write4(client, DIF_BPF_COEFF89, 0xffacff3e);
4438 cx25840_write4(client, DIF_BPF_COEFF1011, 0x00e200f0);
4439 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe39ff35);
4440 cx25840_write4(client, DIF_BPF_COEFF1415, 0x02f10017);
4441 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfbd30156);
4442 cx25840_write4(client, DIF_BPF_COEFF1819, 0x0521fc7f);
4443 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfa9c0638);
4444 cx25840_write4(client, DIF_BPF_COEFF2223, 0x0499f6ee);
4445 cx25840_write4(client, DIF_BPF_COEFF2425, 0xfd7a0b7c);
4446 cx25840_write4(client, DIF_BPF_COEFF2627, 0xff39f325);
4447 cx25840_write4(client, DIF_BPF_COEFF2829, 0x04f40cb3);
4448 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf69af537);
4449 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0d5a073f);
4450 cx25840_write4(client, DIF_BPF_COEFF3435, 0xefecfd72);
4451 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4452 break;
4453
4454 case 13800000:
4455 cx25840_write4(client, DIF_BPF_COEFF01, 0x0001fffe);
4456 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffa000e);
4457 cx25840_write4(client, DIF_BPF_COEFF45, 0x0011ffcb);
4458 cx25840_write4(client, DIF_BPF_COEFF67, 0xfff0007f);
4459 cx25840_write4(client, DIF_BPF_COEFF89, 0xffe7ff19);
4460 cx25840_write4(client, DIF_BPF_COEFF1011, 0x008f014a);
4461 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe94fe93);
4462 cx25840_write4(client, DIF_BPF_COEFF1415, 0x02b00105);
4463 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfbd3002f);
4464 cx25840_write4(client, DIF_BPF_COEFF1819, 0x0585fdb7);
4465 cx25840_write4(client, DIF_BPF_COEFF2021, 0xf9c10525);
4466 cx25840_write4(client, DIF_BPF_COEFF2223, 0x05def7a8);
4467 cx25840_write4(client, DIF_BPF_COEFF2425, 0xfbf20b3c);
4468 cx25840_write4(client, DIF_BPF_COEFF2627, 0x00c7f2e9);
4469 cx25840_write4(client, DIF_BPF_COEFF2829, 0x03a00d48);
4470 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf787f484);
4471 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0cdf07cd);
4472 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf00dfd3c);
4473 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4474 break;
4475
4476 case 13900000:
4477 cx25840_write4(client, DIF_BPF_COEFF01, 0x00010000);
4478 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff80008);
4479 cx25840_write4(client, DIF_BPF_COEFF45, 0x001bffd7);
4480 cx25840_write4(client, DIF_BPF_COEFF67, 0xffd10076);
4481 cx25840_write4(client, DIF_BPF_COEFF89, 0x0026ff0e);
4482 cx25840_write4(client, DIF_BPF_COEFF1011, 0x002c0184);
4483 cx25840_write4(client, DIF_BPF_COEFF1213, 0xff0ffe10);
4484 cx25840_write4(client, DIF_BPF_COEFF1415, 0x023b01e0);
4485 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc17ff06);
4486 cx25840_write4(client, DIF_BPF_COEFF1819, 0x05a2ff09);
4487 cx25840_write4(client, DIF_BPF_COEFF2021, 0xf92703e4);
4488 cx25840_write4(client, DIF_BPF_COEFF2223, 0x06f4f89b);
4489 cx25840_write4(client, DIF_BPF_COEFF2425, 0xfa820ac5);
4490 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0251f2d9);
4491 cx25840_write4(client, DIF_BPF_COEFF2829, 0x02430dc3);
4492 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf881f3dc);
4493 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0c5c0859);
4494 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf031fd06);
4495 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4496 break;
4497
4498 case 14000000:
4499 cx25840_write4(client, DIF_BPF_COEFF01, 0x00010001);
4500 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff80001);
4501 cx25840_write4(client, DIF_BPF_COEFF45, 0x0021ffe8);
4502 cx25840_write4(client, DIF_BPF_COEFF67, 0xffba005d);
4503 cx25840_write4(client, DIF_BPF_COEFF89, 0x0060ff1f);
4504 cx25840_write4(client, DIF_BPF_COEFF1011, 0xffc40198);
4505 cx25840_write4(client, DIF_BPF_COEFF1213, 0xffa0fdb5);
4506 cx25840_write4(client, DIF_BPF_COEFF1415, 0x019a029a);
4507 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc99fdea);
4508 cx25840_write4(client, DIF_BPF_COEFF1819, 0x05750067);
4509 cx25840_write4(client, DIF_BPF_COEFF2021, 0xf8d4027f);
4510 cx25840_write4(client, DIF_BPF_COEFF2223, 0x07d4f9c0);
4511 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf9320a1a);
4512 cx25840_write4(client, DIF_BPF_COEFF2627, 0x03d2f2f3);
4513 cx25840_write4(client, DIF_BPF_COEFF2829, 0x00df0e22);
4514 cx25840_write4(client, DIF_BPF_COEFF3031, 0xf986f341);
4515 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0bd108e2);
4516 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf058fcd1);
4517 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4518 break;
4519
4520 case 14100000:
4521 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000002);
4522 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff9fffa);
4523 cx25840_write4(client, DIF_BPF_COEFF45, 0x0021fffd);
4524 cx25840_write4(client, DIF_BPF_COEFF67, 0xffac0038);
4525 cx25840_write4(client, DIF_BPF_COEFF89, 0x008eff4a);
4526 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff630184);
4527 cx25840_write4(client, DIF_BPF_COEFF1213, 0x003afd8b);
4528 cx25840_write4(client, DIF_BPF_COEFF1415, 0x00da0326);
4529 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfd51fced);
4530 cx25840_write4(client, DIF_BPF_COEFF1819, 0x050101c0);
4531 cx25840_write4(client, DIF_BPF_COEFF2021, 0xf8cb0103);
4532 cx25840_write4(client, DIF_BPF_COEFF2223, 0x0876fb10);
4533 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf80a093e);
4534 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0543f338);
4535 cx25840_write4(client, DIF_BPF_COEFF2829, 0xff7a0e66);
4536 cx25840_write4(client, DIF_BPF_COEFF3031, 0xfa94f2b2);
4537 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0b3f0967);
4538 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf081fc9b);
4539 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4540 break;
4541
4542 case 14200000:
4543 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
4544 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffbfff3);
4545 cx25840_write4(client, DIF_BPF_COEFF45, 0x001d0013);
4546 cx25840_write4(client, DIF_BPF_COEFF67, 0xffaa000b);
4547 cx25840_write4(client, DIF_BPF_COEFF89, 0x00aaff89);
4548 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff13014a);
4549 cx25840_write4(client, DIF_BPF_COEFF1213, 0x00cefd95);
4550 cx25840_write4(client, DIF_BPF_COEFF1415, 0x000a037b);
4551 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfe35fc1d);
4552 cx25840_write4(client, DIF_BPF_COEFF1819, 0x044c0305);
4553 cx25840_write4(client, DIF_BPF_COEFF2021, 0xf90cff7e);
4554 cx25840_write4(client, DIF_BPF_COEFF2223, 0x08d5fc81);
4555 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf7100834);
4556 cx25840_write4(client, DIF_BPF_COEFF2627, 0x069ff3a7);
4557 cx25840_write4(client, DIF_BPF_COEFF2829, 0xfe160e8d);
4558 cx25840_write4(client, DIF_BPF_COEFF3031, 0xfbaaf231);
4559 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0aa509e9);
4560 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf0adfc65);
4561 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4562 break;
4563
4564 case 14300000:
4565 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
4566 cx25840_write4(client, DIF_BPF_COEFF23, 0xffffffef);
4567 cx25840_write4(client, DIF_BPF_COEFF45, 0x00140025);
4568 cx25840_write4(client, DIF_BPF_COEFF67, 0xffb4ffdd);
4569 cx25840_write4(client, DIF_BPF_COEFF89, 0x00b2ffd6);
4570 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfedb00f0);
4571 cx25840_write4(client, DIF_BPF_COEFF1213, 0x0150fdd3);
4572 cx25840_write4(client, DIF_BPF_COEFF1415, 0xff380391);
4573 cx25840_write4(client, DIF_BPF_COEFF1617, 0xff36fb85);
4574 cx25840_write4(client, DIF_BPF_COEFF1819, 0x035e0426);
4575 cx25840_write4(client, DIF_BPF_COEFF2021, 0xf994fdfe);
4576 cx25840_write4(client, DIF_BPF_COEFF2223, 0x08eefe0b);
4577 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf6490702);
4578 cx25840_write4(client, DIF_BPF_COEFF2627, 0x07e1f43e);
4579 cx25840_write4(client, DIF_BPF_COEFF2829, 0xfcb60e97);
4580 cx25840_write4(client, DIF_BPF_COEFF3031, 0xfcc6f1be);
4581 cx25840_write4(client, DIF_BPF_COEFF3233, 0x0a040a67);
4582 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf0dbfc30);
4583 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4584 break;
4585
4586 case 14400000:
4587 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
4588 cx25840_write4(client, DIF_BPF_COEFF23, 0x0002ffee);
4589 cx25840_write4(client, DIF_BPF_COEFF45, 0x00070033);
4590 cx25840_write4(client, DIF_BPF_COEFF67, 0xffc9ffb4);
4591 cx25840_write4(client, DIF_BPF_COEFF89, 0x00a40027);
4592 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfec3007e);
4593 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01b4fe3f);
4594 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfe760369);
4595 cx25840_write4(client, DIF_BPF_COEFF1617, 0x0044fb2e);
4596 cx25840_write4(client, DIF_BPF_COEFF1819, 0x02450518);
4597 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfa5ffc90);
4598 cx25840_write4(client, DIF_BPF_COEFF2223, 0x08c1ffa1);
4599 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf5bc05ae);
4600 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0902f4fc);
4601 cx25840_write4(client, DIF_BPF_COEFF2829, 0xfb600e85);
4602 cx25840_write4(client, DIF_BPF_COEFF3031, 0xfde7f15a);
4603 cx25840_write4(client, DIF_BPF_COEFF3233, 0x095d0ae2);
4604 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf10cfbfb);
4605 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4606 break;
4607
4608 case 14500000:
4609 cx25840_write4(client, DIF_BPF_COEFF01, 0xffff0002);
4610 cx25840_write4(client, DIF_BPF_COEFF23, 0x0005ffef);
4611 cx25840_write4(client, DIF_BPF_COEFF45, 0xfffa0038);
4612 cx25840_write4(client, DIF_BPF_COEFF67, 0xffe5ff95);
4613 cx25840_write4(client, DIF_BPF_COEFF89, 0x00820074);
4614 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfecc0000);
4615 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01f0fed0);
4616 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfdd20304);
4617 cx25840_write4(client, DIF_BPF_COEFF1617, 0x014dfb1d);
4618 cx25840_write4(client, DIF_BPF_COEFF1819, 0x010e05ce);
4619 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfb64fb41);
4620 cx25840_write4(client, DIF_BPF_COEFF2223, 0x084e013b);
4621 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf569043e);
4622 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0a00f5dd);
4623 cx25840_write4(client, DIF_BPF_COEFF2829, 0xfa150e55);
4624 cx25840_write4(client, DIF_BPF_COEFF3031, 0xff0bf104);
4625 cx25840_write4(client, DIF_BPF_COEFF3233, 0x08b00b59);
4626 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf13ffbc6);
4627 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4628 break;
4629
4630 case 14600000:
4631 cx25840_write4(client, DIF_BPF_COEFF01, 0xffff0001);
4632 cx25840_write4(client, DIF_BPF_COEFF23, 0x0008fff4);
4633 cx25840_write4(client, DIF_BPF_COEFF45, 0xffed0035);
4634 cx25840_write4(client, DIF_BPF_COEFF67, 0x0005ff83);
4635 cx25840_write4(client, DIF_BPF_COEFF89, 0x005000b4);
4636 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfef6ff82);
4637 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01ffff7a);
4638 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd580269);
4639 cx25840_write4(client, DIF_BPF_COEFF1617, 0x0241fb53);
4640 cx25840_write4(client, DIF_BPF_COEFF1819, 0xffca0640);
4641 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfc99fa1e);
4642 cx25840_write4(client, DIF_BPF_COEFF2223, 0x079a02cb);
4643 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf55502ba);
4644 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0ad5f6e0);
4645 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf8d90e0a);
4646 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0031f0bd);
4647 cx25840_write4(client, DIF_BPF_COEFF3233, 0x07fd0bcb);
4648 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf174fb91);
4649 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4650 break;
4651
4652 case 14700000:
4653 cx25840_write4(client, DIF_BPF_COEFF01, 0xffffffff);
4654 cx25840_write4(client, DIF_BPF_COEFF23, 0x0009fffb);
4655 cx25840_write4(client, DIF_BPF_COEFF45, 0xffe4002a);
4656 cx25840_write4(client, DIF_BPF_COEFF67, 0x0025ff82);
4657 cx25840_write4(client, DIF_BPF_COEFF89, 0x001400e0);
4658 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff3cff10);
4659 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01e10030);
4660 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd1201a4);
4661 cx25840_write4(client, DIF_BPF_COEFF1617, 0x0311fbcd);
4662 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfe88066a);
4663 cx25840_write4(client, DIF_BPF_COEFF2021, 0xfdf1f92f);
4664 cx25840_write4(client, DIF_BPF_COEFF2223, 0x06aa0449);
4665 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf57e0128);
4666 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0b7ef801);
4667 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf7b00da2);
4668 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0156f086);
4669 cx25840_write4(client, DIF_BPF_COEFF3233, 0x07450c39);
4670 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf1acfb5c);
4671 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4672 break;
4673
4674 case 14800000:
4675 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffe);
4676 cx25840_write4(client, DIF_BPF_COEFF23, 0x00080002);
4677 cx25840_write4(client, DIF_BPF_COEFF45, 0xffdf0019);
4678 cx25840_write4(client, DIF_BPF_COEFF67, 0x003fff92);
4679 cx25840_write4(client, DIF_BPF_COEFF89, 0xffd600f1);
4680 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff96feb6);
4681 cx25840_write4(client, DIF_BPF_COEFF1213, 0x019700e1);
4682 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd0500c2);
4683 cx25840_write4(client, DIF_BPF_COEFF1617, 0x03b0fc84);
4684 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfd590649);
4685 cx25840_write4(client, DIF_BPF_COEFF2021, 0xff5df87f);
4686 cx25840_write4(client, DIF_BPF_COEFF2223, 0x058505aa);
4687 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf5e4ff91);
4688 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0bf9f93c);
4689 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf69d0d20);
4690 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0279f05e);
4691 cx25840_write4(client, DIF_BPF_COEFF3233, 0x06880ca3);
4692 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf1e6fb28);
4693 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4694 break;
4695
4696 case 14900000:
4697 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
4698 cx25840_write4(client, DIF_BPF_COEFF23, 0x00060009);
4699 cx25840_write4(client, DIF_BPF_COEFF45, 0xffdf0004);
4700 cx25840_write4(client, DIF_BPF_COEFF67, 0x0051ffb0);
4701 cx25840_write4(client, DIF_BPF_COEFF89, 0xff9d00e8);
4702 cx25840_write4(client, DIF_BPF_COEFF1011, 0xfffcfe7c);
4703 cx25840_write4(client, DIF_BPF_COEFF1213, 0x01280180);
4704 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd32ffd2);
4705 cx25840_write4(client, DIF_BPF_COEFF1617, 0x0413fd6e);
4706 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfc4d05df);
4707 cx25840_write4(client, DIF_BPF_COEFF2021, 0x00d1f812);
4708 cx25840_write4(client, DIF_BPF_COEFF2223, 0x043506e4);
4709 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf685fdfb);
4710 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0c43fa8d);
4711 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf5a10c83);
4712 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0399f046);
4713 cx25840_write4(client, DIF_BPF_COEFF3233, 0x05c70d08);
4714 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf222faf3);
4715 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4716 break;
4717
4718 case 15000000:
4719 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
4720 cx25840_write4(client, DIF_BPF_COEFF23, 0x0003000f);
4721 cx25840_write4(client, DIF_BPF_COEFF45, 0xffe5ffef);
4722 cx25840_write4(client, DIF_BPF_COEFF67, 0x0057ffd9);
4723 cx25840_write4(client, DIF_BPF_COEFF89, 0xff7000c4);
4724 cx25840_write4(client, DIF_BPF_COEFF1011, 0x0062fe68);
4725 cx25840_write4(client, DIF_BPF_COEFF1213, 0x009e01ff);
4726 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfd95fee6);
4727 cx25840_write4(client, DIF_BPF_COEFF1617, 0x0435fe7d);
4728 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfb710530);
4729 cx25840_write4(client, DIF_BPF_COEFF2021, 0x023cf7ee);
4730 cx25840_write4(client, DIF_BPF_COEFF2223, 0x02c307ef);
4731 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf75efc70);
4732 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0c5cfbef);
4733 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf4c10bce);
4734 cx25840_write4(client, DIF_BPF_COEFF3031, 0x04b3f03f);
4735 cx25840_write4(client, DIF_BPF_COEFF3233, 0x05030d69);
4736 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf261fabf);
4737 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4738 break;
4739
4740 case 15100000:
4741 cx25840_write4(client, DIF_BPF_COEFF01, 0x0000fffd);
4742 cx25840_write4(client, DIF_BPF_COEFF23, 0xffff0012);
4743 cx25840_write4(client, DIF_BPF_COEFF45, 0xffefffdc);
4744 cx25840_write4(client, DIF_BPF_COEFF67, 0x00510006);
4745 cx25840_write4(client, DIF_BPF_COEFF89, 0xff540089);
4746 cx25840_write4(client, DIF_BPF_COEFF1011, 0x00befe7c);
4747 cx25840_write4(client, DIF_BPF_COEFF1213, 0x00060253);
4748 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfe27fe0d);
4749 cx25840_write4(client, DIF_BPF_COEFF1617, 0x0413ffa2);
4750 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfad10446);
4751 cx25840_write4(client, DIF_BPF_COEFF2021, 0x0390f812);
4752 cx25840_write4(client, DIF_BPF_COEFF2223, 0x013b08c3);
4753 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf868faf6);
4754 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0c43fd5f);
4755 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf3fd0b02);
4756 cx25840_write4(client, DIF_BPF_COEFF3031, 0x05c7f046);
4757 cx25840_write4(client, DIF_BPF_COEFF3233, 0x043b0dc4);
4758 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf2a1fa8b);
4759 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4760 break;
4761
4762 case 15200000:
4763 cx25840_write4(client, DIF_BPF_COEFF01, 0x0001fffe);
4764 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffc0012);
4765 cx25840_write4(client, DIF_BPF_COEFF45, 0xfffbffce);
4766 cx25840_write4(client, DIF_BPF_COEFF67, 0x003f0033);
4767 cx25840_write4(client, DIF_BPF_COEFF89, 0xff4e003f);
4768 cx25840_write4(client, DIF_BPF_COEFF1011, 0x0106feb6);
4769 cx25840_write4(client, DIF_BPF_COEFF1213, 0xff6e0276);
4770 cx25840_write4(client, DIF_BPF_COEFF1415, 0xfeddfd56);
4771 cx25840_write4(client, DIF_BPF_COEFF1617, 0x03b000cc);
4772 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa740329);
4773 cx25840_write4(client, DIF_BPF_COEFF2021, 0x04bff87f);
4774 cx25840_write4(client, DIF_BPF_COEFF2223, 0xffaa095d);
4775 cx25840_write4(client, DIF_BPF_COEFF2425, 0xf99ef995);
4776 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0bf9fed8);
4777 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf3590a1f);
4778 cx25840_write4(client, DIF_BPF_COEFF3031, 0x06d2f05e);
4779 cx25840_write4(client, DIF_BPF_COEFF3233, 0x03700e1b);
4780 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf2e4fa58);
4781 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4782 break;
4783
4784 case 15300000:
4785 cx25840_write4(client, DIF_BPF_COEFF01, 0x0001ffff);
4786 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff9000f);
4787 cx25840_write4(client, DIF_BPF_COEFF45, 0x0009ffc8);
4788 cx25840_write4(client, DIF_BPF_COEFF67, 0x00250059);
4789 cx25840_write4(client, DIF_BPF_COEFF89, 0xff5effee);
4790 cx25840_write4(client, DIF_BPF_COEFF1011, 0x0132ff10);
4791 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfee30265);
4792 cx25840_write4(client, DIF_BPF_COEFF1415, 0xffaafccf);
4793 cx25840_write4(client, DIF_BPF_COEFF1617, 0x031101eb);
4794 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa6001e8);
4795 cx25840_write4(client, DIF_BPF_COEFF2021, 0x05bdf92f);
4796 cx25840_write4(client, DIF_BPF_COEFF2223, 0xfe1b09b6);
4797 cx25840_write4(client, DIF_BPF_COEFF2425, 0xfafaf852);
4798 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0b7e0055);
4799 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf2d50929);
4800 cx25840_write4(client, DIF_BPF_COEFF3031, 0x07d3f086);
4801 cx25840_write4(client, DIF_BPF_COEFF3233, 0x02a30e6c);
4802 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf329fa24);
4803 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4804 break;
4805
4806 case 15400000:
4807 cx25840_write4(client, DIF_BPF_COEFF01, 0x00010001);
4808 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff80009);
4809 cx25840_write4(client, DIF_BPF_COEFF45, 0x0015ffca);
4810 cx25840_write4(client, DIF_BPF_COEFF67, 0x00050074);
4811 cx25840_write4(client, DIF_BPF_COEFF89, 0xff81ff9f);
4812 cx25840_write4(client, DIF_BPF_COEFF1011, 0x013dff82);
4813 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe710221);
4814 cx25840_write4(client, DIF_BPF_COEFF1415, 0x007cfc80);
4815 cx25840_write4(client, DIF_BPF_COEFF1617, 0x024102ed);
4816 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfa940090);
4817 cx25840_write4(client, DIF_BPF_COEFF2021, 0x0680fa1e);
4818 cx25840_write4(client, DIF_BPF_COEFF2223, 0xfc9b09cd);
4819 cx25840_write4(client, DIF_BPF_COEFF2425, 0xfc73f736);
4820 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0ad501d0);
4821 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf2740820);
4822 cx25840_write4(client, DIF_BPF_COEFF3031, 0x08c9f0bd);
4823 cx25840_write4(client, DIF_BPF_COEFF3233, 0x01d40eb9);
4824 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf371f9f1);
4825 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4826 break;
4827
4828 case 15500000:
4829 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000002);
4830 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff80002);
4831 cx25840_write4(client, DIF_BPF_COEFF45, 0x001effd5);
4832 cx25840_write4(client, DIF_BPF_COEFF67, 0xffe5007f);
4833 cx25840_write4(client, DIF_BPF_COEFF89, 0xffb4ff5b);
4834 cx25840_write4(client, DIF_BPF_COEFF1011, 0x01280000);
4835 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe2401b0);
4836 cx25840_write4(client, DIF_BPF_COEFF1415, 0x0146fc70);
4837 cx25840_write4(client, DIF_BPF_COEFF1617, 0x014d03c6);
4838 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfb10ff32);
4839 cx25840_write4(client, DIF_BPF_COEFF2021, 0x0701fb41);
4840 cx25840_write4(client, DIF_BPF_COEFF2223, 0xfb3709a1);
4841 cx25840_write4(client, DIF_BPF_COEFF2425, 0xfe00f644);
4842 cx25840_write4(client, DIF_BPF_COEFF2627, 0x0a000345);
4843 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf2350708);
4844 cx25840_write4(client, DIF_BPF_COEFF3031, 0x09b2f104);
4845 cx25840_write4(client, DIF_BPF_COEFF3233, 0x01050eff);
4846 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf3baf9be);
4847 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4848 break;
4849
4850 case 15600000:
4851 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
4852 cx25840_write4(client, DIF_BPF_COEFF23, 0xfff9fffb);
4853 cx25840_write4(client, DIF_BPF_COEFF45, 0x0022ffe6);
4854 cx25840_write4(client, DIF_BPF_COEFF67, 0xffc9007a);
4855 cx25840_write4(client, DIF_BPF_COEFF89, 0xfff0ff29);
4856 cx25840_write4(client, DIF_BPF_COEFF1011, 0x00f2007e);
4857 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe01011b);
4858 cx25840_write4(client, DIF_BPF_COEFF1415, 0x01f6fc9e);
4859 cx25840_write4(client, DIF_BPF_COEFF1617, 0x00440467);
4860 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfbccfdde);
4861 cx25840_write4(client, DIF_BPF_COEFF2021, 0x0738fc90);
4862 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf9f70934);
4863 cx25840_write4(client, DIF_BPF_COEFF2425, 0xff99f582);
4864 cx25840_write4(client, DIF_BPF_COEFF2627, 0x090204b0);
4865 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf21a05e1);
4866 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0a8df15a);
4867 cx25840_write4(client, DIF_BPF_COEFF3233, 0x00340f41);
4868 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf405f98b);
4869 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4870 break;
4871
4872 case 15700000:
4873 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
4874 cx25840_write4(client, DIF_BPF_COEFF23, 0xfffcfff4);
4875 cx25840_write4(client, DIF_BPF_COEFF45, 0x0020fffa);
4876 cx25840_write4(client, DIF_BPF_COEFF67, 0xffb40064);
4877 cx25840_write4(client, DIF_BPF_COEFF89, 0x002fff11);
4878 cx25840_write4(client, DIF_BPF_COEFF1011, 0x00a400f0);
4879 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe0d006e);
4880 cx25840_write4(client, DIF_BPF_COEFF1415, 0x0281fd09);
4881 cx25840_write4(client, DIF_BPF_COEFF1617, 0xff3604c9);
4882 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfcbffca2);
4883 cx25840_write4(client, DIF_BPF_COEFF2021, 0x0726fdfe);
4884 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf8e80888);
4885 cx25840_write4(client, DIF_BPF_COEFF2425, 0x0134f4f3);
4886 cx25840_write4(client, DIF_BPF_COEFF2627, 0x07e1060c);
4887 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf22304af);
4888 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0b59f1be);
4889 cx25840_write4(client, DIF_BPF_COEFF3233, 0xff640f7d);
4890 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf452f959);
4891 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4892 break;
4893
4894 case 15800000:
4895 cx25840_write4(client, DIF_BPF_COEFF01, 0x00000003);
4896 cx25840_write4(client, DIF_BPF_COEFF23, 0x0000fff0);
4897 cx25840_write4(client, DIF_BPF_COEFF45, 0x001a0010);
4898 cx25840_write4(client, DIF_BPF_COEFF67, 0xffaa0041);
4899 cx25840_write4(client, DIF_BPF_COEFF89, 0x0067ff13);
4900 cx25840_write4(client, DIF_BPF_COEFF1011, 0x0043014a);
4901 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfe46ffb9);
4902 cx25840_write4(client, DIF_BPF_COEFF1415, 0x02dbfda8);
4903 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfe3504e5);
4904 cx25840_write4(client, DIF_BPF_COEFF1819, 0xfddcfb8d);
4905 cx25840_write4(client, DIF_BPF_COEFF2021, 0x06c9ff7e);
4906 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf81107a2);
4907 cx25840_write4(client, DIF_BPF_COEFF2425, 0x02c9f49a);
4908 cx25840_write4(client, DIF_BPF_COEFF2627, 0x069f0753);
4909 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf2500373);
4910 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0c14f231);
4911 cx25840_write4(client, DIF_BPF_COEFF3233, 0xfe930fb3);
4912 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf4a1f927);
4913 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4914 break;
4915
4916 case 15900000:
4917 cx25840_write4(client, DIF_BPF_COEFF01, 0xffff0002);
4918 cx25840_write4(client, DIF_BPF_COEFF23, 0x0003ffee);
4919 cx25840_write4(client, DIF_BPF_COEFF45, 0x000f0023);
4920 cx25840_write4(client, DIF_BPF_COEFF67, 0xffac0016);
4921 cx25840_write4(client, DIF_BPF_COEFF89, 0x0093ff31);
4922 cx25840_write4(client, DIF_BPF_COEFF1011, 0xffdc0184);
4923 cx25840_write4(client, DIF_BPF_COEFF1213, 0xfea6ff09);
4924 cx25840_write4(client, DIF_BPF_COEFF1415, 0x02fdfe70);
4925 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfd5104ba);
4926 cx25840_write4(client, DIF_BPF_COEFF1819, 0xff15faac);
4927 cx25840_write4(client, DIF_BPF_COEFF2021, 0x06270103);
4928 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf7780688);
4929 cx25840_write4(client, DIF_BPF_COEFF2425, 0x044df479);
4930 cx25840_write4(client, DIF_BPF_COEFF2627, 0x05430883);
4931 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf2a00231);
4932 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0cbef2b2);
4933 cx25840_write4(client, DIF_BPF_COEFF3233, 0xfdc40fe3);
4934 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf4f2f8f5);
4935 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4936 break;
4937
4938 case 16000000:
4939 cx25840_write4(client, DIF_BPF_COEFF01, 0xffff0001);
4940 cx25840_write4(client, DIF_BPF_COEFF23, 0x0006ffef);
4941 cx25840_write4(client, DIF_BPF_COEFF45, 0x00020031);
4942 cx25840_write4(client, DIF_BPF_COEFF67, 0xffbaffe8);
4943 cx25840_write4(client, DIF_BPF_COEFF89, 0x00adff66);
4944 cx25840_write4(client, DIF_BPF_COEFF1011, 0xff790198);
4945 cx25840_write4(client, DIF_BPF_COEFF1213, 0xff26fe6e);
4946 cx25840_write4(client, DIF_BPF_COEFF1415, 0x02e5ff55);
4947 cx25840_write4(client, DIF_BPF_COEFF1617, 0xfc99044a);
4948 cx25840_write4(client, DIF_BPF_COEFF1819, 0x005bfa09);
4949 cx25840_write4(client, DIF_BPF_COEFF2021, 0x0545027f);
4950 cx25840_write4(client, DIF_BPF_COEFF2223, 0xf7230541);
4951 cx25840_write4(client, DIF_BPF_COEFF2425, 0x05b8f490);
4952 cx25840_write4(client, DIF_BPF_COEFF2627, 0x03d20997);
4953 cx25840_write4(client, DIF_BPF_COEFF2829, 0xf31300eb);
4954 cx25840_write4(client, DIF_BPF_COEFF3031, 0x0d55f341);
4955 cx25840_write4(client, DIF_BPF_COEFF3233, 0xfcf6100e);
4956 cx25840_write4(client, DIF_BPF_COEFF3435, 0xf544f8c3);
4957 cx25840_write4(client, DIF_BPF_COEFF36, 0x110d0000);
4958 break;
4959 }
4960}
4961
ba50e7e1 4962static void cx23888_std_setup(struct i2c_client *client)
74900b47
ST
4963{
4964 struct cx25840_state *state = to_state(i2c_get_clientdata(client));
4965 v4l2_std_id std = state->std;
4966 u32 ifHz;
4967
4968 cx25840_write4(client, 0x478, 0x6628021F);
4969 cx25840_write4(client, 0x400, 0x0);
4970 cx25840_write4(client, 0x4b4, 0x20524030);
4971 cx25840_write4(client, 0x47c, 0x010a8263);
4972
bfd1bbfb 4973 if (std & V4L2_STD_525_60) {
74900b47
ST
4974 v4l_dbg(1, cx25840_debug, client, "%s() Selecting NTSC",
4975 __func__);
4976
4977 /* Horiz / vert timing */
4978 cx25840_write4(client, 0x428, 0x1e1e601a);
4979 cx25840_write4(client, 0x424, 0x5b2d007a);
4980
4981 /* DIF NTSC */
4982 cx25840_write4(client, 0x304, 0x6503bc0c);
4983 cx25840_write4(client, 0x308, 0xbd038c85);
4984 cx25840_write4(client, 0x30c, 0x1db4640a);
4985 cx25840_write4(client, 0x310, 0x00008800);
4986 cx25840_write4(client, 0x314, 0x44400400);
4987 cx25840_write4(client, 0x32c, 0x0c800800);
4988 cx25840_write4(client, 0x330, 0x27000100);
4989 cx25840_write4(client, 0x334, 0x1f296e1f);
4990 cx25840_write4(client, 0x338, 0x009f50c1);
4991 cx25840_write4(client, 0x340, 0x1befbf06);
4992 cx25840_write4(client, 0x344, 0x000035e8);
4993
4994 /* DIF I/F */
4995 ifHz = 5400000;
4996
4997 } else {
4998 v4l_dbg(1, cx25840_debug, client, "%s() Selecting PAL-BG",
4999 __func__);
5000
5001 /* Horiz / vert timing */
5002 cx25840_write4(client, 0x428, 0x28244024);
5003 cx25840_write4(client, 0x424, 0x5d2d0084);
5004
5005 /* DIF */
5006 cx25840_write4(client, 0x304, 0x6503bc0c);
5007 cx25840_write4(client, 0x308, 0xbd038c85);
5008 cx25840_write4(client, 0x30c, 0x1db4640a);
5009 cx25840_write4(client, 0x310, 0x00008800);
5010 cx25840_write4(client, 0x314, 0x44400600);
5011 cx25840_write4(client, 0x32c, 0x0c800800);
5012 cx25840_write4(client, 0x330, 0x27000100);
5013 cx25840_write4(client, 0x334, 0x213530ec);
5014 cx25840_write4(client, 0x338, 0x00a65ba8);
5015 cx25840_write4(client, 0x340, 0x1befbf06);
5016 cx25840_write4(client, 0x344, 0x000035e8);
5017
5018 /* DIF I/F */
5019 ifHz = 6000000;
5020 }
5021
5022 cx23885_dif_setup(client, ifHz);
5023
5024 /* Explicitly ensure the inputs are reconfigured after
5025 * a standard change.
5026 */
5027 set_input(client, state->vid_input, state->aud_input);
5028}
5029
5030/* ----------------------------------------------------------------------- */
5031
e34e658b
HV
5032static const struct v4l2_ctrl_ops cx25840_ctrl_ops = {
5033 .s_ctrl = cx25840_s_ctrl,
5034};
5035
9357b31c
HV
5036static const struct v4l2_subdev_core_ops cx25840_core_ops = {
5037 .log_status = cx25840_log_status,
9357b31c 5038 .reset = cx25840_reset,
cc26b076 5039 .load_fw = cx25840_load_fw,
d06d5777 5040 .s_io_pin_config = common_s_io_pin_config,
9357b31c
HV
5041#ifdef CONFIG_VIDEO_ADV_DEBUG
5042 .g_register = cx25840_g_register,
5043 .s_register = cx25840_s_register,
5044#endif
52fd3dda 5045 .interrupt_service_routine = cx25840_irq_handler,
9357b31c
HV
5046};
5047
5048static const struct v4l2_subdev_tuner_ops cx25840_tuner_ops = {
5049 .s_frequency = cx25840_s_frequency,
9357b31c
HV
5050 .s_radio = cx25840_s_radio,
5051 .g_tuner = cx25840_g_tuner,
5052 .s_tuner = cx25840_s_tuner,
5053};
5054
5055static const struct v4l2_subdev_audio_ops cx25840_audio_ops = {
5056 .s_clock_freq = cx25840_s_clock_freq,
5057 .s_routing = cx25840_s_audio_routing,
3ccc646b 5058 .s_stream = cx25840_s_audio_stream,
9357b31c
HV
5059};
5060
5061static const struct v4l2_subdev_video_ops cx25840_video_ops = {
8774bed9
LP
5062 .s_std = cx25840_s_std,
5063 .g_std = cx25840_g_std,
9357b31c 5064 .s_routing = cx25840_s_video_routing,
9357b31c 5065 .s_stream = cx25840_s_stream,
a21df45d 5066 .g_input_status = cx25840_g_input_status,
9357b31c
HV
5067};
5068
32cd527f
HV
5069static const struct v4l2_subdev_vbi_ops cx25840_vbi_ops = {
5070 .decode_vbi_line = cx25840_decode_vbi_line,
5393db43
HV
5071 .s_raw_fmt = cx25840_s_raw_fmt,
5072 .s_sliced_fmt = cx25840_s_sliced_fmt,
5073 .g_sliced_fmt = cx25840_g_sliced_fmt,
32cd527f
HV
5074};
5075
6e80c473
HV
5076static const struct v4l2_subdev_pad_ops cx25840_pad_ops = {
5077 .set_fmt = cx25840_set_fmt,
5078};
5079
9357b31c
HV
5080static const struct v4l2_subdev_ops cx25840_ops = {
5081 .core = &cx25840_core_ops,
5082 .tuner = &cx25840_tuner_ops,
5083 .audio = &cx25840_audio_ops,
5084 .video = &cx25840_video_ops,
32cd527f 5085 .vbi = &cx25840_vbi_ops,
6e80c473 5086 .pad = &cx25840_pad_ops,
52fd3dda 5087 .ir = &cx25840_ir_ops,
9357b31c
HV
5088};
5089
bd985160
HV
5090/* ----------------------------------------------------------------------- */
5091
c7dd1ecd
AW
5092static u32 get_cx2388x_ident(struct i2c_client *client)
5093{
5094 u32 ret;
5095
5096 /* Come out of digital power down */
5097 cx25840_write(client, 0x000, 0);
5098
8c2d7821
ST
5099 /* Detecting whether the part is cx23885/7/8 is more
5100 * difficult than it needs to be. No ID register. Instead we
5101 * probe certain registers indicated in the datasheets to look
5102 * for specific defaults that differ between the silicon designs. */
5103
5104 /* It's either 885/7 if the IR Tx Clk Divider register exists */
c7dd1ecd 5105 if (cx25840_read4(client, 0x204) & 0xffff) {
8c2d7821
ST
5106 /* CX23885 returns bogus repetitive byte values for the DIF,
5107 * which doesn't exist for it. (Ex. 8a8a8a8a or 31313131) */
5108 ret = cx25840_read4(client, 0x300);
5109 if (((ret & 0xffff0000) >> 16) == (ret & 0xffff)) {
5110 /* No DIF */
29d6a98b 5111 ret = CX23885_AV;
8c2d7821
ST
5112 } else {
5113 /* CX23887 has a broken DIF, but the registers
25985edc 5114 * appear valid (but unused), good enough to detect. */
29d6a98b 5115 ret = CX23887_AV;
8c2d7821 5116 }
c7dd1ecd
AW
5117 } else if (cx25840_read4(client, 0x300) & 0x0fffffff) {
5118 /* DIF PLL Freq Word reg exists; chip must be a CX23888 */
29d6a98b 5119 ret = CX23888_AV;
c7dd1ecd 5120 } else {
8c2d7821 5121 v4l_err(client, "Unable to detect h/w, assuming cx23887\n");
29d6a98b 5122 ret = CX23887_AV;
c7dd1ecd
AW
5123 }
5124
5125 /* Back into digital power down */
5126 cx25840_write(client, 0x000, 2);
5127 return ret;
5128}
5129
d2653e92
JD
5130static int cx25840_probe(struct i2c_client *client,
5131 const struct i2c_device_id *did)
bd985160 5132{
bd985160 5133 struct cx25840_state *state;
9357b31c 5134 struct v4l2_subdev *sd;
e34e658b 5135 int default_volume;
29d6a98b 5136 u32 id;
bd985160 5137 u16 device_id;
8cd61969
MCC
5138#if defined(CONFIG_MEDIA_CONTROLLER)
5139 int ret;
5140#endif
bd985160 5141
188f3457
HV
5142 /* Check if the adapter supports the needed features */
5143 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
5144 return -EIO;
5145
21340ae0 5146 v4l_dbg(1, cx25840_debug, client, "detecting cx25840 client on address 0x%x\n", client->addr << 1);
bd985160
HV
5147
5148 device_id = cx25840_read(client, 0x101) << 8;
5149 device_id |= cx25840_read(client, 0x100);
f234081b 5150 v4l_dbg(1, cx25840_debug, client, "device_id = 0x%04x\n", device_id);
bd985160
HV
5151
5152 /* The high byte of the device ID should be
e2b8cf4c
HV
5153 * 0x83 for the cx2583x and 0x84 for the cx2584x */
5154 if ((device_id & 0xff00) == 0x8300) {
29d6a98b 5155 id = CX25836 + ((device_id >> 4) & 0xf) - 6;
c7dd1ecd 5156 } else if ((device_id & 0xff00) == 0x8400) {
29d6a98b 5157 id = CX25840 + ((device_id >> 4) & 0xf);
00ca7324 5158 } else if (device_id == 0x0000) {
c7dd1ecd 5159 id = get_cx2388x_ident(client);
149783b5 5160 } else if ((device_id & 0xfff0) == 0x5A30) {
c7dd1ecd 5161 /* The CX23100 (0x5A3C = 23100) doesn't have an A/V decoder */
29d6a98b 5162 id = CX2310X_AV;
c7dd1ecd
AW
5163 } else if ((device_id & 0xff) == (device_id >> 8)) {
5164 v4l_err(client,
72cc0671 5165 "likely a confused/unresponsive cx2388[578] A/V decoder found @ 0x%x (%s)\n",
c7dd1ecd 5166 client->addr << 1, client->adapter->name);
72cc0671 5167 v4l_err(client, "A method to reset it from the cx25840 driver software is not known at this time\n");
c7dd1ecd
AW
5168 return -ENODEV;
5169 } else {
b5fc7144 5170 v4l_dbg(1, cx25840_debug, client, "cx25840 not found\n");
188f3457 5171 return -ENODEV;
bd985160
HV
5172 }
5173
c02b211d 5174 state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL);
9357b31c 5175 if (state == NULL)
21340ae0 5176 return -ENOMEM;
21340ae0 5177
9357b31c
HV
5178 sd = &state->sd;
5179 v4l2_i2c_subdev_init(sd, client, &cx25840_ops);
8cd61969 5180#if defined(CONFIG_MEDIA_CONTROLLER)
18e8d630
MCC
5181 /*
5182 * TODO: add media controller support for analog video inputs like
5183 * composite, svideo, etc.
5184 * A real input pad for this analog demod would be like:
5185 * ___________
5186 * TUNER --------> | |
5187 * | |
5188 * SVIDEO .......> | cx25840 |
5189 * | |
5190 * COMPOSITE1 ...> |_________|
5191 *
5192 * However, at least for now, there's no much gain on modelling
5193 * those extra inputs. So, let's add it only when needed.
5194 */
7e4f23d5
MCC
5195 state->pads[CX25840_PAD_INPUT].flags = MEDIA_PAD_FL_SINK;
5196 state->pads[CX25840_PAD_VID_OUT].flags = MEDIA_PAD_FL_SOURCE;
5197 state->pads[CX25840_PAD_VBI_OUT].flags = MEDIA_PAD_FL_SOURCE;
4ca72efa 5198 sd->entity.function = MEDIA_ENT_F_ATV_DECODER;
8cd61969 5199
ab22e77c 5200 ret = media_entity_pads_init(&sd->entity, ARRAY_SIZE(state->pads),
18095107 5201 state->pads);
8cd61969
MCC
5202 if (ret < 0) {
5203 v4l_info(client, "failed to initialize media entity!\n");
db749359 5204 return ret;
8cd61969
MCC
5205 }
5206#endif
e34e658b 5207
c7dd1ecd 5208 switch (id) {
29d6a98b 5209 case CX23885_AV:
c7dd1ecd
AW
5210 v4l_info(client, "cx23885 A/V decoder found @ 0x%x (%s)\n",
5211 client->addr << 1, client->adapter->name);
5212 break;
29d6a98b 5213 case CX23887_AV:
c7dd1ecd
AW
5214 v4l_info(client, "cx23887 A/V decoder found @ 0x%x (%s)\n",
5215 client->addr << 1, client->adapter->name);
5216 break;
29d6a98b 5217 case CX23888_AV:
c7dd1ecd
AW
5218 v4l_info(client, "cx23888 A/V decoder found @ 0x%x (%s)\n",
5219 client->addr << 1, client->adapter->name);
5220 break;
29d6a98b 5221 case CX2310X_AV:
c7dd1ecd
AW
5222 v4l_info(client, "cx%d A/V decoder found @ 0x%x (%s)\n",
5223 device_id, client->addr << 1, client->adapter->name);
5224 break;
29d6a98b
HV
5225 case CX25840:
5226 case CX25841:
5227 case CX25842:
5228 case CX25843:
c7dd1ecd
AW
5229 /* Note: revision '(device_id & 0x0f) == 2' was never built. The
5230 marking skips from 0x1 == 22 to 0x3 == 23. */
5231 v4l_info(client, "cx25%3x-2%x found @ 0x%x (%s)\n",
5232 (device_id & 0xfff0) >> 4,
5233 (device_id & 0x0f) < 3 ? (device_id & 0x0f) + 1
5234 : (device_id & 0x0f),
5235 client->addr << 1, client->adapter->name);
5236 break;
29d6a98b
HV
5237 case CX25836:
5238 case CX25837:
c7dd1ecd
AW
5239 default:
5240 v4l_info(client, "cx25%3x-%x found @ 0x%x (%s)\n",
5241 (device_id & 0xfff0) >> 4, device_id & 0x0f,
5242 client->addr << 1, client->adapter->name);
5243 break;
5244 }
bd985160 5245
21340ae0 5246 state->c = client;
a8bbf12a
HV
5247 state->vid_input = CX25840_COMPOSITE7;
5248 state->aud_input = CX25840_AUDIO8;
3578d3dd 5249 state->audclk_freq = 48000;
8a4b275f 5250 state->audmode = V4L2_TUNER_MODE_LANG1;
3e3bf277 5251 state->vbi_line_offset = 8;
e2b8cf4c 5252 state->id = id;
3434eb7e 5253 state->rev = device_id;
cdf472d3 5254 state->vbi_regs_offset = id == CX23888_AV ? 0x500 - 0x424 : 0;
bfd1bbfb 5255 state->std = V4L2_STD_NTSC_M;
e34e658b
HV
5256 v4l2_ctrl_handler_init(&state->hdl, 9);
5257 v4l2_ctrl_new_std(&state->hdl, &cx25840_ctrl_ops,
5258 V4L2_CID_BRIGHTNESS, 0, 255, 1, 128);
5259 v4l2_ctrl_new_std(&state->hdl, &cx25840_ctrl_ops,
5260 V4L2_CID_CONTRAST, 0, 127, 1, 64);
5261 v4l2_ctrl_new_std(&state->hdl, &cx25840_ctrl_ops,
5262 V4L2_CID_SATURATION, 0, 127, 1, 64);
5263 v4l2_ctrl_new_std(&state->hdl, &cx25840_ctrl_ops,
5264 V4L2_CID_HUE, -128, 127, 1, 0);
5265 if (!is_cx2583x(state)) {
f23b7952
AW
5266 default_volume = cx25840_read(client, 0x8d4);
5267 /*
5268 * Enforce the legacy PVR-350/MSP3400 to PVR-150/CX25843 volume
5269 * scale mapping limits to avoid -ERANGE errors when
5270 * initializing the volume control
5271 */
5272 if (default_volume > 228) {
5273 /* Bottom out at -96 dB, v4l2 vol range 0x2e00-0x2fff */
5274 default_volume = 228;
5275 cx25840_write(client, 0x8d4, 228);
5276 }
5277 else if (default_volume < 20) {
5278 /* Top out at + 8 dB, v4l2 vol range 0xfe00-0xffff */
5279 default_volume = 20;
5280 cx25840_write(client, 0x8d4, 20);
5281 }
5282 default_volume = (((228 - default_volume) >> 1) + 23) << 9;
e34e658b
HV
5283
5284 state->volume = v4l2_ctrl_new_std(&state->hdl,
5285 &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_VOLUME,
fc00a1d9 5286 0, 65535, 65535 / 100, default_volume);
e34e658b
HV
5287 state->mute = v4l2_ctrl_new_std(&state->hdl,
5288 &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_MUTE,
5289 0, 1, 1, 0);
5290 v4l2_ctrl_new_std(&state->hdl, &cx25840_audio_ctrl_ops,
5291 V4L2_CID_AUDIO_BALANCE,
5292 0, 65535, 65535 / 100, 32768);
5293 v4l2_ctrl_new_std(&state->hdl, &cx25840_audio_ctrl_ops,
5294 V4L2_CID_AUDIO_BASS,
5295 0, 65535, 65535 / 100, 32768);
5296 v4l2_ctrl_new_std(&state->hdl, &cx25840_audio_ctrl_ops,
5297 V4L2_CID_AUDIO_TREBLE,
5298 0, 65535, 65535 / 100, 32768);
5299 }
5300 sd->ctrl_handler = &state->hdl;
5301 if (state->hdl.error) {
5302 int err = state->hdl.error;
5303
5304 v4l2_ctrl_handler_free(&state->hdl);
e34e658b
HV
5305 return err;
5306 }
1e6406b8
SB
5307 if (!is_cx2583x(state))
5308 v4l2_ctrl_cluster(2, &state->volume);
e34e658b 5309 v4l2_ctrl_handler_setup(&state->hdl);
f234081b 5310
3c7c9370
HV
5311 if (client->dev.platform_data) {
5312 struct cx25840_platform_data *pdata = client->dev.platform_data;
5313
5314 state->pvr150_workaround = pdata->pvr150_workaround;
5315 }
5316
52fd3dda 5317 cx25840_ir_probe(sd);
bd985160
HV
5318 return 0;
5319}
5320
1a39275a 5321static int cx25840_remove(struct i2c_client *client)
bd985160 5322{
9357b31c 5323 struct v4l2_subdev *sd = i2c_get_clientdata(client);
e34e658b 5324 struct cx25840_state *state = to_state(sd);
9357b31c 5325
52fd3dda 5326 cx25840_ir_remove(sd);
9357b31c 5327 v4l2_device_unregister_subdev(sd);
e34e658b 5328 v4l2_ctrl_handler_free(&state->hdl);
bd985160
HV
5329 return 0;
5330}
5331
af294867
JD
5332static const struct i2c_device_id cx25840_id[] = {
5333 { "cx25840", 0 },
5334 { }
5335};
5336MODULE_DEVICE_TABLE(i2c, cx25840_id);
5337
ad62cdfe
HV
5338static struct i2c_driver cx25840_driver = {
5339 .driver = {
ad62cdfe
HV
5340 .name = "cx25840",
5341 },
5342 .probe = cx25840_probe,
5343 .remove = cx25840_remove,
5344 .id_table = cx25840_id,
bd985160 5345};
ad62cdfe 5346
c6e8d86f 5347module_i2c_driver(cx25840_driver);