PATCH 26/44 multiproto + backward compatibility [OR51211]

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

 



--- v4l-dvb/linux/drivers/media/dvb/frontends/or51211.c	2006-06-30 19:59:10.000000000 +0400
+++ mp-bc1/linux/drivers/media/dvb/frontends/or51211.c	2006-07-23 11:39:58.000000000 +0400
@@ -263,6 +263,52 @@ static int or51211_set_parameters(struct
 	return 0;
 }
 
+static int or51211_set_params(struct dvb_frontend* fe,
+			      struct dvbfe_params *param)
+{
+	struct or51211_state* state = fe->demodulator_priv;
+	u32 freq = 0;
+	u16 tunerfreq = 0;
+	u8 buf[4];
+
+	/* Change only if we are actually changing the channel */
+	if (state->current_frequency != param->frequency) {
+		freq = 44000 + (param->frequency/1000);
+		tunerfreq = freq * 16/1000;
+
+		dprintk("set_parameters frequency = %d (tunerfreq = %d)\n",
+			param->frequency,tunerfreq);
+
+		buf[0] = (tunerfreq >> 8) & 0x7F;
+		buf[1] = (tunerfreq & 0xFF);
+		buf[2] = 0x8E;
+
+		if (param->frequency < 157250000) {
+			buf[3] = 0xA0;
+			dprintk("set_parameters VHF low range\n");
+		} else if (param->frequency < 454000000) {
+			buf[3] = 0x90;
+			dprintk("set_parameters VHF high range\n");
+		} else {
+			buf[3] = 0x30;
+			dprintk("set_parameters UHF range\n");
+		}
+		dprintk("set_parameters tuner bytes: 0x%02x 0x%02x "
+			"0x%02x 0x%02x\n",buf[0],buf[1],buf[2],buf[3]);
+
+		if (i2c_writebytes(state,0xC2>>1,buf,4))
+			printk(KERN_WARNING "or51211:set_parameters error "
+			       "writing to tuner\n");
+
+		/* Set to ATSC mode */
+		or51211_setmode(fe,0);
+
+		/* Update current frequency */
+		state->current_frequency = param->frequency;
+	}
+	return 0;
+}
+
 static int or51211_read_status(struct dvb_frontend* fe, fe_status_t* status)
 {
 	struct or51211_state* state = fe->demodulator_priv;
@@ -597,6 +643,32 @@ error:
 	return NULL;
 }
 
+static struct dvbfe_info atsc_info	= {
+	.name				= "Oren OR51211 ATSC",
+	.delivery			= DVBFE_DELSYS_ATSC,
+	.delsys				= {
+		.atsc.modulation	= DVBFE_MOD_VSB8
+	},
+
+	.frequency_min			= 44000000,
+	.frequency_max			= 958000000,
+	.frequency_step			= 166666,
+};
+
+static int or51211_get_info(struct dvb_frontend *fe, struct dvbfe_info *fe_info)
+{
+	memcpy(fe_info, &atsc_info, sizeof (atsc_info));
+
+	return 0;
+}
+
+static int or51211_get_delsys(struct dvb_frontend *fe, enum dvbfe_delsys *fe_delsys)
+{
+	*fe_delsys = DVBFE_DELSYS_ATSC;
+
+	return 0;
+}
+
 static struct dvb_frontend_ops or51211_ops = {
 
 	.info = {
@@ -623,6 +695,10 @@ static struct dvb_frontend_ops or51211_o
 	.read_signal_strength = or51211_read_signal_strength,
 	.read_snr = or51211_read_snr,
 	.read_ucblocks = or51211_read_ucblocks,
+
+	.set_params	= or51211_set_params,
+	.get_info	= or51211_get_info,
+	.get_delsys	= or51211_get_delsys,
 };
 
 module_param(debug, int, 0644);
@@ -633,4 +709,3 @@ MODULE_AUTHOR("Kirk Lapray");
 MODULE_LICENSE("GPL");
 
 EXPORT_SYMBOL(or51211_attach);
-
_______________________________________________

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