aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx23885
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx23885')
-rw-r--r--drivers/media/video/cx23885/cx23885-dvb.c115
-rw-r--r--drivers/media/video/cx23885/cx23885.h2
2 files changed, 66 insertions, 51 deletions
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c
index 24bd18327aa0..fe1218fd44cb 100644
--- a/drivers/media/video/cx23885/cx23885-dvb.c
+++ b/drivers/media/video/cx23885/cx23885-dvb.c
@@ -312,48 +312,53 @@ static int dvb_register(struct cx23885_tsport *port)
312{ 312{
313 struct cx23885_dev *dev = port->dev; 313 struct cx23885_dev *dev = port->dev;
314 struct cx23885_i2c *i2c_bus = NULL; 314 struct cx23885_i2c *i2c_bus = NULL;
315 struct videobuf_dvb_frontend *fe0;
316
317 fe0 = videobuf_dvb_get_frontend(&port->frontends, 0);
318 if (!fe0)
319 return -EINVAL;
315 320
316 /* init struct videobuf_dvb */ 321 /* init struct videobuf_dvb */
317 port->dvb.name = dev->name; 322 fe0->dvb.name = dev->name;
318 323
319 /* init frontend */ 324 /* init frontend */
320 switch (dev->board) { 325 switch (dev->board) {
321 case CX23885_BOARD_HAUPPAUGE_HVR1250: 326 case CX23885_BOARD_HAUPPAUGE_HVR1250:
322 i2c_bus = &dev->i2c_bus[0]; 327 i2c_bus = &dev->i2c_bus[0];
323 port->dvb.frontend = dvb_attach(s5h1409_attach, 328 fe0->dvb.frontend = dvb_attach(s5h1409_attach,
324 &hauppauge_generic_config, 329 &hauppauge_generic_config,
325 &i2c_bus->i2c_adap); 330 &i2c_bus->i2c_adap);
326 if (port->dvb.frontend != NULL) { 331 if (fe0->dvb.frontend != NULL) {
327 dvb_attach(mt2131_attach, port->dvb.frontend, 332 dvb_attach(mt2131_attach, fe0->dvb.frontend,
328 &i2c_bus->i2c_adap, 333 &i2c_bus->i2c_adap,
329 &hauppauge_generic_tunerconfig, 0); 334 &hauppauge_generic_tunerconfig, 0);
330 } 335 }
331 break; 336 break;
332 case CX23885_BOARD_HAUPPAUGE_HVR1800: 337 case CX23885_BOARD_HAUPPAUGE_HVR1800:
333 i2c_bus = &dev->i2c_bus[0]; 338 i2c_bus = &dev->i2c_bus[0];
334 switch (alt_tuner) { 339 switch (alt_tuner) { // XXXXXX multifrontend?
335 case 1: 340 case 1:
336 port->dvb.frontend = 341 fe0->dvb.frontend =
337 dvb_attach(s5h1409_attach, 342 dvb_attach(s5h1409_attach,
338 &hauppauge_ezqam_config, 343 &hauppauge_ezqam_config,
339 &i2c_bus->i2c_adap); 344 &i2c_bus->i2c_adap);
340 if (port->dvb.frontend != NULL) { 345 if (fe0->dvb.frontend != NULL) {
341 dvb_attach(tda829x_attach, port->dvb.frontend, 346 dvb_attach(tda829x_attach, fe0->dvb.frontend,
342 &dev->i2c_bus[1].i2c_adap, 0x42, 347 &dev->i2c_bus[1].i2c_adap, 0x42,
343 &tda829x_no_probe); 348 &tda829x_no_probe);
344 dvb_attach(tda18271_attach, port->dvb.frontend, 349 dvb_attach(tda18271_attach, fe0->dvb.frontend,
345 0x60, &dev->i2c_bus[1].i2c_adap, 350 0x60, &dev->i2c_bus[1].i2c_adap,
346 &hauppauge_tda18271_config); 351 &hauppauge_tda18271_config);
347 } 352 }
348 break; 353 break;
349 case 0: 354 case 0:
350 default: 355 default:
351 port->dvb.frontend = 356 fe0->dvb.frontend =
352 dvb_attach(s5h1409_attach, 357 dvb_attach(s5h1409_attach,
353 &hauppauge_generic_config, 358 &hauppauge_generic_config,
354 &i2c_bus->i2c_adap); 359 &i2c_bus->i2c_adap);
355 if (port->dvb.frontend != NULL) 360 if (fe0->dvb.frontend != NULL)
356 dvb_attach(mt2131_attach, port->dvb.frontend, 361 dvb_attach(mt2131_attach, fe0->dvb.frontend,
357 &i2c_bus->i2c_adap, 362 &i2c_bus->i2c_adap,
358 &hauppauge_generic_tunerconfig, 0); 363 &hauppauge_generic_tunerconfig, 0);
359 break; 364 break;
@@ -361,42 +366,42 @@ static int dvb_register(struct cx23885_tsport *port)
361 break; 366 break;
362 case CX23885_BOARD_HAUPPAUGE_HVR1800lp: 367 case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
363 i2c_bus = &dev->i2c_bus[0]; 368 i2c_bus = &dev->i2c_bus[0];
364 port->dvb.frontend = dvb_attach(s5h1409_attach, 369 fe0->dvb.frontend = dvb_attach(s5h1409_attach,
365 &hauppauge_hvr1800lp_config, 370 &hauppauge_hvr1800lp_config,
366 &i2c_bus->i2c_adap); 371 &i2c_bus->i2c_adap);
367 if (port->dvb.frontend != NULL) { 372 if (fe0->dvb.frontend != NULL) {
368 dvb_attach(mt2131_attach, port->dvb.frontend, 373 dvb_attach(mt2131_attach, fe0->dvb.frontend,
369 &i2c_bus->i2c_adap, 374 &i2c_bus->i2c_adap,
370 &hauppauge_generic_tunerconfig, 0); 375 &hauppauge_generic_tunerconfig, 0);
371 } 376 }
372 break; 377 break;
373 case CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP: 378 case CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP:
374 i2c_bus = &dev->i2c_bus[0]; 379 i2c_bus = &dev->i2c_bus[0];
375 port->dvb.frontend = dvb_attach(lgdt330x_attach, 380 fe0->dvb.frontend = dvb_attach(lgdt330x_attach,
376 &fusionhdtv_5_express, 381 &fusionhdtv_5_express,
377 &i2c_bus->i2c_adap); 382 &i2c_bus->i2c_adap);
378 if (port->dvb.frontend != NULL) { 383 if (fe0->dvb.frontend != NULL) {
379 dvb_attach(simple_tuner_attach, port->dvb.frontend, 384 dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
380 &i2c_bus->i2c_adap, 0x61, 385 &i2c_bus->i2c_adap, 0x61,
381 TUNER_LG_TDVS_H06XF); 386 TUNER_LG_TDVS_H06XF);
382 } 387 }
383 break; 388 break;
384 case CX23885_BOARD_HAUPPAUGE_HVR1500Q: 389 case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
385 i2c_bus = &dev->i2c_bus[1]; 390 i2c_bus = &dev->i2c_bus[1];
386 port->dvb.frontend = dvb_attach(s5h1409_attach, 391 fe0->dvb.frontend = dvb_attach(s5h1409_attach,
387 &hauppauge_hvr1500q_config, 392 &hauppauge_hvr1500q_config,
388 &dev->i2c_bus[0].i2c_adap); 393 &dev->i2c_bus[0].i2c_adap);
389 if (port->dvb.frontend != NULL) 394 if (fe0->dvb.frontend != NULL)
390 dvb_attach(xc5000_attach, port->dvb.frontend, 395 dvb_attach(xc5000_attach, fe0->dvb.frontend,
391 &i2c_bus->i2c_adap, 396 &i2c_bus->i2c_adap,
392 &hauppauge_hvr1500q_tunerconfig); 397 &hauppauge_hvr1500q_tunerconfig);
393 break; 398 break;
394 case CX23885_BOARD_HAUPPAUGE_HVR1500: 399 case CX23885_BOARD_HAUPPAUGE_HVR1500:
395 i2c_bus = &dev->i2c_bus[1]; 400 i2c_bus = &dev->i2c_bus[1];
396 port->dvb.frontend = dvb_attach(s5h1409_attach, 401 fe0->dvb.frontend = dvb_attach(s5h1409_attach,
397 &hauppauge_hvr1500_config, 402 &hauppauge_hvr1500_config,
398 &dev->i2c_bus[0].i2c_adap); 403 &dev->i2c_bus[0].i2c_adap);
399 if (port->dvb.frontend != NULL) { 404 if (fe0->dvb.frontend != NULL) {
400 struct dvb_frontend *fe; 405 struct dvb_frontend *fe;
401 struct xc2028_config cfg = { 406 struct xc2028_config cfg = {
402 .i2c_adap = &i2c_bus->i2c_adap, 407 .i2c_adap = &i2c_bus->i2c_adap,
@@ -409,7 +414,7 @@ static int dvb_register(struct cx23885_tsport *port)
409 }; 414 };
410 415
411 fe = dvb_attach(xc2028_attach, 416 fe = dvb_attach(xc2028_attach,
412 port->dvb.frontend, &cfg); 417 fe0->dvb.frontend, &cfg);
413 if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) 418 if (fe != NULL && fe->ops.tuner_ops.set_config != NULL)
414 fe->ops.tuner_ops.set_config(fe, &ctl); 419 fe->ops.tuner_ops.set_config(fe, &ctl);
415 } 420 }
@@ -417,24 +422,24 @@ static int dvb_register(struct cx23885_tsport *port)
417 case CX23885_BOARD_HAUPPAUGE_HVR1200: 422 case CX23885_BOARD_HAUPPAUGE_HVR1200:
418 case CX23885_BOARD_HAUPPAUGE_HVR1700: 423 case CX23885_BOARD_HAUPPAUGE_HVR1700:
419 i2c_bus = &dev->i2c_bus[0]; 424 i2c_bus = &dev->i2c_bus[0];
420 port->dvb.frontend = dvb_attach(tda10048_attach, 425 fe0->dvb.frontend = dvb_attach(tda10048_attach,
421 &hauppauge_hvr1200_config, 426 &hauppauge_hvr1200_config,
422 &i2c_bus->i2c_adap); 427 &i2c_bus->i2c_adap);
423 if (port->dvb.frontend != NULL) { 428 if (fe0->dvb.frontend != NULL) {
424 dvb_attach(tda829x_attach, port->dvb.frontend, 429 dvb_attach(tda829x_attach, fe0->dvb.frontend,
425 &dev->i2c_bus[1].i2c_adap, 0x42, 430 &dev->i2c_bus[1].i2c_adap, 0x42,
426 &tda829x_no_probe); 431 &tda829x_no_probe);
427 dvb_attach(tda18271_attach, port->dvb.frontend, 432 dvb_attach(tda18271_attach, fe0->dvb.frontend,
428 0x60, &dev->i2c_bus[1].i2c_adap, 433 0x60, &dev->i2c_bus[1].i2c_adap,
429 &hauppauge_hvr1200_tuner_config); 434 &hauppauge_hvr1200_tuner_config);
430 } 435 }
431 break; 436 break;
432 case CX23885_BOARD_HAUPPAUGE_HVR1400: 437 case CX23885_BOARD_HAUPPAUGE_HVR1400:
433 i2c_bus = &dev->i2c_bus[0]; 438 i2c_bus = &dev->i2c_bus[0];
434 port->dvb.frontend = dvb_attach(dib7000p_attach, 439 fe0->dvb.frontend = dvb_attach(dib7000p_attach,
435 &i2c_bus->i2c_adap, 440 &i2c_bus->i2c_adap,
436 0x12, &hauppauge_hvr1400_dib7000_config); 441 0x12, &hauppauge_hvr1400_dib7000_config);
437 if (port->dvb.frontend != NULL) { 442 if (fe0->dvb.frontend != NULL) {
438 struct dvb_frontend *fe; 443 struct dvb_frontend *fe;
439 struct xc2028_config cfg = { 444 struct xc2028_config cfg = {
440 .i2c_adap = &dev->i2c_bus[1].i2c_adap, 445 .i2c_adap = &dev->i2c_bus[1].i2c_adap,
@@ -449,7 +454,7 @@ static int dvb_register(struct cx23885_tsport *port)
449 }; 454 };
450 455
451 fe = dvb_attach(xc2028_attach, 456 fe = dvb_attach(xc2028_attach,
452 port->dvb.frontend, &cfg); 457 fe0->dvb.frontend, &cfg);
453 if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) 458 if (fe != NULL && fe->ops.tuner_ops.set_config != NULL)
454 fe->ops.tuner_ops.set_config(fe, &ctl); 459 fe->ops.tuner_ops.set_config(fe, &ctl);
455 } 460 }
@@ -457,25 +462,25 @@ static int dvb_register(struct cx23885_tsport *port)
457 case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP: 462 case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP:
458 i2c_bus = &dev->i2c_bus[port->nr - 1]; 463 i2c_bus = &dev->i2c_bus[port->nr - 1];
459 464
460 port->dvb.frontend = dvb_attach(s5h1409_attach, 465 fe0->dvb.frontend = dvb_attach(s5h1409_attach,
461 &dvico_s5h1409_config, 466 &dvico_s5h1409_config,
462 &i2c_bus->i2c_adap); 467 &i2c_bus->i2c_adap);
463 if (port->dvb.frontend == NULL) 468 if (fe0->dvb.frontend == NULL)
464 port->dvb.frontend = dvb_attach(s5h1411_attach, 469 fe0->dvb.frontend = dvb_attach(s5h1411_attach,
465 &dvico_s5h1411_config, 470 &dvico_s5h1411_config,
466 &i2c_bus->i2c_adap); 471 &i2c_bus->i2c_adap);
467 if (port->dvb.frontend != NULL) 472 if (fe0->dvb.frontend != NULL)
468 dvb_attach(xc5000_attach, port->dvb.frontend, 473 dvb_attach(xc5000_attach, fe0->dvb.frontend,
469 &i2c_bus->i2c_adap, 474 &i2c_bus->i2c_adap,
470 &dvico_xc5000_tunerconfig); 475 &dvico_xc5000_tunerconfig);
471 break; 476 break;
472 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP: { 477 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP: {
473 i2c_bus = &dev->i2c_bus[port->nr - 1]; 478 i2c_bus = &dev->i2c_bus[port->nr - 1];
474 479
475 port->dvb.frontend = dvb_attach(zl10353_attach, 480 fe0->dvb.frontend = dvb_attach(zl10353_attach,
476 &dvico_fusionhdtv_xc3028, 481 &dvico_fusionhdtv_xc3028,
477 &i2c_bus->i2c_adap); 482 &i2c_bus->i2c_adap);
478 if (port->dvb.frontend != NULL) { 483 if (fe0->dvb.frontend != NULL) {
479 struct dvb_frontend *fe; 484 struct dvb_frontend *fe;
480 struct xc2028_config cfg = { 485 struct xc2028_config cfg = {
481 .i2c_adap = &i2c_bus->i2c_adap, 486 .i2c_adap = &i2c_bus->i2c_adap,
@@ -487,7 +492,7 @@ static int dvb_register(struct cx23885_tsport *port)
487 .demod = XC3028_FE_ZARLINK456, 492 .demod = XC3028_FE_ZARLINK456,
488 }; 493 };
489 494
490 fe = dvb_attach(xc2028_attach, port->dvb.frontend, 495 fe = dvb_attach(xc2028_attach, fe0->dvb.frontend,
491 &cfg); 496 &cfg);
492 if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) 497 if (fe != NULL && fe->ops.tuner_ops.set_config != NULL)
493 fe->ops.tuner_ops.set_config(fe, &ctl); 498 fe->ops.tuner_ops.set_config(fe, &ctl);
@@ -497,10 +502,10 @@ static int dvb_register(struct cx23885_tsport *port)
497 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H: 502 case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
498 i2c_bus = &dev->i2c_bus[0]; 503 i2c_bus = &dev->i2c_bus[0];
499 504
500 port->dvb.frontend = dvb_attach(zl10353_attach, 505 fe0->dvb.frontend = dvb_attach(zl10353_attach,
501 &dvico_fusionhdtv_xc3028, 506 &dvico_fusionhdtv_xc3028,
502 &i2c_bus->i2c_adap); 507 &i2c_bus->i2c_adap);
503 if (port->dvb.frontend != NULL) { 508 if (fe0->dvb.frontend != NULL) {
504 struct dvb_frontend *fe; 509 struct dvb_frontend *fe;
505 struct xc2028_config cfg = { 510 struct xc2028_config cfg = {
506 .i2c_adap = &dev->i2c_bus[1].i2c_adap, 511 .i2c_adap = &dev->i2c_bus[1].i2c_adap,
@@ -512,7 +517,7 @@ static int dvb_register(struct cx23885_tsport *port)
512 .demod = XC3028_FE_ZARLINK456, 517 .demod = XC3028_FE_ZARLINK456,
513 }; 518 };
514 519
515 fe = dvb_attach(xc2028_attach, port->dvb.frontend, 520 fe = dvb_attach(xc2028_attach, fe0->dvb.frontend,
516 &cfg); 521 &cfg);
517 if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) 522 if (fe != NULL && fe->ops.tuner_ops.set_config != NULL)
518 fe->ops.tuner_ops.set_config(fe, &ctl); 523 fe->ops.tuner_ops.set_config(fe, &ctl);
@@ -523,29 +528,36 @@ static int dvb_register(struct cx23885_tsport *port)
523 dev->name); 528 dev->name);
524 break; 529 break;
525 } 530 }
526 if (NULL == port->dvb.frontend) { 531 if (NULL == fe0->dvb.frontend) {
527 printk("%s: frontend initialization failed\n", dev->name); 532 printk("%s: frontend initialization failed\n", dev->name);
528 return -1; 533 return -1;
529 } 534 }
530 /* define general-purpose callback pointer */ 535 /* define general-purpose callback pointer */
531 port->dvb.frontend->callback = cx23885_tuner_callback; 536 fe0->dvb.frontend->callback = cx23885_tuner_callback;
532 537
533 /* Put the analog decoder in standby to keep it quiet */ 538 /* Put the analog decoder in standby to keep it quiet */
534 cx23885_call_i2c_clients(i2c_bus, TUNER_SET_STANDBY, NULL); 539 cx23885_call_i2c_clients(i2c_bus, TUNER_SET_STANDBY, NULL);
535 540
536 if (port->dvb.frontend->ops.analog_ops.standby) 541 if (fe0->dvb.frontend->ops.analog_ops.standby)
537 port->dvb.frontend->ops.analog_ops.standby(port->dvb.frontend); 542 fe0->dvb.frontend->ops.analog_ops.standby(fe0->dvb.frontend);
538 543
539 /* register everything */ 544 /* register everything */
540 return videobuf_dvb_register(&port->dvb, THIS_MODULE, port, 545 return videobuf_dvb_register_bus(&port->frontends, THIS_MODULE, port,
541 &dev->pci->dev, adapter_nr); 546 &dev->pci->dev, adapter_nr);
547
542} 548}
543 549
544int cx23885_dvb_register(struct cx23885_tsport *port) 550int cx23885_dvb_register(struct cx23885_tsport *port)
545{ 551{
552
553 struct videobuf_dvb_frontend *fe0;
546 struct cx23885_dev *dev = port->dev; 554 struct cx23885_dev *dev = port->dev;
547 int err; 555 int err;
548 556
557 fe0 = videobuf_dvb_get_frontend(&port->frontends, 0);
558 if (!fe0)
559 err = -EINVAL;
560
549 dprintk(1, "%s\n", __func__); 561 dprintk(1, "%s\n", __func__);
550 dprintk(1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n", 562 dprintk(1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n",
551 dev->board, 563 dev->board,
@@ -557,7 +569,7 @@ int cx23885_dvb_register(struct cx23885_tsport *port)
557 569
558 /* dvb stuff */ 570 /* dvb stuff */
559 printk("%s: cx23885 based dvb card\n", dev->name); 571 printk("%s: cx23885 based dvb card\n", dev->name);
560 videobuf_queue_sg_init(&port->dvb.dvbq, &dvb_qops, &dev->pci->dev, &port->slock, 572 videobuf_queue_sg_init(&fe0->dvb.dvbq, &dvb_qops, &dev->pci->dev, &port->slock,
561 V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_TOP, 573 V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_TOP,
562 sizeof(struct cx23885_buffer), port); 574 sizeof(struct cx23885_buffer), port);
563 err = dvb_register(port); 575 err = dvb_register(port);
@@ -569,9 +581,12 @@ int cx23885_dvb_register(struct cx23885_tsport *port)
569 581
570int cx23885_dvb_unregister(struct cx23885_tsport *port) 582int cx23885_dvb_unregister(struct cx23885_tsport *port)
571{ 583{
584 struct videobuf_dvb_frontend *fe0;
585
586 fe0 = videobuf_dvb_get_frontend(&port->frontends, 0);
572 /* dvb */ 587 /* dvb */
573 if(port->dvb.frontend) 588 if(fe0->dvb.frontend)
574 videobuf_dvb_unregister(&port->dvb); 589 videobuf_dvb_unregister_bus(&port->frontends);
575 590
576 return 0; 591 return 0;
577} 592}
diff --git a/drivers/media/video/cx23885/cx23885.h b/drivers/media/video/cx23885/cx23885.h
index ba4e0aaed463..aa34bf9ea4d9 100644
--- a/drivers/media/video/cx23885/cx23885.h
+++ b/drivers/media/video/cx23885/cx23885.h
@@ -225,7 +225,7 @@ struct cx23885_tsport {
225 int nr; 225 int nr;
226 int sram_chno; 226 int sram_chno;
227 227
228 struct videobuf_dvb dvb; 228 struct videobuf_dvb_frontends frontends;
229 229
230 /* dma queues */ 230 /* dma queues */
231 struct cx23885_dmaqueue mpegq; 231 struct cx23885_dmaqueue mpegq;