Commit 2bfe031d authored by Andrew de Quincey's avatar Andrew de Quincey Committed by Mauro Carvalho Chehab
Browse files

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: default avatarAndrew de Quincey <adq_dvb@lidskialf.net>
Acked-by: default avatarMichael Krufky <mkrufky@linuxtv.org>
Acked-by: default avatarTrent Piepho <xyzzy@speakeasy.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent d9955060
Loading
Loading
Loading
Loading
+15 −11
Original line number Diff line number Diff line
@@ -505,7 +505,7 @@ int flexcop_frontend_init(struct flexcop_device *fc)
	struct dvb_frontend_ops *ops;

	/* try the sky v2.6 (stv0299/Samsung tbmu24112(sl1935)) */
	if ((fc->fe = stv0299_attach(&samsung_tbmu24112_config, &fc->i2c_adap)) != NULL) {
	if ((fc->fe = dvb_attach(stv0299_attach, &samsung_tbmu24112_config, &fc->i2c_adap)) != NULL) {
		ops = &fc->fe->ops;

		ops->tuner_ops.set_params = samsung_tbmu24112_tuner_set_params;
@@ -519,36 +519,36 @@ int flexcop_frontend_init(struct flexcop_device *fc)
		info("found the stv0299 at i2c address: 0x%02x",samsung_tbmu24112_config.demod_address);
	} else
	/* try the air dvb-t (mt352/Samsung tdtc9251dh0(??)) */
	if ((fc->fe = mt352_attach(&samsung_tdtc9251dh0_config, &fc->i2c_adap)) != NULL ) {
	if ((fc->fe = dvb_attach(mt352_attach, &samsung_tdtc9251dh0_config, &fc->i2c_adap)) != NULL ) {
		fc->dev_type          = FC_AIR_DVB;
		fc->fe->ops.tuner_ops.calc_regs = samsung_tdtc9251dh0_calc_regs;
		info("found the mt352 at i2c address: 0x%02x",samsung_tdtc9251dh0_config.demod_address);
	} else
	/* try the air atsc 2nd generation (nxt2002) */
	if ((fc->fe = nxt200x_attach(&samsung_tbmv_config, &fc->i2c_adap)) != NULL) {
	if ((fc->fe = dvb_attach(nxt200x_attach, &samsung_tbmv_config, &fc->i2c_adap)) != NULL) {
		fc->dev_type          = FC_AIR_ATSC2;
		dvb_attach(dvb_pll_attach, fc->fe, 0x61, &fc->i2c_adap, &dvb_pll_samsung_tbmv);
		info("found the nxt2002 at i2c address: 0x%02x",samsung_tbmv_config.demod_address);
	} else
	/* try the air atsc 3nd generation (lgdt3303) */
	if ((fc->fe = lgdt330x_attach(&air2pc_atsc_hd5000_config, &fc->i2c_adap)) != NULL) {
	if ((fc->fe = dvb_attach(lgdt330x_attach, &air2pc_atsc_hd5000_config, &fc->i2c_adap)) != NULL) {
		fc->dev_type          = FC_AIR_ATSC3;
		fc->fe->ops.tuner_ops.set_params = lgdt3303_tuner_set_params;
		info("found the lgdt3303 at i2c address: 0x%02x",air2pc_atsc_hd5000_config.demod_address);
	} else
	/* try the air atsc 1nd generation (bcm3510)/panasonic ct10s */
	if ((fc->fe = bcm3510_attach(&air2pc_atsc_first_gen_config, &fc->i2c_adap)) != NULL) {
	if ((fc->fe = dvb_attach(bcm3510_attach, &air2pc_atsc_first_gen_config, &fc->i2c_adap)) != NULL) {
		fc->dev_type          = FC_AIR_ATSC1;
		info("found the bcm3510 at i2c address: 0x%02x",air2pc_atsc_first_gen_config.demod_address);
	} else
	/* try the cable dvb (stv0297) */
	if ((fc->fe = stv0297_attach(&alps_tdee4_stv0297_config, &fc->i2c_adap)) != NULL) {
	if ((fc->fe = dvb_attach(stv0297_attach, &alps_tdee4_stv0297_config, &fc->i2c_adap)) != NULL) {
		fc->dev_type                        = FC_CABLE;
		fc->fe->ops.tuner_ops.set_params = alps_tdee4_stv0297_tuner_set_params;
		info("found the stv0297 at i2c address: 0x%02x",alps_tdee4_stv0297_config.demod_address);
	} else
	/* try the sky v2.3 (vp310/Samsung tbdu18132(tsa5059)) */
	if ((fc->fe = vp310_mt312_attach(&skystar23_samsung_tbdu18132_config, &fc->i2c_adap)) != NULL) {
	if ((fc->fe = dvb_attach(vp310_mt312_attach, &skystar23_samsung_tbdu18132_config, &fc->i2c_adap)) != NULL) {
		ops = &fc->fe->ops;

		ops->tuner_ops.set_params = skystar23_samsung_tbdu18132_tuner_set_params;
@@ -571,9 +571,9 @@ int flexcop_frontend_init(struct flexcop_device *fc)
	} else {
		if (dvb_register_frontend(&fc->dvb_adapter, fc->fe)) {
			err("frontend registration failed!");
			ops = &fc->fe->ops;
			if (ops->release != NULL)
				ops->release(fc->fe);
			dvb_detach(fc->fe->ops.release_sec, fc->fe);
			dvb_detach(fc->fe->ops.tuner_ops.release, fc->fe);
			dvb_detach(fc->fe->ops.release, fc->fe);
			fc->fe = NULL;
			return -EINVAL;
		}
@@ -584,8 +584,12 @@ int flexcop_frontend_init(struct flexcop_device *fc)

void flexcop_frontend_exit(struct flexcop_device *fc)
{
	if (fc->init_state & FC_STATE_FE_INIT)
	if (fc->init_state & FC_STATE_FE_INIT) {
		dvb_unregister_frontend(fc->fe);
		dvb_detach(fc->fe->ops.release_sec, fc->fe);
		dvb_detach(fc->fe->ops.tuner_ops.release, fc->fe);
		dvb_detach(fc->fe->ops.release, fc->fe);
	}

	fc->init_state &= ~FC_STATE_FE_INIT;
}
+4 −0
Original line number Diff line number Diff line
@@ -1715,6 +1715,10 @@ 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_hw_cap & DST_TYPE_HAS_CA)
		symbol_put(dst_ca_attach);

	kfree(state);
}

+2 −2
Original line number Diff line number Diff line
@@ -699,12 +699,12 @@ static struct dvb_device dvbdev_ca = {
	.fops = &dst_ca_fops
};

int dst_ca_attach(struct dst_state *dst, struct dvb_adapter *dvb_adapter)
ssize_t 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;
	return 1; // must return non-zero for dvb_attach() to work
}

EXPORT_SYMBOL(dst_ca_attach);
+1 −1
Original line number Diff line number Diff line
@@ -178,7 +178,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);
ssize_t 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);
+20 −16
Original line number Diff line number Diff line
@@ -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(&microtune_mt7202dtf_config, card->i2c_adapter);
		card->fe = dvb_attach(sp887x_attach, &microtune_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;
@@ -672,7 +671,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
		state->bt = card->bt;

		/*	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;
		}
@@ -681,11 +680,11 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
		/*	Attach other DST peripherals if any		*/
		/*	Conditional Access device			*/
		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 +693,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 +706,9 @@ 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_detach(card->fe->ops.release_sec, card->fe);
			dvb_detach(card->fe->ops.tuner_ops.release, card->fe);
			dvb_detach(card->fe->ops.release, card->fe);
			card->fe = NULL;
		}
}
@@ -925,8 +925,12 @@ 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_detach(card->fe->ops.release_sec, card->fe);
		dvb_detach(card->fe->ops.tuner_ops.release, card->fe);
		dvb_detach(card->fe->ops.release, card->fe);
	}
	dvb_unregister_adapter(&card->dvb_adapter);

	kfree(card);
Loading