aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx23885/cx23885-dvb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx23885/cx23885-dvb.c')
-rw-r--r--drivers/media/video/cx23885/cx23885-dvb.c166
1 files changed, 164 insertions, 2 deletions
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c
index 1c454128a9df..d43c74396767 100644
--- a/drivers/media/video/cx23885/cx23885-dvb.c
+++ b/drivers/media/video/cx23885/cx23885-dvb.c
@@ -30,6 +30,7 @@
30#include "cx23885.h" 30#include "cx23885.h"
31#include <media/v4l2-common.h> 31#include <media/v4l2-common.h>
32 32
33#include "dvb_ca_en50221.h"
33#include "s5h1409.h" 34#include "s5h1409.h"
34#include "s5h1411.h" 35#include "s5h1411.h"
35#include "mt2131.h" 36#include "mt2131.h"
@@ -43,6 +44,13 @@
43#include "dib7000p.h" 44#include "dib7000p.h"
44#include "dibx000_common.h" 45#include "dibx000_common.h"
45#include "zl10353.h" 46#include "zl10353.h"
47#include "stv0900.h"
48#include "stv6110.h"
49#include "lnbh24.h"
50#include "cx24116.h"
51#include "cimax2.h"
52#include "netup-eeprom.h"
53#include "netup-init.h"
46 54
47static unsigned int debug; 55static unsigned int debug;
48 56
@@ -308,11 +316,63 @@ static struct zl10353_config dvico_fusionhdtv_xc3028 = {
308 .no_tuner = 1, 316 .no_tuner = 1,
309}; 317};
310 318
319static struct stv0900_config netup_stv0900_config = {
320 .demod_address = 0x68,
321 .xtal = 27000000,
322 .clkmode = 3,/* 0-CLKI, 2-XTALI, else AUTO */
323 .diseqc_mode = 2,/* 2/3 PWM */
324 .path1_mode = 2,/*Serial continues clock */
325 .path2_mode = 2,/*Serial continues clock */
326 .tun1_maddress = 0,/* 0x60 */
327 .tun2_maddress = 3,/* 0x63 */
328 .tun1_adc = 1,/* 1 Vpp */
329 .tun2_adc = 1,/* 1 Vpp */
330};
331
332static struct stv6110_config netup_stv6110_tunerconfig_a = {
333 .i2c_address = 0x60,
334 .mclk = 27000000,
335 .iq_wiring = 0,
336};
337
338static struct stv6110_config netup_stv6110_tunerconfig_b = {
339 .i2c_address = 0x63,
340 .mclk = 27000000,
341 .iq_wiring = 1,
342};
343
344static int tbs_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
345{
346 struct cx23885_tsport *port = fe->dvb->priv;
347 struct cx23885_dev *dev = port->dev;
348
349 if (voltage == SEC_VOLTAGE_18)
350 cx_write(MC417_RWD, 0x00001e00);/* GPIO-13 high */
351 else if (voltage == SEC_VOLTAGE_13)
352 cx_write(MC417_RWD, 0x00001a00);/* GPIO-13 low */
353 else
354 cx_write(MC417_RWD, 0x00001800);/* GPIO-12 low */
355 return 0;
356}
357
358static struct cx24116_config tbs_cx24116_config = {
359 .demod_address = 0x05,
360};
361
362static struct cx24116_config tevii_cx24116_config = {
363 .demod_address = 0x55,
364};
365
366static struct cx24116_config dvbworld_cx24116_config = {
367 .demod_address = 0x05,
368};
369
311static int dvb_register(struct cx23885_tsport *port) 370static int dvb_register(struct cx23885_tsport *port)
312{ 371{
313 struct cx23885_dev *dev = port->dev; 372 struct cx23885_dev *dev = port->dev;
314 struct cx23885_i2c *i2c_bus = NULL; 373 struct cx23885_i2c *i2c_bus = NULL;
315 struct videobuf_dvb_frontend *fe0; 374 struct videobuf_dvb_frontend *fe0;
375 int ret;
316 376
317 /* Get the first frontend */ 377 /* Get the first frontend */
318 fe0 = videobuf_dvb_get_frontend(&port->frontends, 1); 378 fe0 = videobuf_dvb_get_frontend(&port->frontends, 1);
@@ -526,6 +586,78 @@ static int dvb_register(struct cx23885_tsport *port)
526 fe->ops.tuner_ops.set_config(fe, &ctl); 586 fe->ops.tuner_ops.set_config(fe, &ctl);
527 } 587 }
528 break; 588 break;
589 case CX23885_BOARD_TBS_6920:
590 i2c_bus = &dev->i2c_bus[0];
591
592 fe0->dvb.frontend = dvb_attach(cx24116_attach,
593 &tbs_cx24116_config,
594 &i2c_bus->i2c_adap);
595 if (fe0->dvb.frontend != NULL)
596 fe0->dvb.frontend->ops.set_voltage = tbs_set_voltage;
597
598 break;
599 case CX23885_BOARD_TEVII_S470:
600 i2c_bus = &dev->i2c_bus[1];
601
602 fe0->dvb.frontend = dvb_attach(cx24116_attach,
603 &tevii_cx24116_config,
604 &i2c_bus->i2c_adap);
605 if (fe0->dvb.frontend != NULL)
606 fe0->dvb.frontend->ops.set_voltage = tbs_set_voltage;
607
608 break;
609 case CX23885_BOARD_DVBWORLD_2005:
610 i2c_bus = &dev->i2c_bus[1];
611
612 fe0->dvb.frontend = dvb_attach(cx24116_attach,
613 &dvbworld_cx24116_config,
614 &i2c_bus->i2c_adap);
615 break;
616 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
617 i2c_bus = &dev->i2c_bus[0];
618 switch (port->nr) {
619 /* port B */
620 case 1:
621 fe0->dvb.frontend = dvb_attach(stv0900_attach,
622 &netup_stv0900_config,
623 &i2c_bus->i2c_adap, 0);
624 if (fe0->dvb.frontend != NULL) {
625 if (dvb_attach(stv6110_attach,
626 fe0->dvb.frontend,
627 &netup_stv6110_tunerconfig_a,
628 &i2c_bus->i2c_adap)) {
629 if (!dvb_attach(lnbh24_attach,
630 fe0->dvb.frontend,
631 &i2c_bus->i2c_adap,
632 LNBH24_PCL, 0, 0x09))
633 printk(KERN_ERR
634 "No LNBH24 found!\n");
635
636 }
637 }
638 break;
639 /* port C */
640 case 2:
641 fe0->dvb.frontend = dvb_attach(stv0900_attach,
642 &netup_stv0900_config,
643 &i2c_bus->i2c_adap, 1);
644 if (fe0->dvb.frontend != NULL) {
645 if (dvb_attach(stv6110_attach,
646 fe0->dvb.frontend,
647 &netup_stv6110_tunerconfig_b,
648 &i2c_bus->i2c_adap)) {
649 if (!dvb_attach(lnbh24_attach,
650 fe0->dvb.frontend,
651 &i2c_bus->i2c_adap,
652 LNBH24_PCL, 0, 0x0a))
653 printk(KERN_ERR
654 "No LNBH24 found!\n");
655
656 }
657 }
658 break;
659 }
660 break;
529 default: 661 default:
530 printk(KERN_INFO "%s: The frontend of your DVB/ATSC card " 662 printk(KERN_INFO "%s: The frontend of your DVB/ATSC card "
531 " isn't supported yet\n", 663 " isn't supported yet\n",
@@ -541,15 +673,39 @@ static int dvb_register(struct cx23885_tsport *port)
541 fe0->dvb.frontend->callback = cx23885_tuner_callback; 673 fe0->dvb.frontend->callback = cx23885_tuner_callback;
542 674
543 /* Put the analog decoder in standby to keep it quiet */ 675 /* Put the analog decoder in standby to keep it quiet */
544 cx23885_call_i2c_clients(i2c_bus, TUNER_SET_STANDBY, NULL); 676 call_all(dev, core, s_standby, 0);
545 677
546 if (fe0->dvb.frontend->ops.analog_ops.standby) 678 if (fe0->dvb.frontend->ops.analog_ops.standby)
547 fe0->dvb.frontend->ops.analog_ops.standby(fe0->dvb.frontend); 679 fe0->dvb.frontend->ops.analog_ops.standby(fe0->dvb.frontend);
548 680
549 /* register everything */ 681 /* register everything */
550 return videobuf_dvb_register_bus(&port->frontends, THIS_MODULE, port, 682 ret = videobuf_dvb_register_bus(&port->frontends, THIS_MODULE, port,
551 &dev->pci->dev, adapter_nr, 0); 683 &dev->pci->dev, adapter_nr, 0);
552 684
685 /* init CI & MAC */
686 switch (dev->board) {
687 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: {
688 static struct netup_card_info cinfo;
689
690 netup_get_card_info(&dev->i2c_bus[0].i2c_adap, &cinfo);
691 memcpy(port->frontends.adapter.proposed_mac,
692 cinfo.port[port->nr - 1].mac, 6);
693 printk(KERN_INFO "NetUP Dual DVB-S2 CI card port%d MAC="
694 "%02X:%02X:%02X:%02X:%02X:%02X\n",
695 port->nr,
696 port->frontends.adapter.proposed_mac[0],
697 port->frontends.adapter.proposed_mac[1],
698 port->frontends.adapter.proposed_mac[2],
699 port->frontends.adapter.proposed_mac[3],
700 port->frontends.adapter.proposed_mac[4],
701 port->frontends.adapter.proposed_mac[5]);
702
703 netup_ci_init(port);
704 break;
705 }
706 }
707
708 return ret;
553} 709}
554 710
555int cx23885_dvb_register(struct cx23885_tsport *port) 711int cx23885_dvb_register(struct cx23885_tsport *port)
@@ -622,6 +778,12 @@ int cx23885_dvb_unregister(struct cx23885_tsport *port)
622 if (fe0->dvb.frontend) 778 if (fe0->dvb.frontend)
623 videobuf_dvb_unregister_bus(&port->frontends); 779 videobuf_dvb_unregister_bus(&port->frontends);
624 780
781 switch (port->dev->board) {
782 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
783 netup_ci_exit(port);
784 break;
785 }
786
625 return 0; 787 return 0;
626} 788}
627 789