aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/usb/cx231xx/cx231xx-dvb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/usb/cx231xx/cx231xx-dvb.c')
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-dvb.c65
1 files changed, 32 insertions, 33 deletions
diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c
index a0d40bda718d..dd600b994e69 100644
--- a/drivers/media/usb/cx231xx/cx231xx-dvb.c
+++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c
@@ -191,10 +191,10 @@ static inline void print_err_status(struct cx231xx *dev, int packet, int status)
191 break; 191 break;
192 } 192 }
193 if (packet < 0) { 193 if (packet < 0) {
194 dev_dbg(&dev->udev->dev, 194 dev_dbg(dev->dev,
195 "URB status %d [%s].\n", status, errmsg); 195 "URB status %d [%s].\n", status, errmsg);
196 } else { 196 } else {
197 dev_dbg(&dev->udev->dev, 197 dev_dbg(dev->dev,
198 "URB packet %d, status %d [%s].\n", 198 "URB packet %d, status %d [%s].\n",
199 packet, status, errmsg); 199 packet, status, errmsg);
200 } 200 }
@@ -261,7 +261,7 @@ static int start_streaming(struct cx231xx_dvb *dvb)
261 struct cx231xx *dev = dvb->adapter.priv; 261 struct cx231xx *dev = dvb->adapter.priv;
262 262
263 if (dev->USE_ISO) { 263 if (dev->USE_ISO) {
264 dev_dbg(&dev->udev->dev, "DVB transfer mode is ISO.\n"); 264 dev_dbg(dev->dev, "DVB transfer mode is ISO.\n");
265 cx231xx_set_alt_setting(dev, INDEX_TS1, 4); 265 cx231xx_set_alt_setting(dev, INDEX_TS1, 4);
266 rc = cx231xx_set_mode(dev, CX231XX_DIGITAL_MODE); 266 rc = cx231xx_set_mode(dev, CX231XX_DIGITAL_MODE);
267 if (rc < 0) 267 if (rc < 0)
@@ -272,7 +272,7 @@ static int start_streaming(struct cx231xx_dvb *dvb)
272 dev->ts1_mode.max_pkt_size, 272 dev->ts1_mode.max_pkt_size,
273 dvb_isoc_copy); 273 dvb_isoc_copy);
274 } else { 274 } else {
275 dev_dbg(&dev->udev->dev, "DVB transfer mode is BULK.\n"); 275 dev_dbg(dev->dev, "DVB transfer mode is BULK.\n");
276 cx231xx_set_alt_setting(dev, INDEX_TS1, 0); 276 cx231xx_set_alt_setting(dev, INDEX_TS1, 0);
277 rc = cx231xx_set_mode(dev, CX231XX_DIGITAL_MODE); 277 rc = cx231xx_set_mode(dev, CX231XX_DIGITAL_MODE);
278 if (rc < 0) 278 if (rc < 0)
@@ -374,21 +374,20 @@ static int attach_xc5000(u8 addr, struct cx231xx *dev)
374 cfg.i2c_addr = addr; 374 cfg.i2c_addr = addr;
375 375
376 if (!dev->dvb->frontend) { 376 if (!dev->dvb->frontend) {
377 dev_err(&dev->udev->dev, "%s/2: dvb frontend not attached. " 377 dev_err(dev->dev, "%s/2: dvb frontend not attached. "
378 "Can't attach xc5000\n", dev->name); 378 "Can't attach xc5000\n", dev->name);
379 return -EINVAL; 379 return -EINVAL;
380 } 380 }
381 381
382 fe = dvb_attach(xc5000_attach, dev->dvb->frontend, &cfg); 382 fe = dvb_attach(xc5000_attach, dev->dvb->frontend, &cfg);
383 if (!fe) { 383 if (!fe) {
384 dev_err(&dev->udev->dev, 384 dev_err(dev->dev, "%s/2: xc5000 attach failed\n", dev->name);
385 "%s/2: xc5000 attach failed\n", dev->name);
386 dvb_frontend_detach(dev->dvb->frontend); 385 dvb_frontend_detach(dev->dvb->frontend);
387 dev->dvb->frontend = NULL; 386 dev->dvb->frontend = NULL;
388 return -EINVAL; 387 return -EINVAL;
389 } 388 }
390 389
391 dev_info(&dev->udev->dev, "%s/2: xc5000 attached\n", dev->name); 390 dev_info(dev->dev, "%s/2: xc5000 attached\n", dev->name);
392 391
393 return 0; 392 return 0;
394} 393}
@@ -427,16 +426,16 @@ int cx231xx_reset_analog_tuner(struct cx231xx *dev)
427 426
428 if (dops->init != NULL && !dev->xc_fw_load_done) { 427 if (dops->init != NULL && !dev->xc_fw_load_done) {
429 428
430 dev_dbg(&dev->udev->dev, 429 dev_dbg(dev->dev,
431 "Reloading firmware for XC5000\n"); 430 "Reloading firmware for XC5000\n");
432 status = dops->init(dev->dvb->frontend); 431 status = dops->init(dev->dvb->frontend);
433 if (status == 0) { 432 if (status == 0) {
434 dev->xc_fw_load_done = 1; 433 dev->xc_fw_load_done = 1;
435 dev_dbg(&dev->udev->dev, 434 dev_dbg(dev->dev,
436 "XC5000 firmware download completed\n"); 435 "XC5000 firmware download completed\n");
437 } else { 436 } else {
438 dev->xc_fw_load_done = 0; 437 dev->xc_fw_load_done = 0;
439 dev_dbg(&dev->udev->dev, 438 dev_dbg(dev->dev,
440 "XC5000 firmware download failed !!!\n"); 439 "XC5000 firmware download failed !!!\n");
441 } 440 }
442 } 441 }
@@ -460,7 +459,7 @@ static int register_dvb(struct cx231xx_dvb *dvb,
460 result = dvb_register_adapter(&dvb->adapter, dev->name, module, device, 459 result = dvb_register_adapter(&dvb->adapter, dev->name, module, device,
461 adapter_nr); 460 adapter_nr);
462 if (result < 0) { 461 if (result < 0) {
463 dev_warn(&dev->udev->dev, 462 dev_warn(dev->dev,
464 "%s: dvb_register_adapter failed (errno = %d)\n", 463 "%s: dvb_register_adapter failed (errno = %d)\n",
465 dev->name, result); 464 dev->name, result);
466 goto fail_adapter; 465 goto fail_adapter;
@@ -474,7 +473,7 @@ static int register_dvb(struct cx231xx_dvb *dvb,
474 /* register frontend */ 473 /* register frontend */
475 result = dvb_register_frontend(&dvb->adapter, dvb->frontend); 474 result = dvb_register_frontend(&dvb->adapter, dvb->frontend);
476 if (result < 0) { 475 if (result < 0) {
477 dev_warn(&dev->udev->dev, 476 dev_warn(dev->dev,
478 "%s: dvb_register_frontend failed (errno = %d)\n", 477 "%s: dvb_register_frontend failed (errno = %d)\n",
479 dev->name, result); 478 dev->name, result);
480 goto fail_frontend; 479 goto fail_frontend;
@@ -492,7 +491,7 @@ static int register_dvb(struct cx231xx_dvb *dvb,
492 491
493 result = dvb_dmx_init(&dvb->demux); 492 result = dvb_dmx_init(&dvb->demux);
494 if (result < 0) { 493 if (result < 0) {
495 dev_warn(&dev->udev->dev, 494 dev_warn(dev->dev,
496 "%s: dvb_dmx_init failed (errno = %d)\n", 495 "%s: dvb_dmx_init failed (errno = %d)\n",
497 dev->name, result); 496 dev->name, result);
498 goto fail_dmx; 497 goto fail_dmx;
@@ -503,7 +502,7 @@ static int register_dvb(struct cx231xx_dvb *dvb,
503 dvb->dmxdev.capabilities = 0; 502 dvb->dmxdev.capabilities = 0;
504 result = dvb_dmxdev_init(&dvb->dmxdev, &dvb->adapter); 503 result = dvb_dmxdev_init(&dvb->dmxdev, &dvb->adapter);
505 if (result < 0) { 504 if (result < 0) {
506 dev_warn(&dev->udev->dev, 505 dev_warn(dev->dev,
507 "%s: dvb_dmxdev_init failed (errno = %d)\n", 506 "%s: dvb_dmxdev_init failed (errno = %d)\n",
508 dev->name, result); 507 dev->name, result);
509 goto fail_dmxdev; 508 goto fail_dmxdev;
@@ -512,7 +511,7 @@ static int register_dvb(struct cx231xx_dvb *dvb,
512 dvb->fe_hw.source = DMX_FRONTEND_0; 511 dvb->fe_hw.source = DMX_FRONTEND_0;
513 result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_hw); 512 result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_hw);
514 if (result < 0) { 513 if (result < 0) {
515 dev_warn(&dev->udev->dev, 514 dev_warn(dev->dev,
516 "%s: add_frontend failed (DMX_FRONTEND_0, errno = %d)\n", 515 "%s: add_frontend failed (DMX_FRONTEND_0, errno = %d)\n",
517 dev->name, result); 516 dev->name, result);
518 goto fail_fe_hw; 517 goto fail_fe_hw;
@@ -521,7 +520,7 @@ static int register_dvb(struct cx231xx_dvb *dvb,
521 dvb->fe_mem.source = DMX_MEMORY_FE; 520 dvb->fe_mem.source = DMX_MEMORY_FE;
522 result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_mem); 521 result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_mem);
523 if (result < 0) { 522 if (result < 0) {
524 dev_warn(&dev->udev->dev, 523 dev_warn(dev->dev,
525 "%s: add_frontend failed (DMX_MEMORY_FE, errno = %d)\n", 524 "%s: add_frontend failed (DMX_MEMORY_FE, errno = %d)\n",
526 dev->name, result); 525 dev->name, result);
527 goto fail_fe_mem; 526 goto fail_fe_mem;
@@ -529,7 +528,7 @@ static int register_dvb(struct cx231xx_dvb *dvb,
529 528
530 result = dvb->demux.dmx.connect_frontend(&dvb->demux.dmx, &dvb->fe_hw); 529 result = dvb->demux.dmx.connect_frontend(&dvb->demux.dmx, &dvb->fe_hw);
531 if (result < 0) { 530 if (result < 0) {
532 dev_warn(&dev->udev->dev, 531 dev_warn(dev->dev,
533 "%s: connect_frontend failed (errno = %d)\n", 532 "%s: connect_frontend failed (errno = %d)\n",
534 dev->name, result); 533 dev->name, result);
535 goto fail_fe_conn; 534 goto fail_fe_conn;
@@ -590,7 +589,7 @@ static int dvb_init(struct cx231xx *dev)
590 dvb = kzalloc(sizeof(struct cx231xx_dvb), GFP_KERNEL); 589 dvb = kzalloc(sizeof(struct cx231xx_dvb), GFP_KERNEL);
591 590
592 if (dvb == NULL) { 591 if (dvb == NULL) {
593 dev_info(&dev->udev->dev, 592 dev_info(dev->dev,
594 "cx231xx_dvb: memory allocation failed\n"); 593 "cx231xx_dvb: memory allocation failed\n");
595 return -ENOMEM; 594 return -ENOMEM;
596 } 595 }
@@ -613,7 +612,7 @@ static int dvb_init(struct cx231xx *dev)
613 demod_i2c); 612 demod_i2c);
614 613
615 if (dev->dvb->frontend == NULL) { 614 if (dev->dvb->frontend == NULL) {
616 dev_err(&dev->udev->dev, 615 dev_err(dev->dev,
617 "Failed to attach s5h1432 front end\n"); 616 "Failed to attach s5h1432 front end\n");
618 result = -EINVAL; 617 result = -EINVAL;
619 goto out_free; 618 goto out_free;
@@ -638,7 +637,7 @@ static int dvb_init(struct cx231xx *dev)
638 demod_i2c); 637 demod_i2c);
639 638
640 if (dev->dvb->frontend == NULL) { 639 if (dev->dvb->frontend == NULL) {
641 dev_err(&dev->udev->dev, 640 dev_err(dev->dev,
642 "Failed to attach s5h1411 front end\n"); 641 "Failed to attach s5h1411 front end\n");
643 result = -EINVAL; 642 result = -EINVAL;
644 goto out_free; 643 goto out_free;
@@ -661,7 +660,7 @@ static int dvb_init(struct cx231xx *dev)
661 demod_i2c); 660 demod_i2c);
662 661
663 if (dev->dvb->frontend == NULL) { 662 if (dev->dvb->frontend == NULL) {
664 dev_err(&dev->udev->dev, 663 dev_err(dev->dev,
665 "Failed to attach s5h1432 front end\n"); 664 "Failed to attach s5h1432 front end\n");
666 result = -EINVAL; 665 result = -EINVAL;
667 goto out_free; 666 goto out_free;
@@ -685,7 +684,7 @@ static int dvb_init(struct cx231xx *dev)
685 demod_i2c); 684 demod_i2c);
686 685
687 if (dev->dvb->frontend == NULL) { 686 if (dev->dvb->frontend == NULL) {
688 dev_err(&dev->udev->dev, 687 dev_err(dev->dev,
689 "Failed to attach s5h1411 front end\n"); 688 "Failed to attach s5h1411 front end\n");
690 result = -EINVAL; 689 result = -EINVAL;
691 goto out_free; 690 goto out_free;
@@ -703,7 +702,7 @@ static int dvb_init(struct cx231xx *dev)
703 break; 702 break;
704 case CX231XX_BOARD_HAUPPAUGE_EXETER: 703 case CX231XX_BOARD_HAUPPAUGE_EXETER:
705 704
706 dev_info(&dev->udev->dev, 705 dev_info(dev->dev,
707 "%s: looking for tuner / demod on i2c bus: %d\n", 706 "%s: looking for tuner / demod on i2c bus: %d\n",
708 __func__, i2c_adapter_id(tuner_i2c)); 707 __func__, i2c_adapter_id(tuner_i2c));
709 708
@@ -712,7 +711,7 @@ static int dvb_init(struct cx231xx *dev)
712 tuner_i2c); 711 tuner_i2c);
713 712
714 if (dev->dvb->frontend == NULL) { 713 if (dev->dvb->frontend == NULL) {
715 dev_err(&dev->udev->dev, 714 dev_err(dev->dev,
716 "Failed to attach LG3305 front end\n"); 715 "Failed to attach LG3305 front end\n");
717 result = -EINVAL; 716 result = -EINVAL;
718 goto out_free; 717 goto out_free;
@@ -734,7 +733,7 @@ static int dvb_init(struct cx231xx *dev)
734 ); 733 );
735 734
736 if (dev->dvb->frontend == NULL) { 735 if (dev->dvb->frontend == NULL) {
737 dev_err(&dev->udev->dev, 736 dev_err(dev->dev,
738 "Failed to attach SI2165 front end\n"); 737 "Failed to attach SI2165 front end\n");
739 result = -EINVAL; 738 result = -EINVAL;
740 goto out_free; 739 goto out_free;
@@ -767,7 +766,7 @@ static int dvb_init(struct cx231xx *dev)
767 ); 766 );
768 767
769 if (dev->dvb->frontend == NULL) { 768 if (dev->dvb->frontend == NULL) {
770 dev_err(&dev->udev->dev, 769 dev_err(dev->dev,
771 "Failed to attach SI2165 front end\n"); 770 "Failed to attach SI2165 front end\n");
772 result = -EINVAL; 771 result = -EINVAL;
773 goto out_free; 772 goto out_free;
@@ -812,7 +811,7 @@ static int dvb_init(struct cx231xx *dev)
812 case CX231XX_BOARD_PV_PLAYTV_USB_HYBRID: 811 case CX231XX_BOARD_PV_PLAYTV_USB_HYBRID:
813 case CX231XX_BOARD_KWORLD_UB430_USB_HYBRID: 812 case CX231XX_BOARD_KWORLD_UB430_USB_HYBRID:
814 813
815 dev_info(&dev->udev->dev, 814 dev_info(dev->dev,
816 "%s: looking for demod on i2c bus: %d\n", 815 "%s: looking for demod on i2c bus: %d\n",
817 __func__, i2c_adapter_id(tuner_i2c)); 816 __func__, i2c_adapter_id(tuner_i2c));
818 817
@@ -821,7 +820,7 @@ static int dvb_init(struct cx231xx *dev)
821 demod_i2c); 820 demod_i2c);
822 821
823 if (dev->dvb->frontend == NULL) { 822 if (dev->dvb->frontend == NULL) {
824 dev_err(&dev->udev->dev, 823 dev_err(dev->dev,
825 "Failed to attach mb86a20s demod\n"); 824 "Failed to attach mb86a20s demod\n");
826 result = -EINVAL; 825 result = -EINVAL;
827 goto out_free; 826 goto out_free;
@@ -836,26 +835,26 @@ static int dvb_init(struct cx231xx *dev)
836 break; 835 break;
837 836
838 default: 837 default:
839 dev_err(&dev->udev->dev, 838 dev_err(dev->dev,
840 "%s/2: The frontend of your DVB/ATSC card isn't supported yet\n", 839 "%s/2: The frontend of your DVB/ATSC card isn't supported yet\n",
841 dev->name); 840 dev->name);
842 break; 841 break;
843 } 842 }
844 if (NULL == dvb->frontend) { 843 if (NULL == dvb->frontend) {
845 dev_err(&dev->udev->dev, 844 dev_err(dev->dev,
846 "%s/2: frontend initialization failed\n", dev->name); 845 "%s/2: frontend initialization failed\n", dev->name);
847 result = -EINVAL; 846 result = -EINVAL;
848 goto out_free; 847 goto out_free;
849 } 848 }
850 849
851 /* register everything */ 850 /* register everything */
852 result = register_dvb(dvb, THIS_MODULE, dev, &dev->udev->dev); 851 result = register_dvb(dvb, THIS_MODULE, dev, dev->dev);
853 852
854 if (result < 0) 853 if (result < 0)
855 goto out_free; 854 goto out_free;
856 855
857 856
858 dev_info(&dev->udev->dev, "Successfully loaded cx231xx-dvb\n"); 857 dev_info(dev->dev, "Successfully loaded cx231xx-dvb\n");
859 858
860ret: 859ret:
861 cx231xx_set_mode(dev, CX231XX_SUSPEND); 860 cx231xx_set_mode(dev, CX231XX_SUSPEND);