aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/bt8xx
diff options
context:
space:
mode:
authorAndrew de Quincey <adq_dvb@lidskialf.net>2006-08-08 08:10:08 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-09-26 10:53:25 -0400
commit2bfe031df6bd5e3b8e503eba8e3b6461d7c2c27e (patch)
tree2d7288c2221fb6f7ef98ef7a1ee3fef3f04cf87e /drivers/media/dvb/bt8xx
parentd995506062c974133ba66d0822e58a923d4d74d9 (diff)
V4L/DVB (4386): Convert DVB devices to use dvb_attach()
Only devices using > 1 frontend were ported; ones which did not are left using static binding. Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net> Acked-by: Michael Krufky <mkrufky@linuxtv.org> Acked-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/bt8xx')
-rw-r--r--drivers/media/dvb/bt8xx/dst.c4
-rw-r--r--drivers/media/dvb/bt8xx/dst_ca.c4
-rw-r--r--drivers/media/dvb/bt8xx/dst_common.h2
-rw-r--r--drivers/media/dvb/bt8xx/dvb-bt8xx.c36
4 files changed, 27 insertions, 19 deletions
diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c
index 06ac899a9a26..91dea91b1a43 100644
--- a/drivers/media/dvb/bt8xx/dst.c
+++ b/drivers/media/dvb/bt8xx/dst.c
@@ -1715,6 +1715,10 @@ static int dst_get_frontend(struct dvb_frontend *fe, struct dvb_frontend_paramet
1715static void dst_release(struct dvb_frontend *fe) 1715static void dst_release(struct dvb_frontend *fe)
1716{ 1716{
1717 struct dst_state *state = fe->demodulator_priv; 1717 struct dst_state *state = fe->demodulator_priv;
1718
1719 if (state->dst_hw_cap & DST_TYPE_HAS_CA)
1720 symbol_put(dst_ca_attach);
1721
1718 kfree(state); 1722 kfree(state);
1719} 1723}
1720 1724
diff --git a/drivers/media/dvb/bt8xx/dst_ca.c b/drivers/media/dvb/bt8xx/dst_ca.c
index fa923b9b346e..c4ff1abc15c3 100644
--- a/drivers/media/dvb/bt8xx/dst_ca.c
+++ b/drivers/media/dvb/bt8xx/dst_ca.c
@@ -699,12 +699,12 @@ static struct dvb_device dvbdev_ca = {
699 .fops = &dst_ca_fops 699 .fops = &dst_ca_fops
700}; 700};
701 701
702int dst_ca_attach(struct dst_state *dst, struct dvb_adapter *dvb_adapter) 702ssize_t dst_ca_attach(struct dst_state *dst, struct dvb_adapter *dvb_adapter)
703{ 703{
704 struct dvb_device *dvbdev; 704 struct dvb_device *dvbdev;
705 dprintk(verbose, DST_CA_ERROR, 1, "registering DST-CA device"); 705 dprintk(verbose, DST_CA_ERROR, 1, "registering DST-CA device");
706 dvb_register_device(dvb_adapter, &dvbdev, &dvbdev_ca, dst, DVB_DEVICE_CA); 706 dvb_register_device(dvb_adapter, &dvbdev, &dvbdev_ca, dst, DVB_DEVICE_CA);
707 return 0; 707 return 1; // must return non-zero for dvb_attach() to work
708} 708}
709 709
710EXPORT_SYMBOL(dst_ca_attach); 710EXPORT_SYMBOL(dst_ca_attach);
diff --git a/drivers/media/dvb/bt8xx/dst_common.h b/drivers/media/dvb/bt8xx/dst_common.h
index 0677b047b3a7..383452f9e497 100644
--- a/drivers/media/dvb/bt8xx/dst_common.h
+++ b/drivers/media/dvb/bt8xx/dst_common.h
@@ -178,7 +178,7 @@ int write_dst(struct dst_state *state, u8 * data, u8 len);
178int read_dst(struct dst_state *state, u8 * ret, u8 len); 178int read_dst(struct dst_state *state, u8 * ret, u8 len);
179u8 dst_check_sum(u8 * buf, u32 len); 179u8 dst_check_sum(u8 * buf, u32 len);
180struct dst_state* dst_attach(struct dst_state* state, struct dvb_adapter *dvb_adapter); 180struct dst_state* dst_attach(struct dst_state* state, struct dvb_adapter *dvb_adapter);
181int dst_ca_attach(struct dst_state *state, struct dvb_adapter *dvb_adapter); 181ssize_t dst_ca_attach(struct dst_state *state, struct dvb_adapter *dvb_adapter);
182int dst_gpio_outb(struct dst_state* state, u32 mask, u32 enbb, u32 outhigh, int delay); 182int dst_gpio_outb(struct dst_state* state, u32 mask, u32 enbb, u32 outhigh, int delay);
183 183
184int dst_command(struct dst_state* state, u8 * data, u8 len); 184int dst_command(struct dst_state* state, u8 * data, u8 len);
diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
index b715b972d2fc..6f0bb7360991 100644
--- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c
+++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
@@ -67,7 +67,7 @@ static void dvb_bt8xx_task(unsigned long data)
67 67
68static int dvb_bt8xx_start_feed(struct dvb_demux_feed *dvbdmxfeed) 68static int dvb_bt8xx_start_feed(struct dvb_demux_feed *dvbdmxfeed)
69{ 69{
70 struct dvb_demux *dvbdmx = dvbdmxfeed->demux; 70 struct dvb_demux*dvbdmx = dvbdmxfeed->demux;
71 struct dvb_bt8xx_card *card = dvbdmx->priv; 71 struct dvb_bt8xx_card *card = dvbdmx->priv;
72 int rc; 72 int rc;
73 73
@@ -595,15 +595,14 @@ static void lgdt330x_reset(struct dvb_bt8xx_card *bt)
595 595
596static void frontend_init(struct dvb_bt8xx_card *card, u32 type) 596static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
597{ 597{
598 int ret;
599 struct dst_state* state = NULL; 598 struct dst_state* state = NULL;
600 599
601 switch(type) { 600 switch(type) {
602 case BTTV_BOARD_DVICO_DVBT_LITE: 601 case BTTV_BOARD_DVICO_DVBT_LITE:
603 card->fe = mt352_attach(&thomson_dtt7579_config, card->i2c_adapter); 602 card->fe = dvb_attach(mt352_attach, &thomson_dtt7579_config, card->i2c_adapter);
604 603
605 if (card->fe == NULL) 604 if (card->fe == NULL)
606 card->fe = zl10353_attach(&thomson_dtt7579_zl10353_config, 605 card->fe = dvb_attach(zl10353_attach, &thomson_dtt7579_zl10353_config,
607 card->i2c_adapter); 606 card->i2c_adapter);
608 607
609 if (card->fe != NULL) { 608 if (card->fe != NULL) {
@@ -615,7 +614,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
615 614
616 case BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE: 615 case BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE:
617 lgdt330x_reset(card); 616 lgdt330x_reset(card);
618 card->fe = lgdt330x_attach(&tdvs_tua6034_config, card->i2c_adapter); 617 card->fe = dvb_attach(lgdt330x_attach, &tdvs_tua6034_config, card->i2c_adapter);
619 if (card->fe != NULL) { 618 if (card->fe != NULL) {
620 card->fe->ops.tuner_ops.set_params = tdvs_tua6034_tuner_set_params; 619 card->fe->ops.tuner_ops.set_params = tdvs_tua6034_tuner_set_params;
621 dprintk ("dvb_bt8xx: lgdt330x detected\n"); 620 dprintk ("dvb_bt8xx: lgdt330x detected\n");
@@ -630,7 +629,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
630 629
631 /* Old Nebula (marked (c)2003 on high profile pci card) has nxt6000 demod */ 630 /* Old Nebula (marked (c)2003 on high profile pci card) has nxt6000 demod */
632 digitv_alps_tded4_reset(card); 631 digitv_alps_tded4_reset(card);
633 card->fe = nxt6000_attach(&vp3021_alps_tded4_config, card->i2c_adapter); 632 card->fe = dvb_attach(nxt6000_attach, &vp3021_alps_tded4_config, card->i2c_adapter);
634 if (card->fe != NULL) { 633 if (card->fe != NULL) {
635 card->fe->ops.tuner_ops.set_params = vp3021_alps_tded4_tuner_set_params; 634 card->fe->ops.tuner_ops.set_params = vp3021_alps_tded4_tuner_set_params;
636 dprintk ("dvb_bt8xx: an nxt6000 was detected on your digitv card\n"); 635 dprintk ("dvb_bt8xx: an nxt6000 was detected on your digitv card\n");
@@ -639,7 +638,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
639 638
640 /* New Nebula (marked (c)2005 on low profile pci card) has mt352 demod */ 639 /* New Nebula (marked (c)2005 on low profile pci card) has mt352 demod */
641 digitv_alps_tded4_reset(card); 640 digitv_alps_tded4_reset(card);
642 card->fe = mt352_attach(&digitv_alps_tded4_config, card->i2c_adapter); 641 card->fe = dvb_attach(mt352_attach, &digitv_alps_tded4_config, card->i2c_adapter);
643 642
644 if (card->fe != NULL) { 643 if (card->fe != NULL) {
645 card->fe->ops.tuner_ops.calc_regs = digitv_alps_tded4_tuner_calc_regs; 644 card->fe->ops.tuner_ops.calc_regs = digitv_alps_tded4_tuner_calc_regs;
@@ -648,14 +647,14 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
648 break; 647 break;
649 648
650 case BTTV_BOARD_AVDVBT_761: 649 case BTTV_BOARD_AVDVBT_761:
651 card->fe = sp887x_attach(&microtune_mt7202dtf_config, card->i2c_adapter); 650 card->fe = dvb_attach(sp887x_attach, &microtune_mt7202dtf_config, card->i2c_adapter);
652 if (card->fe) { 651 if (card->fe) {
653 card->fe->ops.tuner_ops.set_params = microtune_mt7202dtf_tuner_set_params; 652 card->fe->ops.tuner_ops.set_params = microtune_mt7202dtf_tuner_set_params;
654 } 653 }
655 break; 654 break;
656 655
657 case BTTV_BOARD_AVDVBT_771: 656 case BTTV_BOARD_AVDVBT_771:
658 card->fe = mt352_attach(&advbt771_samsung_tdtc9251dh0_config, card->i2c_adapter); 657 card->fe = dvb_attach(mt352_attach, &advbt771_samsung_tdtc9251dh0_config, card->i2c_adapter);
659 if (card->fe != NULL) { 658 if (card->fe != NULL) {
660 card->fe->ops.tuner_ops.calc_regs = advbt771_samsung_tdtc9251dh0_tuner_calc_regs; 659 card->fe->ops.tuner_ops.calc_regs = advbt771_samsung_tdtc9251dh0_tuner_calc_regs;
661 card->fe->ops.info.frequency_min = 174000000; 660 card->fe->ops.info.frequency_min = 174000000;
@@ -672,7 +671,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
672 state->bt = card->bt; 671 state->bt = card->bt;
673 672
674 /* DST is not a frontend, attaching the ASIC */ 673 /* DST is not a frontend, attaching the ASIC */
675 if ((dst_attach(state, &card->dvb_adapter)) == NULL) { 674 if (dvb_attach(dst_attach, state, &card->dvb_adapter) == NULL) {
676 printk("%s: Could not find a Twinhan DST.\n", __FUNCTION__); 675 printk("%s: Could not find a Twinhan DST.\n", __FUNCTION__);
677 break; 676 break;
678 } 677 }
@@ -681,11 +680,11 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
681 /* Attach other DST peripherals if any */ 680 /* Attach other DST peripherals if any */
682 /* Conditional Access device */ 681 /* Conditional Access device */
683 if (state->dst_hw_cap & DST_TYPE_HAS_CA) 682 if (state->dst_hw_cap & DST_TYPE_HAS_CA)
684 ret = dst_ca_attach(state, &card->dvb_adapter); 683 dvb_attach(dst_ca_attach, state, &card->dvb_adapter);
685 break; 684 break;
686 685
687 case BTTV_BOARD_PINNACLESAT: 686 case BTTV_BOARD_PINNACLESAT:
688 card->fe = cx24110_attach(&pctvsat_config, card->i2c_adapter); 687 card->fe = dvb_attach(cx24110_attach, &pctvsat_config, card->i2c_adapter);
689 if (card->fe) { 688 if (card->fe) {
690 card->fe->ops.tuner_ops.init = pinnsat_tuner_init; 689 card->fe->ops.tuner_ops.init = pinnsat_tuner_init;
691 card->fe->ops.tuner_ops.sleep = pinnsat_tuner_sleep; 690 card->fe->ops.tuner_ops.sleep = pinnsat_tuner_sleep;
@@ -694,7 +693,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
694 break; 693 break;
695 694
696 case BTTV_BOARD_PC_HDTV: 695 case BTTV_BOARD_PC_HDTV:
697 card->fe = or51211_attach(&or51211_config, card->i2c_adapter); 696 card->fe = dvb_attach(or51211_attach, &or51211_config, card->i2c_adapter);
698 break; 697 break;
699 } 698 }
700 699
@@ -707,8 +706,9 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
707 else 706 else
708 if (dvb_register_frontend(&card->dvb_adapter, card->fe)) { 707 if (dvb_register_frontend(&card->dvb_adapter, card->fe)) {
709 printk("dvb-bt8xx: Frontend registration failed!\n"); 708 printk("dvb-bt8xx: Frontend registration failed!\n");
710 if (card->fe->ops.release) 709 dvb_detach(card->fe->ops.release_sec, card->fe);
711 card->fe->ops.release(card->fe); 710 dvb_detach(card->fe->ops.tuner_ops.release, card->fe);
711 dvb_detach(card->fe->ops.release, card->fe);
712 card->fe = NULL; 712 card->fe = NULL;
713 } 713 }
714} 714}
@@ -925,8 +925,12 @@ static void dvb_bt8xx_remove(struct bttv_sub_device *sub)
925 card->demux.dmx.remove_frontend(&card->demux.dmx, &card->fe_hw); 925 card->demux.dmx.remove_frontend(&card->demux.dmx, &card->fe_hw);
926 dvb_dmxdev_release(&card->dmxdev); 926 dvb_dmxdev_release(&card->dmxdev);
927 dvb_dmx_release(&card->demux); 927 dvb_dmx_release(&card->demux);
928 if (card->fe) 928 if (card->fe) {
929 dvb_unregister_frontend(card->fe); 929 dvb_unregister_frontend(card->fe);
930 dvb_detach(card->fe->ops.release_sec, card->fe);
931 dvb_detach(card->fe->ops.tuner_ops.release, card->fe);
932 dvb_detach(card->fe->ops.release, card->fe);
933 }
930 dvb_unregister_adapter(&card->dvb_adapter); 934 dvb_unregister_adapter(&card->dvb_adapter);
931 935
932 kfree(card); 936 kfree(card);