mt2032 tuner initialization

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



Gunther Mayer,

I've now tried to initialize the mt2032 tuner when the bttv driver is loaded, in the voodoo200_init() method as you suggested. I'm not shure if all the steps are necessary, but I've tried to mimic the steps as outlined in the manual.

(The init method is in the attached file. This is my first attempt at kernel driver programming, so please let me know if anything is not in line with kernel programming etiquette..)

In addition I had to remove the setting of register 3,4,8,9,10 in the mt2032_compute_freq() method, since for some reason, the card will not tune with these registers being set with this initialization. I have not yet experimented to see if there is just a single register or more that has this effect yet.

My card now tunes when coldbooted, but with much poorer performance (some channels aren't foudn initially, more noise etc.) than previously. I'll try to experiment more on this to see what's missing.

Lastly, isn't the mt2032 really an i2c device like the msp34** and thus deserves it's own module?


--
-Torgeir
void mt2032_initialize_torgeir_special(struct i2c_client *c)
{
        unsigned char buf[21];
        int ret;
        unsigned char xok=0;
        unsigned char xogc=0;
        int loopkill = 10;

        printk("mt2032_initialize_torgeir_special\n");
        buf[0]=0;
        ret=i2c_master_send(c,buf,1);
        i2c_master_recv(c,buf,21);

        buf[3]=0xff; // addr+1, since buf[0] contains startaddr
        buf[4]=0x0f;
        buf[5]=0x1f;
        buf[7]=0xe4;
        buf[8]=0x8f;
        buf[9]=0xc3;
        buf[10]=0x4e;
        buf[11]=0xec;
        buf[14]=0x32;

        buf[0]=0;
        ret=i2c_master_send(c,buf,14);
        if (ret!=14)
		printk("mt2032_initialize_torgeir_special failed with %d\n",ret);

        udelay(10);

        // adjust xogc register
	do {
		--loopkill;
		buf[0]=0x0e;
		i2c_master_send(c,buf,1);
		i2c_master_recv(c,buf,1);
		xok=buf[0]&0x01;
		printk("mt2032: xok = 0x%02x\n",xok);

        	if (xok == 1) break; // if xok == 1, complete, else

	        buf[0]=0x07;
	        i2c_master_send(c,buf,1);
	        i2c_master_recv(c,buf,1);
	        xogc=buf[0];
	        printk("mt2032: xogc = 0x%02x\n",xogc&0x07);
	        if (xogc == 4) break; // if xogc == 4, complete, else

	        // decrement xogc and set, then loop
	        buf[0]=0x07;
	        buf[1]=(xogc & 0xf8) | ((xogc&0x07)-1);
	        ret=i2c_master_send(c,buf,2);
	        if (ret!=2)
			printk("mt2032_initialize_torgeir_special failed with %d\n",ret);
        	udelay(10);
	} while (xok != 1 && loopkill > 0);
}


[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