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