PATCH 7/44 multiproto + backward compatibility [DST-BT8xx]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





diff -Naurp v4l-dvb/linux/drivers/media/dvb/bt8xx/dst.c mp-bc1/linux/drivers/media/dvb/bt8xx/dst.c
--- v4l-dvb/linux/drivers/media/dvb/bt8xx/dst.c	2006-06-30 19:59:10.000000000 +0400
+++ mp-bc1/linux/drivers/media/dvb/bt8xx/dst.c	2006-07-21 23:49:32.000000000 +0400
@@ -1690,7 +1690,7 @@ static int dst_tune_frontend(struct dvb_
 	return 0;
 }
 
-static int dst_get_tuning_algo(struct dvb_frontend *fe)
+static enum dvbfe_algo dst_get_tuning_algo(struct dvb_frontend *fe)
 {
 	return dst_algo;
 }
@@ -1761,6 +1761,162 @@ struct dst_state *dst_attach(struct dst_
 
 EXPORT_SYMBOL(dst_attach);
 
+static struct dvbfe_info dvbs_info	= {
+	.name 				= "DST DVB-S",
+	.delivery			= DVBFE_DELSYS_DVBS,
+	.delsys 			= {
+		.dvbs.modulation	= DVBFE_MOD_QPSK,
+		.dvbs.fec 		= DVBFE_FEC_AUTO,
+	},
+
+	.frequency_min 			= 950000,
+	.frequency_max 			= 2150000,
+	.frequency_step 		= 1000,
+	.frequency_tolerance 		= 29500,
+	.symbol_rate_min 		= 1000000,
+	.symbol_rate_max 		= 45000000,
+
+};
+
+static struct dvbfe_info dvbc_info	= {
+	.name				= "DST DVB-C",
+	.delivery			= DVBFE_DELSYS_DVBC,
+	.delsys 			= {
+		.dvbc.modulation	= DVBFE_MOD_QAMAUTO,
+	},
+
+	.frequency_step 		= 62500,
+	.frequency_min 			= 51000000,
+	.frequency_max 			= 858000000,
+	.symbol_rate_min 		= 1000000,
+	.symbol_rate_max 		= 45000000,
+};
+
+static struct dvbfe_info dvbt_info	= {
+	.name				= "DST DVB-T",
+	.delivery			= DVBFE_DELSYS_DVBT,
+	.delsys				= {
+		.dvbt.modulation	= DVBFE_MOD_OFDM,
+		.dvbt.stream_priority	= DVBFE_STREAM_PRIORITY_HP, 
+	},
+
+	.frequency_min 			= 137000000,
+	.frequency_max 			= 858000000,
+	.frequency_step 		= 166667,
+};
+
+static struct dvbfe_info atsc_info	= {
+	.name				= "DST ATSC",
+	.delivery			= DVBFE_DELSYS_ATSC,
+	.delsys				= {
+		.atsc.modulation	= DVBFE_MOD_VSB8,
+	},
+
+	.frequency_step 		= 62500,
+	.frequency_min 			= 510000000,
+	.frequency_max 			= 858000000,
+	.symbol_rate_min 		= 1000000,
+	.symbol_rate_max 		= 45000000,
+};
+
+static int dst_set_params(struct dvb_frontend *fe, struct dvbfe_params *fe_params)
+{
+	struct dst_state *state = fe->demodulator_priv;
+
+	if (fe_params != NULL) {
+		dst_set_freq(state, fe_params->frequency);
+		dprintk(verbose, DST_ERROR, 1, "Set Frequency=[%d]", fe_params->frequency);
+
+		if (state->dst_type == DST_TYPE_IS_SAT) {
+			if (state->type_flags & DST_TYPE_HAS_OBS_REGS)
+				dst_set_inversion(state, fe_params->inversion);
+			dst_set_fec(state, fe_params->delsys.dvbs.fec);
+			dst_set_symbolrate(state, fe_params->delsys.dvbs.symbol_rate);
+			dst_set_polarization(state);
+			dprintk(verbose, DST_DEBUG, 1, "Set Symbolrate=[%d]", fe_params->delsys.dvbs.symbol_rate);
+
+		} else if (state->dst_type == DST_TYPE_IS_TERR)
+			dst_set_bandwidth(state, fe_params->delsys.dvbt.bandwidth);
+		else if (state->dst_type == DST_TYPE_IS_CABLE) {
+			dst_set_fec(state, fe_params->delsys.dvbc.fec);
+			dst_set_symbolrate(state, fe_params->delsys.dvbc.symbol_rate);
+			dst_set_modulation(state, fe_params->delsys.dvbc.modulation);
+		}
+		dst_write_tuna(fe);
+	}
+
+	return 0;
+}
+
+static int dst_get_params(struct dvb_frontend *fe, struct dvbfe_params *fe_params)
+{
+	struct dst_state *state = fe->demodulator_priv;
+
+	fe_params->frequency = state->decode_freq;
+	if (state->dst_type == DST_TYPE_IS_SAT) {
+		if (state->type_flags & DST_TYPE_HAS_OBS_REGS)
+			fe_params->inversion = state->inversion;
+		fe_params->delsys.dvbs.symbol_rate = state->symbol_rate;
+		fe_params->delsys.dvbs.fec = dst_get_fec(state);
+	} else if (state->dst_type == DST_TYPE_IS_TERR) {
+		fe_params->delsys.dvbt.bandwidth = state->bandwidth;
+	} else if (state->dst_type == DST_TYPE_IS_CABLE) {
+		fe_params->delsys.dvbc.symbol_rate = state->symbol_rate;
+		fe_params->delsys.dvbc.fec = dst_get_fec(state);
+		fe_params->delsys.dvbc.modulation = dst_get_modulation(state);
+	}
+
+	return 0;
+}
+
+static int dst_get_info(struct dvb_frontend *fe, struct dvbfe_info *fe_info)
+{
+	struct dst_state *state = fe->demodulator_priv;
+
+	switch (state->dst_type) {
+	case DST_TYPE_IS_SAT:
+		memcpy(fe_info, &dvbs_info, sizeof (dvbs_info));
+		break;
+	case DST_TYPE_IS_CABLE:
+		memcpy(fe_info, &dvbc_info, sizeof (dvbc_info));
+		break;
+	case DST_TYPE_IS_TERR:
+		memcpy(fe_info, &dvbt_info, sizeof (dvbt_info));
+		break;
+	case DST_TYPE_IS_ATSC:
+		memcpy(fe_info, &atsc_info, sizeof (atsc_info));
+		break;
+	default:
+		break;
+	}
+
+	return 0;
+}
+
+static int dst_get_delsys(struct dvb_frontend *fe, enum dvbfe_delsys *fe_delsys)
+{
+	struct dst_state *state = fe->demodulator_priv;
+	
+	switch (state->dst_type) {
+	case DST_TYPE_IS_SAT:
+		*fe_delsys = DVBFE_DELSYS_DVBS;
+		break;
+	case DST_TYPE_IS_CABLE:
+		*fe_delsys = DVBFE_DELSYS_DVBC;
+		break;
+	case DST_TYPE_IS_TERR:
+		*fe_delsys = DVBFE_DELSYS_DVBT;
+		break;
+	case DST_TYPE_IS_ATSC:
+		*fe_delsys = DVBFE_DELSYS_ATSC;
+		break;
+	default:
+		break;
+	}
+
+	return 0;
+}
+
 static struct dvb_frontend_ops dst_dvbt_ops = {
 
 	.info = {
@@ -1781,6 +1937,11 @@ static struct dvb_frontend_ops dst_dvbt_
 	.read_status = dst_read_status,
 	.read_signal_strength = dst_read_signal_strength,
 	.read_snr = dst_read_snr,
+
+	.set_params = dst_set_params,
+	.get_params = dst_get_params,
+	.get_info = dst_get_info,
+	.get_delsys = dst_get_delsys,
 };
 
 static struct dvb_frontend_ops dst_dvbs_ops = {
@@ -1811,6 +1972,11 @@ static struct dvb_frontend_ops dst_dvbs_
 	.diseqc_send_master_cmd = dst_set_diseqc,
 	.set_voltage = dst_set_voltage,
 	.set_tone = dst_set_tone,
+
+	.set_params = dst_set_params,
+	.get_params = dst_get_params,
+	.get_info = dst_get_info,
+	.get_delsys = dst_get_delsys,
 };
 
 static struct dvb_frontend_ops dst_dvbc_ops = {
@@ -1836,6 +2002,11 @@ static struct dvb_frontend_ops dst_dvbc_
 	.read_status = dst_read_status,
 	.read_signal_strength = dst_read_signal_strength,
 	.read_snr = dst_read_snr,
+
+	.set_params = dst_set_params,
+	.get_params = dst_get_params,
+	.get_info = dst_get_info,
+	.get_delsys = dst_get_delsys,
 };
 
 static struct dvb_frontend_ops dst_atsc_ops = {
@@ -1859,6 +2030,11 @@ static struct dvb_frontend_ops dst_atsc_
 	.read_status = dst_read_status,
 	.read_signal_strength = dst_read_signal_strength,
 	.read_snr = dst_read_snr,
+
+	.set_params = dst_set_params,
+	.get_params = dst_get_params,
+	.get_info = dst_get_info,
+	.get_delsys = dst_get_delsys,
 };
 
 MODULE_DESCRIPTION("DST DVB-S/T/C/ATSC Combo Frontend driver");
diff -Naurp v4l-dvb/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c mp-bc1/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c
--- v4l-dvb/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c	2006-06-30 19:59:10.000000000 +0400
+++ mp-bc1/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c	2006-07-23 11:42:26.000000000 +0400
@@ -148,7 +148,7 @@ static int thomson_dtt7579_demod_init(st
 	return 0;
 }
 
-static int thomson_dtt7579_tuner_calc_regs(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf, int buf_len)
+static int thomson_dtt7579_tuner_calc_regs_compat(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf, int buf_len)
 {
 	u32 div;
 	unsigned char bs = 0;
@@ -191,7 +191,7 @@ static struct zl10353_config thomson_dtt
 	.demod_address = 0x0f,
 };
 
-static int cx24108_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
+static int cx24108_tuner_set_params_compat(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
 {
 	u32 freq = params->frequency;
 
@@ -267,7 +267,7 @@ static struct cx24110_config pctvsat_con
 	.demod_address = 0x55,
 };
 
-static int microtune_mt7202dtf_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
+static int microtune_mt7202dtf_tuner_set_params_compat(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
 {
 	struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *) fe->dvb->priv;
 	u8 cfg, cpump, band_select;
@@ -342,7 +342,7 @@ static int advbt771_samsung_tdtc9251dh0_
 	return 0;
 }
 
-static int advbt771_samsung_tdtc9251dh0_tuner_calc_regs(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf, int buf_len)
+static int advbt771_samsung_tdtc9251dh0_tuner_calc_regs_compat(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf, int buf_len)
 {
 	u32 div;
 	unsigned char bs = 0;
@@ -461,7 +461,7 @@ static struct or51211_config or51211_con
 	.sleep = or51211_sleep,
 };
 
-static int vp3021_alps_tded4_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
+static int vp3021_alps_tded4_tuner_set_params_compat(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
 {
 	struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *) fe->dvb->priv;
 	u8 buf[4];
@@ -513,7 +513,7 @@ static int digitv_alps_tded4_demod_init(
 	return 0;
 }
 
-static int digitv_alps_tded4_tuner_calc_regs(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf, int buf_len)
+static int digitv_alps_tded4_tuner_calc_regs_compat(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf, int buf_len)
 {
 	u32 div;
 	struct dvb_ofdm_parameters *op = &params->u.ofdm;
@@ -569,7 +569,14 @@ static struct mt352_config digitv_alps_t
 	.demod_init = digitv_alps_tded4_demod_init,
 };
 
-static int tdvs_tua6034_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
+static int tdvs_tua6034_tuner_set_params_compat(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
+{
+	struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *) fe->dvb->priv;
+	return lg_h06xf_pll_set_compat(fe, card->i2c_adapter, params);
+}
+
+static int tdvs_tua6034_tuner_set_params(struct dvb_frontend* fe,
+					 struct dvbfe_params* params)
 {
 	struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *) fe->dvb->priv;
 	return lg_h06xf_pll_set(fe, card->i2c_adapter, params);
@@ -608,7 +615,7 @@ static void frontend_init(struct dvb_bt8
 						  card->i2c_adapter);
 
 		if (card->fe != NULL) {
-			card->fe->ops.tuner_ops.calc_regs = thomson_dtt7579_tuner_calc_regs;
+			card->fe->ops.tuner_ops.calc_regs_compat = thomson_dtt7579_tuner_calc_regs_compat;
 			card->fe->ops.info.frequency_min = 174000000;
 			card->fe->ops.info.frequency_max = 862000000;
 		}
@@ -618,6 +625,7 @@ static void frontend_init(struct dvb_bt8
 		lgdt330x_reset(card);
 		card->fe = lgdt330x_attach(&tdvs_tua6034_config, card->i2c_adapter);
 		if (card->fe != NULL) {
+			card->fe->ops.tuner_ops.set_params_compat = tdvs_tua6034_tuner_set_params_compat;
 			card->fe->ops.tuner_ops.set_params = tdvs_tua6034_tuner_set_params;
 			dprintk ("dvb_bt8xx: lgdt330x detected\n");
 		}
@@ -633,7 +641,7 @@ static void frontend_init(struct dvb_bt8
 		digitv_alps_tded4_reset(card);
 		card->fe = 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;
+			card->fe->ops.tuner_ops.set_params_compat = vp3021_alps_tded4_tuner_set_params_compat;
 			dprintk ("dvb_bt8xx: an nxt6000 was detected on your digitv card\n");
 			break;
 		}
@@ -643,7 +651,7 @@ static void frontend_init(struct dvb_bt8
 		card->fe = 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;
+			card->fe->ops.tuner_ops.calc_regs_compat = digitv_alps_tded4_tuner_calc_regs_compat;
 			dprintk ("dvb_bt8xx: an mt352 was detected on your digitv card\n");
 		}
 		break;
@@ -651,14 +659,14 @@ static void frontend_init(struct dvb_bt8
 	case BTTV_BOARD_AVDVBT_761:
 		card->fe = sp887x_attach(&microtune_mt7202dtf_config, card->i2c_adapter);
 		if (card->fe) {
-			card->fe->ops.tuner_ops.set_params = microtune_mt7202dtf_tuner_set_params;
+			card->fe->ops.tuner_ops.set_params_compat = microtune_mt7202dtf_tuner_set_params_compat;
 		}
 		break;
 
 	case BTTV_BOARD_AVDVBT_771:
 		card->fe = 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.tuner_ops.calc_regs_compat = advbt771_samsung_tdtc9251dh0_tuner_calc_regs_compat;
 			card->fe->ops.info.frequency_min = 174000000;
 			card->fe->ops.info.frequency_max = 862000000;
 		}
@@ -690,7 +698,7 @@ static void frontend_init(struct dvb_bt8
 		if (card->fe) {
 			card->fe->ops.tuner_ops.init = pinnsat_tuner_init;
 			card->fe->ops.tuner_ops.sleep = pinnsat_tuner_sleep;
-			card->fe->ops.tuner_ops.set_params = cx24108_tuner_set_params;
+			card->fe->ops.tuner_ops.set_params_compat = cx24108_tuner_set_params_compat;
 		}
 		break;
 


_______________________________________________

linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux