well the 0x957fff does fix the problem. now i can tune to some of the 
channels but most of the channels wont tune. i'm including a patch for the 
spur avoidance and also i've rearranged the compute freq routine a bit. 
i'll debug some more tomorrow and see why it wont tune to some channels.

--On Wednesday, October 10, 2001 8:57 PM +0200 Gunther Mayer 
<[EMAIL PROTECTED]> wrote:

> Ivan T Tarnavsky wrote:
>>
>> hi,
>> i've got the voodootv 200 pci us version and cant make it work with
>> bttv. i have kernel 2.4.10 + bttv 0.7.80 + the latest  Gunter's patch
>> with the "proper" initialization. it's still not working. i get noise
>> for the audio
>
> Try this patch (on bttv-0.7.81) and report.
>
> --- bttv-cards.c-PAL    Tue Oct  9 21:09:50 2001
> +++ bttv-cards.c        Tue Oct  9 21:10:21 2001
> @@ -1049,7 +1049,7 @@
>          gpiomask:       0x4f8a00,
>                         // 0x100000: 1=MSP enabled (0=disable again)
>                         // 0x010000: somehow influences tuner picture
> quality (? )
> -        audiomux:       {0x947fff, 0x987fff,0x947fff,0x947fff},
> +        audiomux:       {0x957fff, 0x987fff,0x947fff,0x947fff},
>                          //tvtuner, radio,   external,internal,mute,stereo
>          muxsel:         { 2, 3 ,0 ,1}, /* tuner, Composit, SVid,
> Composit-on-Sv id-adapter*/
>          tuner_type:     TUNER_MT2032,
>
>
> I already got a positive report on this:
>> It looks as if all the channels work. And the sound is perfect!
>> This is so awsome!
>> P.S.) KWinTV's autoscanning feature doesn't work with this card since it
>> takes  a second or two to tune-in the channel.
>
> This would confirm GPIO connected to tda9880 for selecting tv standard
> (thanks torgeir for the hint).
>


cheers,
ivan.
*** tuner.c.old Wed Oct 10 15:16:22 2001
--- tuner.c     Wed Oct 10 15:46:16 2001
***************
*** 281,287 ****
          ret=i2c_master_send(c,buf,1);
          i2c_master_recv(c,buf,21);
  
!         printk("MT2032: Companycode=%02x%02x Part=%02x Revision=%02x\n",
                  buf[0x11],buf[0x12],buf[0x13],buf[0x14]);
  
          if(debug) {
--- 281,287 ----
          ret=i2c_master_send(c,buf,1);
          i2c_master_recv(c,buf,21);
  
!         printk("MT2032: Companycode=%c%c Part=%02x Revision=%02x\n",
                  buf[0x11],buf[0x12],buf[0x13],buf[0x14]);
  
          if(debug) {
***************
*** 290,296 ****
                  for(i=0;i<21;i++) {
                          printk(" %02x",buf[i]);
                          if(((i+1)%8)==0) printk(" ");
!                         if(((i+1)%16)==0) printk("\n ");
                  }
                  printk("\n ");
          }
--- 290,296 ----
                  for(i=0;i<21;i++) {
                          printk(" %02x",buf[i]);
                          if(((i+1)%8)==0) printk(" ");
!                         if(((i+1)%16)==0) printk("\n");
                  }
                  printk("\n ");
          }
***************
*** 364,392 ****
                f=f-f2;
                dprintk(" spurtest n1=%d n2=%d ftest=%d\n",n1,n2,f);
  
!               if( (f>spectrum_from) && (f<spectrum_to))
                        printk("mt2032 spurcheck triggered: %d\n",n1);
            } while ( (f>(f2-spectrum_to)) || (n2>-5));
            n1++;
        } while (n1<5);
  
!       return 1;
  }
  
  int mt2032_compute_freq(int rfin, int if1, int if2, int spectrum_from,
        int spectrum_to, unsigned char *buf, int *ret_sel, int xogc) //all in Hz
  {
          int fref,lo1,lo1n,lo1a,s,sel,lo1freq, desired_lo1,
!               desired_lo2,lo2,lo2n,lo2a,lo2num,lo2freq;
  
          fref= 5250 *1000; //5.25MHz
-       desired_lo1=rfin+if1;
  
!       lo1=(2*(desired_lo1/1000)+(fref/1000)) / (2*fref/1000);
!         lo1n=lo1/8;
!         lo1a=lo1-(lo1n*8);
  
!         s=rfin/1000/1000+1090;
  
        if(optimize_vco) {
                if(s>1890) sel=0;
--- 364,408 ----
                f=f-f2;
                dprintk(" spurtest n1=%d n2=%d ftest=%d\n",n1,n2,f);
  
!               if( (f>spectrum_from) && (f<spectrum_to)) {
                        printk("mt2032 spurcheck triggered: %d\n",n1);
+                       return 1;
+               }
            } while ( (f>(f2-spectrum_to)) || (n2>-5));
            n1++;
        } while (n1<5);
  
!       return 0;
  }
  
  int mt2032_compute_freq(int rfin, int if1, int if2, int spectrum_from,
        int spectrum_to, unsigned char *buf, int *ret_sel, int xogc) //all in Hz
  {
          int fref,lo1,lo1n,lo1a,s,sel,lo1freq, desired_lo1,
!               desired_lo2,lo2,lo2n,lo2a,lo2num,lo2freq,nLO1adjust;
  
          fref= 5250 *1000; //5.25MHz
  
!       // 2.3.1
!       desired_lo1 = rfin + if1;
!       lo1 = (2 * (desired_lo1 / 1000) + (fref / 1000)) / (2 * fref / 1000);
!       lo1freq = lo1 * fref;
!       desired_lo2 = lo1freq - rfin - if2;
! 
!       // 2.3.2
!       for(nLO1adjust = 1; nLO1adjust < 3; nLO1adjust++) {
!               if (!mt2032_spurcheck(lo1freq, desired_lo2,  spectrum_from, 
spectrum_to))
!                       break;
!               if (lo1freq < desired_lo1)
!                       lo1 += nLO1adjust;
!               else
!                       lo1 -= nLO1adjust;
!               lo1freq = lo1 * fref;
!               desired_lo2 = lo1freq - rfin - if2;
!       }
  
!       // 2.3.3
!         s = lo1freq/1000/1000;
  
        if(optimize_vco) {
                if(s>1890) sel=0;
***************
*** 404,418 ****
        }
        *ret_sel=sel;
  
!         lo1freq=(lo1a+8*lo1n)*fref;
  
          dprintk("mt2032: rfin=%d lo1=%d lo1n=%d lo1a=%d sel=%d, lo1freq=%d\n",
                rfin,lo1,lo1n,lo1a,sel,lo1freq);
  
!         desired_lo2=lo1freq-rfin-if2;
!         lo2=(desired_lo2)/fref;
!         lo2n=lo2/8;
!         lo2a=lo2-(lo2n*8);
          lo2num=((desired_lo2/1000)%(fref/1000))* 3780/(fref/1000); //scale to fit in 
32bit arith
          lo2freq=(lo2a+8*lo2n)*fref + lo2num*(fref/1000)/3780*1000;
  
--- 420,435 ----
        }
        *ret_sel=sel;
  
!       // 2.3.4
!       lo1n=lo1/8;
!         lo1a=lo1-(lo1n*8);
  
          dprintk("mt2032: rfin=%d lo1=%d lo1n=%d lo1a=%d sel=%d, lo1freq=%d\n",
                rfin,lo1,lo1n,lo1a,sel,lo1freq);
  
!         lo2 = desired_lo2 / fref;
!         lo2n = lo2 / 8;
!         lo2a = lo2 - (lo2n * 8);
          lo2num=((desired_lo2/1000)%(fref/1000))* 3780/(fref/1000); //scale to fit in 
32bit arith
          lo2freq=(lo2a+8*lo2n)*fref + lo2num*(fref/1000)/3780*1000;
  
***************
*** 424,432 ****
                       lo1a, lo1n, lo2a,lo2n);
                  return(-1);
          }
- 
-       mt2032_spurcheck(lo1freq, desired_lo2,  spectrum_from, spectrum_to);
-       // should recalculate lo1 (one step up/down)
  
        // set up MT2032 register map for transfer over i2c
        buf[0]=lo1n-1;
--- 441,446 ----

Reply via email to