diff options
Diffstat (limited to 'drivers/media/dvb/bt8xx')
-rw-r--r-- | drivers/media/dvb/bt8xx/Kconfig | 14 | ||||
-rw-r--r-- | drivers/media/dvb/bt8xx/dst.c | 9 | ||||
-rw-r--r-- | drivers/media/dvb/bt8xx/dst_ca.c | 11 | ||||
-rw-r--r-- | drivers/media/dvb/bt8xx/dst_common.h | 3 | ||||
-rw-r--r-- | drivers/media/dvb/bt8xx/dvb-bt8xx.c | 37 |
5 files changed, 44 insertions, 30 deletions
diff --git a/drivers/media/dvb/bt8xx/Kconfig b/drivers/media/dvb/bt8xx/Kconfig index 7d0ee1ab290..ae2ff5dc238 100644 --- a/drivers/media/dvb/bt8xx/Kconfig +++ b/drivers/media/dvb/bt8xx/Kconfig @@ -2,13 +2,13 @@ config DVB_BT8XX tristate "BT8xx based PCI cards" depends on DVB_CORE && PCI && I2C && VIDEO_BT848 select DVB_PLL - select DVB_MT352 - select DVB_SP887X - select DVB_NXT6000 - select DVB_CX24110 - select DVB_OR51211 - select DVB_LGDT330X - select DVB_ZL10353 + select DVB_MT352 if !DVB_FE_CUSTOMISE + select DVB_SP887X if !DVB_FE_CUSTOMISE + select DVB_NXT6000 if !DVB_FE_CUSTOMISE + select DVB_CX24110 if !DVB_FE_CUSTOMISE + select DVB_OR51211 if !DVB_FE_CUSTOMISE + select DVB_LGDT330X if !DVB_FE_CUSTOMISE + select DVB_ZL10353 if !DVB_FE_CUSTOMISE select FW_LOADER help Support for PCI cards based on the Bt8xx PCI bridge. Examples are diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c index 06ac899a9a2..9f72b7000c0 100644 --- a/drivers/media/dvb/bt8xx/dst.c +++ b/drivers/media/dvb/bt8xx/dst.c @@ -1715,6 +1715,15 @@ static int dst_get_frontend(struct dvb_frontend *fe, struct dvb_frontend_paramet static void dst_release(struct dvb_frontend *fe) { struct dst_state *state = fe->demodulator_priv; + if (state->dst_ca) { + dvb_unregister_device(state->dst_ca); +#ifdef CONFIG_DVB_CORE_ATTACH + symbol_put(dst_ca_attach); +#endif + } +#ifdef CONFIG_DVB_CORE_ATTACH + symbol_put(dst_attach); +#endif kfree(state); } diff --git a/drivers/media/dvb/bt8xx/dst_ca.c b/drivers/media/dvb/bt8xx/dst_ca.c index fa923b9b346..240ad084fa7 100644 --- a/drivers/media/dvb/bt8xx/dst_ca.c +++ b/drivers/media/dvb/bt8xx/dst_ca.c @@ -699,12 +699,17 @@ static struct dvb_device dvbdev_ca = { .fops = &dst_ca_fops }; -int dst_ca_attach(struct dst_state *dst, struct dvb_adapter *dvb_adapter) +struct dvb_device *dst_ca_attach(struct dst_state *dst, struct dvb_adapter *dvb_adapter) { struct dvb_device *dvbdev; + dprintk(verbose, DST_CA_ERROR, 1, "registering DST-CA device"); - dvb_register_device(dvb_adapter, &dvbdev, &dvbdev_ca, dst, DVB_DEVICE_CA); - return 0; + if (dvb_register_device(dvb_adapter, &dvbdev, &dvbdev_ca, dst, DVB_DEVICE_CA) == 0) { + dst->dst_ca = dvbdev; + return dst->dst_ca; + } + + return NULL; } EXPORT_SYMBOL(dst_ca_attach); diff --git a/drivers/media/dvb/bt8xx/dst_common.h b/drivers/media/dvb/bt8xx/dst_common.h index 0677b047b3a..3bf084f2e52 100644 --- a/drivers/media/dvb/bt8xx/dst_common.h +++ b/drivers/media/dvb/bt8xx/dst_common.h @@ -140,6 +140,7 @@ struct dst_state { char *tuner_name; struct mutex dst_mutex; u8 fw_name[8]; + struct dvb_device *dst_ca; }; struct tuner_types { @@ -178,7 +179,7 @@ int write_dst(struct dst_state *state, u8 * data, u8 len); int read_dst(struct dst_state *state, u8 * ret, u8 len); u8 dst_check_sum(u8 * buf, u32 len); struct dst_state* dst_attach(struct dst_state* state, struct dvb_adapter *dvb_adapter); -int dst_ca_attach(struct dst_state *state, struct dvb_adapter *dvb_adapter); +struct dvb_device *dst_ca_attach(struct dst_state *state, struct dvb_adapter *dvb_adapter); int dst_gpio_outb(struct dst_state* state, u32 mask, u32 enbb, u32 outhigh, int delay); int 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 b715b972d2f..fb6c4cc8477 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) static int dvb_bt8xx_start_feed(struct dvb_demux_feed *dvbdmxfeed) { - struct dvb_demux *dvbdmx = dvbdmxfeed->demux; + struct dvb_demux*dvbdmx = dvbdmxfeed->demux; struct dvb_bt8xx_card *card = dvbdmx->priv; int rc; @@ -595,15 +595,14 @@ static void lgdt330x_reset(struct dvb_bt8xx_card *bt) static void frontend_init(struct dvb_bt8xx_card *card, u32 type) { - int ret; struct dst_state* state = NULL; switch(type) { case BTTV_BOARD_DVICO_DVBT_LITE: - card->fe = mt352_attach(&thomson_dtt7579_config, card->i2c_adapter); + card->fe = dvb_attach(mt352_attach, &thomson_dtt7579_config, card->i2c_adapter); if (card->fe == NULL) - card->fe = zl10353_attach(&thomson_dtt7579_zl10353_config, + card->fe = dvb_attach(zl10353_attach, &thomson_dtt7579_zl10353_config, card->i2c_adapter); if (card->fe != NULL) { @@ -615,7 +614,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) case BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE: lgdt330x_reset(card); - card->fe = lgdt330x_attach(&tdvs_tua6034_config, card->i2c_adapter); + card->fe = dvb_attach(lgdt330x_attach, &tdvs_tua6034_config, card->i2c_adapter); if (card->fe != NULL) { card->fe->ops.tuner_ops.set_params = tdvs_tua6034_tuner_set_params; dprintk ("dvb_bt8xx: lgdt330x detected\n"); @@ -630,7 +629,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) /* Old Nebula (marked (c)2003 on high profile pci card) has nxt6000 demod */ digitv_alps_tded4_reset(card); - card->fe = nxt6000_attach(&vp3021_alps_tded4_config, card->i2c_adapter); + card->fe = dvb_attach(nxt6000_attach, &vp3021_alps_tded4_config, card->i2c_adapter); if (card->fe != NULL) { card->fe->ops.tuner_ops.set_params = vp3021_alps_tded4_tuner_set_params; 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) /* New Nebula (marked (c)2005 on low profile pci card) has mt352 demod */ digitv_alps_tded4_reset(card); - card->fe = mt352_attach(&digitv_alps_tded4_config, card->i2c_adapter); + card->fe = dvb_attach(mt352_attach, &digitv_alps_tded4_config, card->i2c_adapter); if (card->fe != NULL) { 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) break; case BTTV_BOARD_AVDVBT_761: - card->fe = sp887x_attach(µtune_mt7202dtf_config, card->i2c_adapter); + card->fe = dvb_attach(sp887x_attach, µtune_mt7202dtf_config, card->i2c_adapter); if (card->fe) { card->fe->ops.tuner_ops.set_params = microtune_mt7202dtf_tuner_set_params; } break; case BTTV_BOARD_AVDVBT_771: - card->fe = mt352_attach(&advbt771_samsung_tdtc9251dh0_config, card->i2c_adapter); + card->fe = dvb_attach(mt352_attach, &advbt771_samsung_tdtc9251dh0_config, card->i2c_adapter); if (card->fe != NULL) { card->fe->ops.tuner_ops.calc_regs = advbt771_samsung_tdtc9251dh0_tuner_calc_regs; card->fe->ops.info.frequency_min = 174000000; @@ -670,22 +669,21 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) state->config = &dst_config; state->i2c = card->i2c_adapter; state->bt = card->bt; - + state->dst_ca = NULL; /* DST is not a frontend, attaching the ASIC */ - if ((dst_attach(state, &card->dvb_adapter)) == NULL) { + if (dvb_attach(dst_attach, state, &card->dvb_adapter) == NULL) { printk("%s: Could not find a Twinhan DST.\n", __FUNCTION__); break; } - card->fe = &state->frontend; - /* Attach other DST peripherals if any */ /* Conditional Access device */ + card->fe = &state->frontend; if (state->dst_hw_cap & DST_TYPE_HAS_CA) - ret = dst_ca_attach(state, &card->dvb_adapter); + dvb_attach(dst_ca_attach, state, &card->dvb_adapter); break; case BTTV_BOARD_PINNACLESAT: - card->fe = cx24110_attach(&pctvsat_config, card->i2c_adapter); + card->fe = dvb_attach(cx24110_attach, &pctvsat_config, card->i2c_adapter); if (card->fe) { card->fe->ops.tuner_ops.init = pinnsat_tuner_init; card->fe->ops.tuner_ops.sleep = pinnsat_tuner_sleep; @@ -694,7 +692,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) break; case BTTV_BOARD_PC_HDTV: - card->fe = or51211_attach(&or51211_config, card->i2c_adapter); + card->fe = dvb_attach(or51211_attach, &or51211_config, card->i2c_adapter); break; } @@ -707,8 +705,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) else if (dvb_register_frontend(&card->dvb_adapter, card->fe)) { printk("dvb-bt8xx: Frontend registration failed!\n"); - if (card->fe->ops.release) - card->fe->ops.release(card->fe); + dvb_frontend_detach(card->fe); card->fe = NULL; } } @@ -925,8 +922,10 @@ static void dvb_bt8xx_remove(struct bttv_sub_device *sub) card->demux.dmx.remove_frontend(&card->demux.dmx, &card->fe_hw); dvb_dmxdev_release(&card->dmxdev); dvb_dmx_release(&card->demux); - if (card->fe) + if (card->fe) { dvb_unregister_frontend(card->fe); + dvb_frontend_detach(card->fe); + } dvb_unregister_adapter(&card->dvb_adapter); kfree(card); |