Here is a context diff against tuner.c instead of bttv-cards.c.
--
-Torgeir
*** tuner.c-orig Mon Oct 1 22:17:35 2001
--- tuner.c Wed Oct 3 12:56:52 2001
***************
*** 273,278 ****
--- 273,328 ----
}
#endif
+ void mt2032_init(struct i2c_client *c)
+ {
+ unsigned char buf[21];
+ int ret;
+ unsigned char xok=0;
+ unsigned char xogc=0;
+ int loopkill = 10;
+
+ buf[0]=0;
+ ret=i2c_master_send(c,buf,1);
+ i2c_master_recv(c,buf,21);
+ buf[3]=0xff;
+ 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)
+ dprintk("mt2032_init failed with %d\n",ret);
+
+ // adjust xogc register
+ do {
+ udelay(10);
+ --loopkill;
+ buf[0]=0x0e;
+ i2c_master_send(c,buf,1);
+ i2c_master_recv(c,buf,1);
+ xok=buf[0]&0x01;
+ if (xok == 1) break;
+
+ buf[0]=0x07;
+ i2c_master_send(c,buf,1);
+ i2c_master_recv(c,buf,1);
+ xogc=buf[0];
+ if (xogc == 4) break;
+
+ // 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)
+ dprintk("mt2032_init failed with %d\n",ret);
+ } while (xok != 1 && loopkill > 0);
+ }
+
int mt2032_compute_freq(int rfin, int if1, int if2, int spectrum_from,
int spectrum_to, unsigned char *buf) //all in Hz
{
***************
*** 627,632 ****
--- 677,684 ----
t->type = -1;
}
i2c_attach_client(client);
+ if (t->type == TUNER_MT2032)
+ mt2032_init(client);
MOD_INC_USE_COUNT;
return 0;
***************
*** 676,681 ****
--- 728,735 ----
dprintk("tuner: type set to %d (%s)\n",
t->type,tuners[t->type].name);
strncpy(client->name, tuners[t->type].name, sizeof(client->name));
+ if (t->type == TUNER_MT2032)
+ mt2032_init(client);
break;
case AUDC_SET_RADIO:
t->radio = 1;