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