Mailing List archive

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

[linux-dvb] Re: Correction & Experimental patch against ves1x93



On Fri, Aug 13, 2004 at 01:34:36PM +0200, Johannes Stezenbach wrote:

> I lost track of this thread :-(, and I also hoped that the
> authors of the ves1x93 driver would comment on this.

I think he has already :-)

> If someone sends me a clean patch which applies to
> current CVS and doesn't break things for me, then I
> will apply it.

I hope this attachment one is good enough...

--- ves1x93.c	2004-07-16 17:42:28.701164408 +0200
+++ ves1x93.c	2004-08-13 21:01:14.134332240 +0200
@@ -51,7 +51,7 @@
 	.type			= FE_QPSK,
 	.frequency_min		= 950000,
 	.frequency_max		= 2150000,
-	.frequency_stepsize	= 250,		 /* kHz for QPSK frontends */
+	.frequency_stepsize	= 125,		 /* kHz for QPSK frontends */
 	.frequency_tolerance	= 29500,
 	.symbol_rate_min	= 1000000,
 	.symbol_rate_max	= 45000000,
@@ -173,10 +173,20 @@
  *   set up the downconverter frequency divisor for a
  *   reference clock comparision frequency of 125 kHz.
  */
-static int sp5659_set_tv_freq (struct i2c_adapter *i2c, u32 freq, u8 pwr)
+static int sp5659_set_tv_freq (struct i2c_adapter *i2c, u32 freq)
 {
+	u8 pwr = 0;
+
 	u32 div = (freq + 479500) / 125;
-	u8 buf [4] = { (div >> 8) & 0x7f, div & 0xff, 0x95, (pwr << 5) | 0x30 };
+
+	if (freq > 2000000)
+		pwr = 3;
+	if ((freq < 1100000)||((freq <= 2000000)&&(freq > 1800000)))
+		pwr = 2;
+	if (((freq >= 1100000)&&(freq <= 1200000))||((freq > 1600000)&&(freq <=1800000)))
+		pwr = 1;
+
+	u8 buf [4] = { (div >> 8) & 0x7f, div & 0xff, 0x95, (pwr << 6) | 0x30 };
 
 	return tuner_write (i2c, buf, sizeof(buf));
 }
@@ -198,10 +208,10 @@
 }
 
 
-static int tuner_set_tv_freq (struct i2c_adapter *i2c, u32 freq, u8 pwr)
+static int tuner_set_tv_freq (struct i2c_adapter *i2c, u32 freq)
 {
 	if ((demod_type == DEMOD_VES1893) && (board_type == BOARD_SIEMENS_PCI))
-		return sp5659_set_tv_freq (i2c, freq, pwr);
+		return sp5659_set_tv_freq (i2c, freq);
 	else if (demod_type == DEMOD_VES1993)
 		return tsa5059_set_tv_freq (i2c, freq);
 
@@ -255,9 +265,10 @@
 
 static int ves1x93_clr_bit (struct i2c_adapter *i2c)
 {
+	dvb_delay(10);
 	ves1x93_writereg (i2c, 0, init_1x93_tab[0] & 0xfe);
 	ves1x93_writereg (i2c, 0, init_1x93_tab[0]);
-	dvb_delay(5);
+	dvb_delay(50);
 	return 0;
 }
 
@@ -265,7 +276,7 @@
 {
 	ves1x93_writereg (i2c, 3, 0x00);
 	ves1x93_writereg (i2c, 3, init_1x93_tab[3]);
-	dvb_delay(5);
+	dvb_delay(50);
 	return 0;
 }
 
@@ -429,7 +440,7 @@
 	
 		freq -= afc;
 
-		tuner_set_tv_freq (i2c, freq, 0);
+		tuner_set_tv_freq (i2c, freq);
 
 		ves1x93_init_aquire (i2c);
 	}
@@ -528,11 +539,10 @@
 	{
 		struct dvb_frontend_parameters *p = arg;
 
-		tuner_set_tv_freq (i2c, p->frequency, 0);
+		tuner_set_tv_freq (i2c, p->frequency);
 		ves1x93_set_inversion (i2c, p->inversion);
 		ves1x93_set_fec (i2c, p->u.qpsk.fec_inner);
 		ves1x93_set_symbolrate (i2c, p->u.qpsk.symbol_rate);
-		ves1x93_afc (i2c, p->frequency, p->u.qpsk.symbol_rate);	    
 		state->inversion = p->inversion;
 		break;
 	}

-- 
	Grégoire Favre
________________________________________________________________________
http://magma.epfl.ch/greg ICQ:16624071 mailto:Gregoire.Favre@freesurf.ch




Home | Main Index | Thread Index