diff options
Diffstat (limited to 'drivers/media/video/cx88/cx88-dvb.c')
-rw-r--r-- | drivers/media/video/cx88/cx88-dvb.c | 122 |
1 files changed, 22 insertions, 100 deletions
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index dbfe4dc9cf8c..1773b40467dc 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c | |||
@@ -35,9 +35,7 @@ | |||
35 | 35 | ||
36 | #include "mt352.h" | 36 | #include "mt352.h" |
37 | #include "mt352_priv.h" | 37 | #include "mt352_priv.h" |
38 | #if defined(CONFIG_VIDEO_CX88_VP3054) || defined(CONFIG_VIDEO_CX88_VP3054_MODULE) | 38 | #include "cx88-vp3054-i2c.h" |
39 | # include "cx88-vp3054-i2c.h" | ||
40 | #endif | ||
41 | #include "zl10353.h" | 39 | #include "zl10353.h" |
42 | #include "cx22702.h" | 40 | #include "cx22702.h" |
43 | #include "or51132.h" | 41 | #include "or51132.h" |
@@ -199,7 +197,7 @@ static struct mt352_config dvico_fusionhdtv_dual = { | |||
199 | .demod_init = dvico_dual_demod_init, | 197 | .demod_init = dvico_dual_demod_init, |
200 | }; | 198 | }; |
201 | 199 | ||
202 | #if defined(CONFIG_VIDEO_CX88_VP3054) || defined(CONFIG_VIDEO_CX88_VP3054_MODULE) | 200 | #if defined(CONFIG_VIDEO_CX88_VP3054) || (defined(CONFIG_VIDEO_CX88_VP3054_MODULE) && defined(MODULE)) |
203 | static int dntv_live_dvbt_pro_demod_init(struct dvb_frontend* fe) | 201 | static int dntv_live_dvbt_pro_demod_init(struct dvb_frontend* fe) |
204 | { | 202 | { |
205 | static u8 clock_config [] = { 0x89, 0x38, 0x38 }; | 203 | static u8 clock_config [] = { 0x89, 0x38, 0x38 }; |
@@ -223,64 +221,6 @@ static int dntv_live_dvbt_pro_demod_init(struct dvb_frontend* fe) | |||
223 | return 0; | 221 | return 0; |
224 | } | 222 | } |
225 | 223 | ||
226 | static int philips_fmd1216_pll_init(struct dvb_frontend *fe) | ||
227 | { | ||
228 | struct cx8802_dev *dev= fe->dvb->priv; | ||
229 | |||
230 | /* this message is to set up ATC and ALC */ | ||
231 | static u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0xa0 }; | ||
232 | struct i2c_msg msg = | ||
233 | { .addr = dev->core->pll_addr, .flags = 0, | ||
234 | .buf = fmd1216_init, .len = sizeof(fmd1216_init) }; | ||
235 | int err; | ||
236 | |||
237 | if (fe->ops.i2c_gate_ctrl) | ||
238 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
239 | if ((err = i2c_transfer(&dev->core->i2c_adap, &msg, 1)) != 1) { | ||
240 | if (err < 0) | ||
241 | return err; | ||
242 | else | ||
243 | return -EREMOTEIO; | ||
244 | } | ||
245 | |||
246 | return 0; | ||
247 | } | ||
248 | |||
249 | static int dntv_live_dvbt_pro_tuner_set_params(struct dvb_frontend* fe, | ||
250 | struct dvb_frontend_parameters* params) | ||
251 | { | ||
252 | struct cx8802_dev *dev= fe->dvb->priv; | ||
253 | u8 buf[4]; | ||
254 | struct i2c_msg msg = | ||
255 | { .addr = dev->core->pll_addr, .flags = 0, | ||
256 | .buf = buf, .len = 4 }; | ||
257 | int err; | ||
258 | |||
259 | /* Switch PLL to DVB mode */ | ||
260 | err = philips_fmd1216_pll_init(fe); | ||
261 | if (err) | ||
262 | return err; | ||
263 | |||
264 | /* Tune PLL */ | ||
265 | dvb_pll_configure(dev->core->pll_desc, buf, | ||
266 | params->frequency, | ||
267 | params->u.ofdm.bandwidth); | ||
268 | if (fe->ops.i2c_gate_ctrl) | ||
269 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
270 | if ((err = i2c_transfer(&dev->core->i2c_adap, &msg, 1)) != 1) { | ||
271 | |||
272 | printk(KERN_WARNING "cx88-dvb: %s error " | ||
273 | "(addr %02x <- %02x, err = %i)\n", | ||
274 | __FUNCTION__, dev->core->pll_addr, buf[0], err); | ||
275 | if (err < 0) | ||
276 | return err; | ||
277 | else | ||
278 | return -EREMOTEIO; | ||
279 | } | ||
280 | |||
281 | return 0; | ||
282 | } | ||
283 | |||
284 | static struct mt352_config dntv_live_dvbt_pro_config = { | 224 | static struct mt352_config dntv_live_dvbt_pro_config = { |
285 | .demod_address = 0x0f, | 225 | .demod_address = 0x0f, |
286 | .no_tuner = 1, | 226 | .no_tuner = 1, |
@@ -370,18 +310,8 @@ static int nxt200x_set_ts_param(struct dvb_frontend* fe, int is_punctured) | |||
370 | return 0; | 310 | return 0; |
371 | } | 311 | } |
372 | 312 | ||
373 | static int nxt200x_set_pll_input(u8* buf, int input) | ||
374 | { | ||
375 | if (input) | ||
376 | buf[3] |= 0x08; | ||
377 | else | ||
378 | buf[3] &= ~0x08; | ||
379 | return 0; | ||
380 | } | ||
381 | |||
382 | static struct nxt200x_config ati_hdtvwonder = { | 313 | static struct nxt200x_config ati_hdtvwonder = { |
383 | .demod_address = 0x0a, | 314 | .demod_address = 0x0a, |
384 | .set_pll_input = nxt200x_set_pll_input, | ||
385 | .set_ts_params = nxt200x_set_ts_param, | 315 | .set_ts_params = nxt200x_set_ts_param, |
386 | }; | 316 | }; |
387 | 317 | ||
@@ -456,7 +386,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
456 | if (dev->dvb.frontend != NULL) { | 386 | if (dev->dvb.frontend != NULL) { |
457 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 387 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
458 | &dev->core->i2c_adap, | 388 | &dev->core->i2c_adap, |
459 | &dvb_pll_thomson_dtt759x); | 389 | DVB_PLL_THOMSON_DTT759X); |
460 | } | 390 | } |
461 | break; | 391 | break; |
462 | case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1: | 392 | case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1: |
@@ -469,7 +399,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
469 | if (dev->dvb.frontend != NULL) { | 399 | if (dev->dvb.frontend != NULL) { |
470 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, | 400 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, |
471 | &dev->core->i2c_adap, | 401 | &dev->core->i2c_adap, |
472 | &dvb_pll_thomson_dtt7579); | 402 | DVB_PLL_THOMSON_DTT7579); |
473 | } | 403 | } |
474 | break; | 404 | break; |
475 | case CX88_BOARD_WINFAST_DTV2000H: | 405 | case CX88_BOARD_WINFAST_DTV2000H: |
@@ -482,7 +412,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
482 | &dev->core->i2c_adap); | 412 | &dev->core->i2c_adap); |
483 | if (dev->dvb.frontend != NULL) { | 413 | if (dev->dvb.frontend != NULL) { |
484 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 414 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
485 | &dev->core->i2c_adap, &dvb_pll_fmd1216me); | 415 | &dev->core->i2c_adap, DVB_PLL_FMD1216ME); |
486 | } | 416 | } |
487 | break; | 417 | break; |
488 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS: | 418 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS: |
@@ -491,7 +421,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
491 | &dev->core->i2c_adap); | 421 | &dev->core->i2c_adap); |
492 | if (dev->dvb.frontend != NULL) { | 422 | if (dev->dvb.frontend != NULL) { |
493 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, | 423 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, |
494 | NULL, &dvb_pll_thomson_dtt7579); | 424 | NULL, DVB_PLL_THOMSON_DTT7579); |
495 | break; | 425 | break; |
496 | } | 426 | } |
497 | /* ZL10353 replaces MT352 on later cards */ | 427 | /* ZL10353 replaces MT352 on later cards */ |
@@ -500,7 +430,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
500 | &dev->core->i2c_adap); | 430 | &dev->core->i2c_adap); |
501 | if (dev->dvb.frontend != NULL) { | 431 | if (dev->dvb.frontend != NULL) { |
502 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, | 432 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, |
503 | NULL, &dvb_pll_thomson_dtt7579); | 433 | NULL, DVB_PLL_THOMSON_DTT7579); |
504 | } | 434 | } |
505 | break; | 435 | break; |
506 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL: | 436 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL: |
@@ -511,7 +441,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
511 | &dev->core->i2c_adap); | 441 | &dev->core->i2c_adap); |
512 | if (dev->dvb.frontend != NULL) { | 442 | if (dev->dvb.frontend != NULL) { |
513 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 443 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
514 | NULL, &dvb_pll_thomson_dtt7579); | 444 | NULL, DVB_PLL_THOMSON_DTT7579); |
515 | break; | 445 | break; |
516 | } | 446 | } |
517 | /* ZL10353 replaces MT352 on later cards */ | 447 | /* ZL10353 replaces MT352 on later cards */ |
@@ -520,7 +450,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
520 | &dev->core->i2c_adap); | 450 | &dev->core->i2c_adap); |
521 | if (dev->dvb.frontend != NULL) { | 451 | if (dev->dvb.frontend != NULL) { |
522 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 452 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
523 | NULL, &dvb_pll_thomson_dtt7579); | 453 | NULL, DVB_PLL_THOMSON_DTT7579); |
524 | } | 454 | } |
525 | break; | 455 | break; |
526 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: | 456 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: |
@@ -529,7 +459,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
529 | &dev->core->i2c_adap); | 459 | &dev->core->i2c_adap); |
530 | if (dev->dvb.frontend != NULL) { | 460 | if (dev->dvb.frontend != NULL) { |
531 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 461 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
532 | NULL, &dvb_pll_lg_z201); | 462 | NULL, DVB_PLL_LG_Z201); |
533 | } | 463 | } |
534 | break; | 464 | break; |
535 | case CX88_BOARD_KWORLD_DVB_T: | 465 | case CX88_BOARD_KWORLD_DVB_T: |
@@ -540,17 +470,16 @@ static int dvb_register(struct cx8802_dev *dev) | |||
540 | &dev->core->i2c_adap); | 470 | &dev->core->i2c_adap); |
541 | if (dev->dvb.frontend != NULL) { | 471 | if (dev->dvb.frontend != NULL) { |
542 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 472 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
543 | NULL, &dvb_pll_unknown_1); | 473 | NULL, DVB_PLL_UNKNOWN_1); |
544 | } | 474 | } |
545 | break; | 475 | break; |
546 | case CX88_BOARD_DNTV_LIVE_DVB_T_PRO: | 476 | case CX88_BOARD_DNTV_LIVE_DVB_T_PRO: |
547 | #if defined(CONFIG_VIDEO_CX88_VP3054) || defined(CONFIG_VIDEO_CX88_VP3054_MODULE) | 477 | #if defined(CONFIG_VIDEO_CX88_VP3054) || (defined(CONFIG_VIDEO_CX88_VP3054_MODULE) && defined(MODULE)) |
548 | dev->core->pll_addr = 0x61; | ||
549 | dev->core->pll_desc = &dvb_pll_fmd1216me; | ||
550 | dev->dvb.frontend = dvb_attach(mt352_attach, &dntv_live_dvbt_pro_config, | 478 | dev->dvb.frontend = dvb_attach(mt352_attach, &dntv_live_dvbt_pro_config, |
551 | &((struct vp3054_i2c_state *)dev->card_priv)->adap); | 479 | &((struct vp3054_i2c_state *)dev->card_priv)->adap); |
552 | if (dev->dvb.frontend != NULL) { | 480 | if (dev->dvb.frontend != NULL) { |
553 | dev->dvb.frontend->ops.tuner_ops.set_params = dntv_live_dvbt_pro_tuner_set_params; | 481 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
482 | &dev->core->i2c_adap, DVB_PLL_FMD1216ME); | ||
554 | } | 483 | } |
555 | #else | 484 | #else |
556 | printk("%s: built without vp3054 support\n", dev->core->name); | 485 | printk("%s: built without vp3054 support\n", dev->core->name); |
@@ -563,7 +492,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
563 | if (dev->dvb.frontend != NULL) { | 492 | if (dev->dvb.frontend != NULL) { |
564 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 493 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
565 | &dev->core->i2c_adap, | 494 | &dev->core->i2c_adap, |
566 | &dvb_pll_thomson_fe6600); | 495 | DVB_PLL_THOMSON_FE6600); |
567 | } | 496 | } |
568 | break; | 497 | break; |
569 | case CX88_BOARD_PCHDTV_HD3000: | 498 | case CX88_BOARD_PCHDTV_HD3000: |
@@ -572,7 +501,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
572 | if (dev->dvb.frontend != NULL) { | 501 | if (dev->dvb.frontend != NULL) { |
573 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 502 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
574 | &dev->core->i2c_adap, | 503 | &dev->core->i2c_adap, |
575 | &dvb_pll_thomson_dtt761x); | 504 | DVB_PLL_THOMSON_DTT761X); |
576 | } | 505 | } |
577 | break; | 506 | break; |
578 | case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q: | 507 | case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q: |
@@ -594,7 +523,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
594 | if (dev->dvb.frontend != NULL) { | 523 | if (dev->dvb.frontend != NULL) { |
595 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 524 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
596 | &dev->core->i2c_adap, | 525 | &dev->core->i2c_adap, |
597 | &dvb_pll_microtune_4042); | 526 | DVB_PLL_MICROTUNE_4042); |
598 | } | 527 | } |
599 | } | 528 | } |
600 | break; | 529 | break; |
@@ -614,7 +543,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
614 | if (dev->dvb.frontend != NULL) { | 543 | if (dev->dvb.frontend != NULL) { |
615 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 544 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
616 | &dev->core->i2c_adap, | 545 | &dev->core->i2c_adap, |
617 | &dvb_pll_thomson_dtt761x); | 546 | DVB_PLL_THOMSON_DTT761X); |
618 | } | 547 | } |
619 | } | 548 | } |
620 | break; | 549 | break; |
@@ -634,7 +563,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
634 | if (dev->dvb.frontend != NULL) { | 563 | if (dev->dvb.frontend != NULL) { |
635 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 564 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
636 | &dev->core->i2c_adap, | 565 | &dev->core->i2c_adap, |
637 | &dvb_pll_lg_tdvs_h06xf); | 566 | DVB_PLL_LG_TDVS_H06XF); |
638 | } | 567 | } |
639 | } | 568 | } |
640 | break; | 569 | break; |
@@ -654,7 +583,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
654 | if (dev->dvb.frontend != NULL) { | 583 | if (dev->dvb.frontend != NULL) { |
655 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 584 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
656 | &dev->core->i2c_adap, | 585 | &dev->core->i2c_adap, |
657 | &dvb_pll_lg_tdvs_h06xf); | 586 | DVB_PLL_LG_TDVS_H06XF); |
658 | } | 587 | } |
659 | } | 588 | } |
660 | break; | 589 | break; |
@@ -664,7 +593,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
664 | &dev->core->i2c_adap); | 593 | &dev->core->i2c_adap); |
665 | if (dev->dvb.frontend != NULL) { | 594 | if (dev->dvb.frontend != NULL) { |
666 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, | 595 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
667 | NULL, &dvb_pll_tuv1236d); | 596 | NULL, DVB_PLL_TUV1236D); |
668 | } | 597 | } |
669 | break; | 598 | break; |
670 | case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: | 599 | case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: |
@@ -705,10 +634,6 @@ static int dvb_register(struct cx8802_dev *dev) | |||
705 | return -1; | 634 | return -1; |
706 | } | 635 | } |
707 | 636 | ||
708 | if (dev->core->pll_desc) { | ||
709 | dev->dvb.frontend->ops.info.frequency_min = dev->core->pll_desc->min; | ||
710 | dev->dvb.frontend->ops.info.frequency_max = dev->core->pll_desc->max; | ||
711 | } | ||
712 | /* Ensure all frontends negotiate bus access */ | 637 | /* Ensure all frontends negotiate bus access */ |
713 | dev->dvb.frontend->ops.ts_bus_ctrl = cx88_dvb_bus_ctrl; | 638 | dev->dvb.frontend->ops.ts_bus_ctrl = cx88_dvb_bus_ctrl; |
714 | 639 | ||
@@ -778,11 +703,10 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv) | |||
778 | if (!(cx88_boards[core->board].mpeg & CX88_MPEG_DVB)) | 703 | if (!(cx88_boards[core->board].mpeg & CX88_MPEG_DVB)) |
779 | goto fail_core; | 704 | goto fail_core; |
780 | 705 | ||
781 | #if defined(CONFIG_VIDEO_CX88_VP3054) || defined(CONFIG_VIDEO_CX88_VP3054_MODULE) | 706 | /* If vp3054 isn't enabled, a stub will just return 0 */ |
782 | err = vp3054_i2c_probe(dev); | 707 | err = vp3054_i2c_probe(dev); |
783 | if (0 != err) | 708 | if (0 != err) |
784 | goto fail_core; | 709 | goto fail_core; |
785 | #endif | ||
786 | 710 | ||
787 | /* dvb stuff */ | 711 | /* dvb stuff */ |
788 | printk("%s/2: cx2388x based dvb card\n", core->name); | 712 | printk("%s/2: cx2388x based dvb card\n", core->name); |
@@ -807,9 +731,7 @@ static int cx8802_dvb_remove(struct cx8802_driver *drv) | |||
807 | /* dvb */ | 731 | /* dvb */ |
808 | videobuf_dvb_unregister(&dev->dvb); | 732 | videobuf_dvb_unregister(&dev->dvb); |
809 | 733 | ||
810 | #if defined(CONFIG_VIDEO_CX88_VP3054) || defined(CONFIG_VIDEO_CX88_VP3054_MODULE) | ||
811 | vp3054_i2c_remove(dev); | 734 | vp3054_i2c_remove(dev); |
812 | #endif | ||
813 | 735 | ||
814 | return 0; | 736 | return 0; |
815 | } | 737 | } |