Mailing List archive

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

[linux-dvb] [PATCH] ves1893 inversion and inittab



hi,

it seems to me, that inversion is not handled correctly in the ves1893
driver. :-)

1.) inv. on/off are swapped and auto has the inversion bit set, which is
unneeded.

2.) FE_GET_FRONTEND does not check whether auto inversion was used or
not. reading the inversion status bit is invalid when auto inversion was
not used.

this patch additionally removes enabling of 13V by the inittab. this is
incompatible to other boards than the pci ones. it will be set to some
voltage while tuning anyway.

if you own a pci card with a ves1893 (alps bsrv2) then please test this
patch. it has only been tested on a nokia dbox2-s, where the driver
reports inversion settings correctly now.

regards,
andreas

Index: alps_bsrv2.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/frontends/alps_bsrv2.c,v
retrieving revision 1.7
diff -u -p -r1.7 alps_bsrv2.c
--- alps_bsrv2.c	8 May 2003 13:50:13 -0000	1.7
+++ alps_bsrv2.c	26 May 2003 09:45:42 -0000
@@ -58,7 +58,7 @@ u8 init_1893_tab [] = {
         0x01, 0xA4, 0x35, 0x81, 0x2A, 0x0d, 0x55, 0xC4,
         0x09, 0x69, 0x00, 0x86, 0x4c, 0x28, 0x7F, 0x00,
         0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,	
-        0x80, 0x00, 0x31, 0xb0, 0x14, 0x00, 0xDC, 0x20,
+        0x80, 0x00, 0x31, 0xb0, 0x14, 0x00, 0xDC, 0x00,
         0x81, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
         0x00, 0x55, 0x00, 0x00, 0x7f, 0x00
@@ -171,19 +171,22 @@ int ves1893_set_inversion (struct dvb_i2
 
 	switch (inversion) {
 	case INVERSION_OFF:
-		val = 0xc0;
+		val = 0x80;
 		break;
 	case INVERSION_ON:
-		val = 0x80;
+		val = 0xc0;
 		break;
 	case INVERSION_AUTO:
-		val = 0x40;
+		val = 0x00;
 		break;
 	default:
 		return -EINVAL;
 	}
 
-	return ves1893_writereg (i2c, 0x0c, (init_1893_tab[0x0c] & 0x3f) | val);
+	/* needs to be saved for FE_GET_FRONTEND */
+	init_1893_tab[0x0c] = (init_1893_tab[0x0c] & 0x3f) | val;
+
+	return ves1893_writereg (i2c, 0x0c, init_1893_tab[0x0c]);
 }
 
 
@@ -399,7 +402,13 @@ int bsrv2_ioctl (struct dvb_frontend *fe
 		afc = (afc * (int)(p->u.qpsk.symbol_rate/1000/8))/16;
 
 		p->frequency -= afc;
-		p->inversion = (ves1893_readreg (i2c, 0x0f) & 2) ? 
+
+		/*
+		 * inversion indicator is only valid
+		 * if auto inversion was used
+		 */
+		if (!(init_1893_tab[0x0c] & 0x80))
+			p->inversion = (ves1893_readreg (i2c, 0x0f) & 2) ? 
 					INVERSION_ON : INVERSION_OFF;
 		p->u.qpsk.fec_inner = ves1893_get_fec (i2c);
 	/*  XXX FIXME: timing offset !! */

Home | Main Index | Thread Index