Re: Switching audio offset on tda9887-based PCTV? - patch.

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



Hi all,
I've no idea if this is useful to anyone but me, but I've done the
"quick and dirty" hack I mentioned about switching audio subcariers for
places like Romania. The pal option to tda9887.o now allows a setting like
pal="dg", specifying that we should use pal-d on VHF and pal-g on UHF. 

I am absoultely convinced that I've done a very bad thing in just
declaring a variable external without explicitly exporting it, but I
didn't bother looking up how to do that properly and it works OK...

In use you need to to a NORM adjustment after changing between [UV]HF,
(which isn't automatic, at least under xawtv-3.74)
but that's a lot simpler than reloading the module!

Hope this is useful to someone

David

PS feel free to tell me what I'm breaking!

diff -u driver.orig/tda9887.c driver/tda9887.c
--- driver.orig/tda9887.c	Thu Mar  6 17:03:24 2003
+++ driver/tda9887.c	Fri Jul  4 09:35:29 2003
@@ -41,7 +41,7 @@
 MODULE_PARM(pal,"s");
 MODULE_PARM(secam,"s");
 MODULE_LICENSE("GPL");
-
+extern int freqband;
 /* ---------------------------------------------------------------------- */
 
 #define dprintk     if (debug) printk
@@ -126,6 +126,7 @@
 static int tda9887_miro(struct tda9887 *t)
 {
 	int rc;
+	char palmode;
 	u8   bData[4]     = { 0 };
 	u8   bVideoIF     = 0;
 	u8   bAudioIF     = 0;
@@ -180,7 +181,14 @@
 			// stereo boards
 			bCarrierMode = cQSS;
 		}
-		switch (pal[0]) {
+			
+		if (pal[1]!=0 && freqband==1) {
+			palmode=pal[1];
+		} else {
+			palmode=pal[0];
+		}
+		printk("tda9887: pal-%c (band=%s)\n",palmode,((freqband==0)?"VHF":"UHF"));
+		switch (palmode) {
 		case 'b':
 		case 'g':
 		case 'h':
diff -u driver.orig/tuner.c driver/tuner.c
--- driver.orig/tuner.c	Thu Mar  6 16:59:05 2003
+++ driver/tuner.c	Fri Jul  4 23:07:09 2003
@@ -32,6 +32,7 @@
 static unsigned int type  =  UNSET;
 static unsigned int addr  =  0;
 static char *pal =  "b";
+int freqband=0; /* Which byte of pal[] are we using, based on frequency */
 static unsigned int tv_range[2]    = { 44, 958 };
 static unsigned int radio_range[2] = { 65, 108 };
 MODULE_PARM(debug,"i");
@@ -549,7 +550,15 @@
 	ret=mt2032_compute_freq(rfin,if1,if2,from,to,&buf[1],&sel,t->xogc);
 	if (ret<0)
 		return;
-
+	if (rfin>0) { /* No switching for composite in */
+		if (rfin<300000000) { /* where do we switch from UHF to VHF
+					 Guess at 1M wavelength */
+			freqband=0;
+		} else {	
+			freqband=1;
+		}
+	}
+	printk("tuner: frequency %u band now %d\n",rfin,freqband);
         // send only the relevant registers per Rev. 1.2
         buf[0]=0;
         ret=i2c_master_send(c,buf,4);




[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux