diff options
author | Mauro Carvalho Chehab <mchehab@brturbo.com.br> | 2005-11-09 00:37:43 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-09 10:56:20 -0500 |
commit | 4ac97914c6c35f6bf132071c718e034d0846b9f5 (patch) | |
tree | 98c7eb827bb8ba99730ed89d32703a30448fd813 /drivers/media/video/mt20xx.c | |
parent | a8900fc242406f25f315190a6d650f1d54617c2f (diff) |
[PATCH] v4l: 800: whitespace cleanups
- Whitespace Cleanups.
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/video/mt20xx.c')
-rw-r--r-- | drivers/media/video/mt20xx.c | 204 |
1 files changed, 102 insertions, 102 deletions
diff --git a/drivers/media/video/mt20xx.c b/drivers/media/video/mt20xx.c index 972aa5e0aeef..13b61c4dcbf8 100644 --- a/drivers/media/video/mt20xx.c +++ b/drivers/media/video/mt20xx.c | |||
@@ -76,17 +76,17 @@ static int mt2032_compute_freq(struct i2c_client *c, | |||
76 | unsigned int xogc) //all in Hz | 76 | unsigned int xogc) //all in Hz |
77 | { | 77 | { |
78 | struct tuner *t = i2c_get_clientdata(c); | 78 | struct tuner *t = i2c_get_clientdata(c); |
79 | unsigned int fref,lo1,lo1n,lo1a,s,sel,lo1freq, desired_lo1, | 79 | unsigned int fref,lo1,lo1n,lo1a,s,sel,lo1freq, desired_lo1, |
80 | desired_lo2,lo2,lo2n,lo2a,lo2num,lo2freq; | 80 | desired_lo2,lo2,lo2n,lo2a,lo2num,lo2freq; |
81 | 81 | ||
82 | fref= 5250 *1000; //5.25MHz | 82 | fref= 5250 *1000; //5.25MHz |
83 | desired_lo1=rfin+if1; | 83 | desired_lo1=rfin+if1; |
84 | 84 | ||
85 | lo1=(2*(desired_lo1/1000)+(fref/1000)) / (2*fref/1000); | 85 | lo1=(2*(desired_lo1/1000)+(fref/1000)) / (2*fref/1000); |
86 | lo1n=lo1/8; | 86 | lo1n=lo1/8; |
87 | lo1a=lo1-(lo1n*8); | 87 | lo1a=lo1-(lo1n*8); |
88 | 88 | ||
89 | s=rfin/1000/1000+1090; | 89 | s=rfin/1000/1000+1090; |
90 | 90 | ||
91 | if(optimize_vco) { | 91 | if(optimize_vco) { |
92 | if(s>1890) sel=0; | 92 | if(s>1890) sel=0; |
@@ -96,34 +96,34 @@ static int mt2032_compute_freq(struct i2c_client *c, | |||
96 | else sel=4; // >1090 | 96 | else sel=4; // >1090 |
97 | } | 97 | } |
98 | else { | 98 | else { |
99 | if(s>1790) sel=0; // <1958 | 99 | if(s>1790) sel=0; // <1958 |
100 | else if(s>1617) sel=1; | 100 | else if(s>1617) sel=1; |
101 | else if(s>1449) sel=2; | 101 | else if(s>1449) sel=2; |
102 | else if(s>1291) sel=3; | 102 | else if(s>1291) sel=3; |
103 | else sel=4; // >1090 | 103 | else sel=4; // >1090 |
104 | } | 104 | } |
105 | *ret_sel=sel; | 105 | *ret_sel=sel; |
106 | 106 | ||
107 | lo1freq=(lo1a+8*lo1n)*fref; | 107 | lo1freq=(lo1a+8*lo1n)*fref; |
108 | 108 | ||
109 | tuner_dbg("mt2032: rfin=%d lo1=%d lo1n=%d lo1a=%d sel=%d, lo1freq=%d\n", | 109 | tuner_dbg("mt2032: rfin=%d lo1=%d lo1n=%d lo1a=%d sel=%d, lo1freq=%d\n", |
110 | rfin,lo1,lo1n,lo1a,sel,lo1freq); | 110 | rfin,lo1,lo1n,lo1a,sel,lo1freq); |
111 | 111 | ||
112 | desired_lo2=lo1freq-rfin-if2; | 112 | desired_lo2=lo1freq-rfin-if2; |
113 | lo2=(desired_lo2)/fref; | 113 | lo2=(desired_lo2)/fref; |
114 | lo2n=lo2/8; | 114 | lo2n=lo2/8; |
115 | lo2a=lo2-(lo2n*8); | 115 | lo2a=lo2-(lo2n*8); |
116 | lo2num=((desired_lo2/1000)%(fref/1000))* 3780/(fref/1000); //scale to fit in 32bit arith | 116 | lo2num=((desired_lo2/1000)%(fref/1000))* 3780/(fref/1000); //scale to fit in 32bit arith |
117 | lo2freq=(lo2a+8*lo2n)*fref + lo2num*(fref/1000)/3780*1000; | 117 | lo2freq=(lo2a+8*lo2n)*fref + lo2num*(fref/1000)/3780*1000; |
118 | 118 | ||
119 | tuner_dbg("mt2032: rfin=%d lo2=%d lo2n=%d lo2a=%d num=%d lo2freq=%d\n", | 119 | tuner_dbg("mt2032: rfin=%d lo2=%d lo2n=%d lo2a=%d num=%d lo2freq=%d\n", |
120 | rfin,lo2,lo2n,lo2a,lo2num,lo2freq); | 120 | rfin,lo2,lo2n,lo2a,lo2num,lo2freq); |
121 | 121 | ||
122 | if(lo1a<0 || lo1a>7 || lo1n<17 ||lo1n>48 || lo2a<0 ||lo2a >7 ||lo2n<17 || lo2n>30) { | 122 | if(lo1a<0 || lo1a>7 || lo1n<17 ||lo1n>48 || lo2a<0 ||lo2a >7 ||lo2n<17 || lo2n>30) { |
123 | tuner_info("mt2032: frequency parameters out of range: %d %d %d %d\n", | 123 | tuner_info("mt2032: frequency parameters out of range: %d %d %d %d\n", |
124 | lo1a, lo1n, lo2a,lo2n); | 124 | lo1a, lo1n, lo2a,lo2n); |
125 | return(-1); | 125 | return(-1); |
126 | } | 126 | } |
127 | 127 | ||
128 | mt2032_spurcheck(c, lo1freq, desired_lo2, spectrum_from, spectrum_to); | 128 | mt2032_spurcheck(c, lo1freq, desired_lo2, spectrum_from, spectrum_to); |
129 | // should recalculate lo1 (one step up/down) | 129 | // should recalculate lo1 (one step up/down) |
@@ -135,10 +135,10 @@ static int mt2032_compute_freq(struct i2c_client *c, | |||
135 | buf[3]=0x0f; //reserved | 135 | buf[3]=0x0f; //reserved |
136 | buf[4]=0x1f; | 136 | buf[4]=0x1f; |
137 | buf[5]=(lo2n-1) | (lo2a<<5); | 137 | buf[5]=(lo2n-1) | (lo2a<<5); |
138 | if(rfin >400*1000*1000) | 138 | if(rfin >400*1000*1000) |
139 | buf[6]=0xe4; | 139 | buf[6]=0xe4; |
140 | else | 140 | else |
141 | buf[6]=0xf4; // set PKEN per rev 1.2 | 141 | buf[6]=0xf4; // set PKEN per rev 1.2 |
142 | buf[7]=8+xogc; | 142 | buf[7]=8+xogc; |
143 | buf[8]=0xc3; //reserved | 143 | buf[8]=0xc3; //reserved |
144 | buf[9]=0x4e; //reserved | 144 | buf[9]=0x4e; //reserved |
@@ -168,7 +168,7 @@ static int mt2032_check_lo_lock(struct i2c_client *c) | |||
168 | tuner_dbg("mt2032: pll wait 1ms for lock (0x%2x)\n",buf[0]); | 168 | tuner_dbg("mt2032: pll wait 1ms for lock (0x%2x)\n",buf[0]); |
169 | udelay(1000); | 169 | udelay(1000); |
170 | } | 170 | } |
171 | return lock; | 171 | return lock; |
172 | } | 172 | } |
173 | 173 | ||
174 | static int mt2032_optimize_vco(struct i2c_client *c,int sel,int lock) | 174 | static int mt2032_optimize_vco(struct i2c_client *c,int sel,int lock) |
@@ -202,7 +202,7 @@ static int mt2032_optimize_vco(struct i2c_client *c,int sel,int lock) | |||
202 | 202 | ||
203 | buf[0]=0x0f; | 203 | buf[0]=0x0f; |
204 | buf[1]=sel; | 204 | buf[1]=sel; |
205 | i2c_master_send(c,buf,2); | 205 | i2c_master_send(c,buf,2); |
206 | lock=mt2032_check_lo_lock(c); | 206 | lock=mt2032_check_lo_lock(c); |
207 | return lock; | 207 | return lock; |
208 | } | 208 | } |
@@ -219,23 +219,23 @@ static void mt2032_set_if_freq(struct i2c_client *c, unsigned int rfin, | |||
219 | tuner_dbg("mt2032_set_if_freq rfin=%d if1=%d if2=%d from=%d to=%d\n", | 219 | tuner_dbg("mt2032_set_if_freq rfin=%d if1=%d if2=%d from=%d to=%d\n", |
220 | rfin,if1,if2,from,to); | 220 | rfin,if1,if2,from,to); |
221 | 221 | ||
222 | buf[0]=0; | 222 | buf[0]=0; |
223 | ret=i2c_master_send(c,buf,1); | 223 | ret=i2c_master_send(c,buf,1); |
224 | i2c_master_recv(c,buf,21); | 224 | i2c_master_recv(c,buf,21); |
225 | 225 | ||
226 | buf[0]=0; | 226 | buf[0]=0; |
227 | ret=mt2032_compute_freq(c,rfin,if1,if2,from,to,&buf[1],&sel,t->xogc); | 227 | ret=mt2032_compute_freq(c,rfin,if1,if2,from,to,&buf[1],&sel,t->xogc); |
228 | if (ret<0) | 228 | if (ret<0) |
229 | return; | 229 | return; |
230 | 230 | ||
231 | // send only the relevant registers per Rev. 1.2 | 231 | // send only the relevant registers per Rev. 1.2 |
232 | buf[0]=0; | 232 | buf[0]=0; |
233 | ret=i2c_master_send(c,buf,4); | 233 | ret=i2c_master_send(c,buf,4); |
234 | buf[5]=5; | 234 | buf[5]=5; |
235 | ret=i2c_master_send(c,buf+5,4); | 235 | ret=i2c_master_send(c,buf+5,4); |
236 | buf[11]=11; | 236 | buf[11]=11; |
237 | ret=i2c_master_send(c,buf+11,3); | 237 | ret=i2c_master_send(c,buf+11,3); |
238 | if(ret!=3) | 238 | if(ret!=3) |
239 | tuner_warn("i2c i/o error: rc == %d (should be 3)\n",ret); | 239 | tuner_warn("i2c i/o error: rc == %d (should be 3)\n",ret); |
240 | 240 | ||
241 | // wait for PLLs to lock (per manual), retry LINT if not. | 241 | // wait for PLLs to lock (per manual), retry LINT if not. |
@@ -253,7 +253,7 @@ static void mt2032_set_if_freq(struct i2c_client *c, unsigned int rfin, | |||
253 | mdelay(10); | 253 | mdelay(10); |
254 | buf[1]=8+t->xogc; | 254 | buf[1]=8+t->xogc; |
255 | i2c_master_send(c,buf,2); | 255 | i2c_master_send(c,buf,2); |
256 | } | 256 | } |
257 | 257 | ||
258 | if (lock!=6) | 258 | if (lock!=6) |
259 | tuner_warn("MT2032 Fatal Error: PLLs didn't lock.\n"); | 259 | tuner_warn("MT2032 Fatal Error: PLLs didn't lock.\n"); |
@@ -284,7 +284,7 @@ static void mt2032_set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
284 | if2 = 38900*1000; | 284 | if2 = 38900*1000; |
285 | } | 285 | } |
286 | 286 | ||
287 | mt2032_set_if_freq(c, freq*62500 /* freq*1000*1000/16 */, | 287 | mt2032_set_if_freq(c, freq*62500 /* freq*1000*1000/16 */, |
288 | 1090*1000*1000, if2, from, to); | 288 | 1090*1000*1000, if2, from, to); |
289 | } | 289 | } |
290 | 290 | ||
@@ -294,7 +294,7 @@ static void mt2032_set_radio_freq(struct i2c_client *c, unsigned int freq) | |||
294 | int if2 = t->radio_if2; | 294 | int if2 = t->radio_if2; |
295 | 295 | ||
296 | // per Manual for FM tuning: first if center freq. 1085 MHz | 296 | // per Manual for FM tuning: first if center freq. 1085 MHz |
297 | mt2032_set_if_freq(c, freq * 1000 / 16, | 297 | mt2032_set_if_freq(c, freq * 1000 / 16, |
298 | 1085*1000*1000,if2,if2,if2); | 298 | 1085*1000*1000,if2,if2,if2); |
299 | } | 299 | } |
300 | 300 | ||
@@ -302,57 +302,57 @@ static void mt2032_set_radio_freq(struct i2c_client *c, unsigned int freq) | |||
302 | static int mt2032_init(struct i2c_client *c) | 302 | static int mt2032_init(struct i2c_client *c) |
303 | { | 303 | { |
304 | struct tuner *t = i2c_get_clientdata(c); | 304 | struct tuner *t = i2c_get_clientdata(c); |
305 | unsigned char buf[21]; | 305 | unsigned char buf[21]; |
306 | int ret,xogc,xok=0; | 306 | int ret,xogc,xok=0; |
307 | 307 | ||
308 | // Initialize Registers per spec. | 308 | // Initialize Registers per spec. |
309 | buf[1]=2; // Index to register 2 | 309 | buf[1]=2; // Index to register 2 |
310 | buf[2]=0xff; | 310 | buf[2]=0xff; |
311 | buf[3]=0x0f; | 311 | buf[3]=0x0f; |
312 | buf[4]=0x1f; | 312 | buf[4]=0x1f; |
313 | ret=i2c_master_send(c,buf+1,4); | 313 | ret=i2c_master_send(c,buf+1,4); |
314 | 314 | ||
315 | buf[5]=6; // Index register 6 | 315 | buf[5]=6; // Index register 6 |
316 | buf[6]=0xe4; | 316 | buf[6]=0xe4; |
317 | buf[7]=0x8f; | 317 | buf[7]=0x8f; |
318 | buf[8]=0xc3; | 318 | buf[8]=0xc3; |
319 | buf[9]=0x4e; | 319 | buf[9]=0x4e; |
320 | buf[10]=0xec; | 320 | buf[10]=0xec; |
321 | ret=i2c_master_send(c,buf+5,6); | 321 | ret=i2c_master_send(c,buf+5,6); |
322 | 322 | ||
323 | buf[12]=13; // Index register 13 | 323 | buf[12]=13; // Index register 13 |
324 | buf[13]=0x32; | 324 | buf[13]=0x32; |
325 | ret=i2c_master_send(c,buf+12,2); | 325 | ret=i2c_master_send(c,buf+12,2); |
326 | 326 | ||
327 | // Adjust XOGC (register 7), wait for XOK | 327 | // Adjust XOGC (register 7), wait for XOK |
328 | xogc=7; | 328 | xogc=7; |
329 | do { | 329 | do { |
330 | tuner_dbg("mt2032: xogc = 0x%02x\n",xogc&0x07); | ||
331 | mdelay(10); | ||
332 | buf[0]=0x0e; | ||
333 | i2c_master_send(c,buf,1); | ||
334 | i2c_master_recv(c,buf,1); | ||
335 | xok=buf[0]&0x01; | ||
336 | tuner_dbg("mt2032: xok = 0x%02x\n",xok); | ||
337 | if (xok == 1) break; | ||
338 | |||
339 | xogc--; | ||
330 | tuner_dbg("mt2032: xogc = 0x%02x\n",xogc&0x07); | 340 | tuner_dbg("mt2032: xogc = 0x%02x\n",xogc&0x07); |
331 | mdelay(10); | 341 | if (xogc == 3) { |
332 | buf[0]=0x0e; | 342 | xogc=4; // min. 4 per spec |
333 | i2c_master_send(c,buf,1); | 343 | break; |
334 | i2c_master_recv(c,buf,1); | 344 | } |
335 | xok=buf[0]&0x01; | 345 | buf[0]=0x07; |
336 | tuner_dbg("mt2032: xok = 0x%02x\n",xok); | 346 | buf[1]=0x88 + xogc; |
337 | if (xok == 1) break; | 347 | ret=i2c_master_send(c,buf,2); |
338 | 348 | if (ret!=2) | |
339 | xogc--; | ||
340 | tuner_dbg("mt2032: xogc = 0x%02x\n",xogc&0x07); | ||
341 | if (xogc == 3) { | ||
342 | xogc=4; // min. 4 per spec | ||
343 | break; | ||
344 | } | ||
345 | buf[0]=0x07; | ||
346 | buf[1]=0x88 + xogc; | ||
347 | ret=i2c_master_send(c,buf,2); | ||
348 | if (ret!=2) | ||
349 | tuner_warn("i2c i/o error: rc == %d (should be 2)\n",ret); | 349 | tuner_warn("i2c i/o error: rc == %d (should be 2)\n",ret); |
350 | } while (xok != 1 ); | 350 | } while (xok != 1 ); |
351 | t->xogc=xogc; | 351 | t->xogc=xogc; |
352 | 352 | ||
353 | t->tv_freq = mt2032_set_tv_freq; | 353 | t->tv_freq = mt2032_set_tv_freq; |
354 | t->radio_freq = mt2032_set_radio_freq; | 354 | t->radio_freq = mt2032_set_radio_freq; |
355 | return(1); | 355 | return(1); |
356 | } | 356 | } |
357 | 357 | ||
358 | static void mt2050_set_antenna(struct i2c_client *c, unsigned char antenna) | 358 | static void mt2050_set_antenna(struct i2c_client *c, unsigned char antenna) |
@@ -426,7 +426,7 @@ static void mt2050_set_if_freq(struct i2c_client *c,unsigned int freq, unsigned | |||
426 | } | 426 | } |
427 | 427 | ||
428 | ret=i2c_master_send(c,buf,6); | 428 | ret=i2c_master_send(c,buf,6); |
429 | if (ret!=6) | 429 | if (ret!=6) |
430 | tuner_warn("i2c i/o error: rc == %d (should be 6)\n",ret); | 430 | tuner_warn("i2c i/o error: rc == %d (should be 6)\n",ret); |
431 | } | 431 | } |
432 | 432 | ||
@@ -437,11 +437,11 @@ static void mt2050_set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
437 | 437 | ||
438 | if (t->std & V4L2_STD_525_60) { | 438 | if (t->std & V4L2_STD_525_60) { |
439 | // NTSC | 439 | // NTSC |
440 | if2 = 45750*1000; | 440 | if2 = 45750*1000; |
441 | } else { | 441 | } else { |
442 | // PAL | 442 | // PAL |
443 | if2 = 38900*1000; | 443 | if2 = 38900*1000; |
444 | } | 444 | } |
445 | if (V4L2_TUNER_DIGITAL_TV == t->mode) { | 445 | if (V4L2_TUNER_DIGITAL_TV == t->mode) { |
446 | // DVB (pinnacle 300i) | 446 | // DVB (pinnacle 300i) |
447 | if2 = 36150*1000; | 447 | if2 = 36150*1000; |
@@ -487,7 +487,7 @@ int microtune_init(struct i2c_client *c) | |||
487 | { | 487 | { |
488 | struct tuner *t = i2c_get_clientdata(c); | 488 | struct tuner *t = i2c_get_clientdata(c); |
489 | char *name; | 489 | char *name; |
490 | unsigned char buf[21]; | 490 | unsigned char buf[21]; |
491 | int company_code; | 491 | int company_code; |
492 | 492 | ||
493 | memset(buf,0,sizeof(buf)); | 493 | memset(buf,0,sizeof(buf)); |
@@ -496,17 +496,17 @@ int microtune_init(struct i2c_client *c) | |||
496 | t->standby = NULL; | 496 | t->standby = NULL; |
497 | name = "unknown"; | 497 | name = "unknown"; |
498 | 498 | ||
499 | i2c_master_send(c,buf,1); | 499 | i2c_master_send(c,buf,1); |
500 | i2c_master_recv(c,buf,21); | 500 | i2c_master_recv(c,buf,21); |
501 | if (tuner_debug) { | 501 | if (tuner_debug) { |
502 | int i; | 502 | int i; |
503 | tuner_dbg("MT20xx hexdump:"); | 503 | tuner_dbg("MT20xx hexdump:"); |
504 | for(i=0;i<21;i++) { | 504 | for(i=0;i<21;i++) { |
505 | printk(" %02x",buf[i]); | 505 | printk(" %02x",buf[i]); |
506 | if(((i+1)%8)==0) printk(" "); | 506 | if(((i+1)%8)==0) printk(" "); |
507 | } | 507 | } |
508 | printk("\n"); | 508 | printk("\n"); |
509 | } | 509 | } |
510 | company_code = buf[0x11] << 8 | buf[0x12]; | 510 | company_code = buf[0x11] << 8 | buf[0x12]; |
511 | tuner_info("microtune: companycode=%04x part=%02x rev=%02x\n", | 511 | tuner_info("microtune: companycode=%04x part=%02x rev=%02x\n", |
512 | company_code,buf[0x13],buf[0x14]); | 512 | company_code,buf[0x13],buf[0x14]); |
@@ -525,8 +525,8 @@ int microtune_init(struct i2c_client *c) | |||
525 | default: | 525 | default: |
526 | tuner_info("microtune %s found, not (yet?) supported, sorry :-/\n", | 526 | tuner_info("microtune %s found, not (yet?) supported, sorry :-/\n", |
527 | name); | 527 | name); |
528 | return 0; | 528 | return 0; |
529 | } | 529 | } |
530 | 530 | ||
531 | strlcpy(c->name, name, sizeof(c->name)); | 531 | strlcpy(c->name, name, sizeof(c->name)); |
532 | tuner_info("microtune %s found, OK\n",name); | 532 | tuner_info("microtune %s found, OK\n",name); |