aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/msp3400-kthreads.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@brturbo.com.br>2006-01-11 16:41:49 -0500
committerMauro Carvalho Chehab <mchehab@brturbo.com.br>2006-01-11 16:41:49 -0500
commitf167cb4e6ee07914b66eb85fc0bf006a409b6838 (patch)
tree11b888db404a404a9a918c841d06d65c21bc4c19 /drivers/media/video/msp3400-kthreads.c
parentb2a17e47ceb82d23dbf5c5fb24b5377e21486dce (diff)
V4L/DVB (3345): Fixes some bad global variables
- Debug global var is already used inside kernel. - v4l_dbg now expects the debug var - global vars inside msp34xx renamed to msp_* Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/msp3400-kthreads.c')
-rw-r--r--drivers/media/video/msp3400-kthreads.c124
1 files changed, 62 insertions, 62 deletions
diff --git a/drivers/media/video/msp3400-kthreads.c b/drivers/media/video/msp3400-kthreads.c
index 2b59b6847535..2072c3efebb3 100644
--- a/drivers/media/video/msp3400-kthreads.c
+++ b/drivers/media/video/msp3400-kthreads.c
@@ -168,7 +168,7 @@ void msp3400c_setmode(struct i2c_client *client, int type)
168 struct msp_state *state = i2c_get_clientdata(client); 168 struct msp_state *state = i2c_get_clientdata(client);
169 int i; 169 int i;
170 170
171 v4l_dbg(1, client, "setmode: %d\n", type); 171 v4l_dbg(1, msp_debug, client, "setmode: %d\n", type);
172 state->mode = type; 172 state->mode = type;
173 state->audmode = V4L2_TUNER_MODE_MONO; 173 state->audmode = V4L2_TUNER_MODE_MONO;
174 state->rxsubchans = V4L2_TUNER_SUB_MONO; 174 state->rxsubchans = V4L2_TUNER_SUB_MONO;
@@ -191,7 +191,7 @@ void msp3400c_setmode(struct i2c_client *client, int type)
191 191
192 msp_write_dem(client, 0x0056, 0); /*LOAD_REG_1/2*/ 192 msp_write_dem(client, 0x0056, 0); /*LOAD_REG_1/2*/
193 193
194 if (dolby) { 194 if (msp_dolby) {
195 msp_write_dsp(client, 0x0008, 0x0520); /* I2S1 */ 195 msp_write_dsp(client, 0x0008, 0x0520); /* I2S1 */
196 msp_write_dsp(client, 0x0009, 0x0620); /* I2S2 */ 196 msp_write_dsp(client, 0x0009, 0x0620); /* I2S2 */
197 msp_write_dsp(client, 0x000b, msp3400c_init_data[type].dsp_src); 197 msp_write_dsp(client, 0x000b, msp3400c_init_data[type].dsp_src);
@@ -221,7 +221,7 @@ void msp3400c_setstereo(struct i2c_client *client, int mode)
221 /* this method would break everything, let's make sure 221 /* this method would break everything, let's make sure
222 * it's never called 222 * it's never called
223 */ 223 */
224 v4l_dbg(1, client, "setstereo called with mode=%d instead of set_source (ignored)\n", 224 v4l_dbg(1, msp_debug, client, "setstereo called with mode=%d instead of set_source (ignored)\n",
225 mode); 225 mode);
226 return; 226 return;
227 } 227 }
@@ -229,7 +229,7 @@ void msp3400c_setstereo(struct i2c_client *client, int mode)
229 /* switch demodulator */ 229 /* switch demodulator */
230 switch (state->mode) { 230 switch (state->mode) {
231 case MSP_MODE_FM_TERRA: 231 case MSP_MODE_FM_TERRA:
232 v4l_dbg(1, client, "FM setstereo: %s\n", strmode[mode]); 232 v4l_dbg(1, msp_debug, client, "FM setstereo: %s\n", strmode[mode]);
233 msp3400c_setcarrier(client, state->second, state->main); 233 msp3400c_setcarrier(client, state->second, state->main);
234 switch (mode) { 234 switch (mode) {
235 case V4L2_TUNER_MODE_STEREO: 235 case V4L2_TUNER_MODE_STEREO:
@@ -243,7 +243,7 @@ void msp3400c_setstereo(struct i2c_client *client, int mode)
243 } 243 }
244 break; 244 break;
245 case MSP_MODE_FM_SAT: 245 case MSP_MODE_FM_SAT:
246 v4l_dbg(1, client, "SAT setstereo: %s\n", strmode[mode]); 246 v4l_dbg(1, msp_debug, client, "SAT setstereo: %s\n", strmode[mode]);
247 switch (mode) { 247 switch (mode) {
248 case V4L2_TUNER_MODE_MONO: 248 case V4L2_TUNER_MODE_MONO:
249 msp3400c_setcarrier(client, MSP_CARRIER(6.5), MSP_CARRIER(6.5)); 249 msp3400c_setcarrier(client, MSP_CARRIER(6.5), MSP_CARRIER(6.5));
@@ -262,24 +262,24 @@ void msp3400c_setstereo(struct i2c_client *client, int mode)
262 case MSP_MODE_FM_NICAM1: 262 case MSP_MODE_FM_NICAM1:
263 case MSP_MODE_FM_NICAM2: 263 case MSP_MODE_FM_NICAM2:
264 case MSP_MODE_AM_NICAM: 264 case MSP_MODE_AM_NICAM:
265 v4l_dbg(1, client, "NICAM setstereo: %s\n",strmode[mode]); 265 v4l_dbg(1, msp_debug, client, "NICAM setstereo: %s\n",strmode[mode]);
266 msp3400c_setcarrier(client,state->second,state->main); 266 msp3400c_setcarrier(client,state->second,state->main);
267 if (state->nicam_on) 267 if (state->nicam_on)
268 nicam=0x0100; 268 nicam=0x0100;
269 break; 269 break;
270 case MSP_MODE_BTSC: 270 case MSP_MODE_BTSC:
271 v4l_dbg(1, client, "BTSC setstereo: %s\n",strmode[mode]); 271 v4l_dbg(1, msp_debug, client, "BTSC setstereo: %s\n",strmode[mode]);
272 nicam=0x0300; 272 nicam=0x0300;
273 break; 273 break;
274 case MSP_MODE_EXTERN: 274 case MSP_MODE_EXTERN:
275 v4l_dbg(1, client, "extern setstereo: %s\n",strmode[mode]); 275 v4l_dbg(1, msp_debug, client, "extern setstereo: %s\n",strmode[mode]);
276 nicam = 0x0200; 276 nicam = 0x0200;
277 break; 277 break;
278 case MSP_MODE_FM_RADIO: 278 case MSP_MODE_FM_RADIO:
279 v4l_dbg(1, client, "FM-Radio setstereo: %s\n",strmode[mode]); 279 v4l_dbg(1, msp_debug, client, "FM-Radio setstereo: %s\n",strmode[mode]);
280 break; 280 break;
281 default: 281 default:
282 v4l_dbg(1, client, "mono setstereo\n"); 282 v4l_dbg(1, msp_debug, client, "mono setstereo\n");
283 return; 283 return;
284 } 284 }
285 285
@@ -290,7 +290,7 @@ void msp3400c_setstereo(struct i2c_client *client, int mode)
290 break; 290 break;
291 case V4L2_TUNER_MODE_MONO: 291 case V4L2_TUNER_MODE_MONO:
292 if (state->mode == MSP_MODE_AM_NICAM) { 292 if (state->mode == MSP_MODE_AM_NICAM) {
293 v4l_dbg(1, client, "switching to AM mono\n"); 293 v4l_dbg(1, msp_debug, client, "switching to AM mono\n");
294 /* AM mono decoding is handled by tuner, not MSP chip */ 294 /* AM mono decoding is handled by tuner, not MSP chip */
295 /* SCART switching control register */ 295 /* SCART switching control register */
296 msp_set_scart(client, SCART_MONO, 0); 296 msp_set_scart(client, SCART_MONO, 0);
@@ -304,9 +304,9 @@ void msp3400c_setstereo(struct i2c_client *client, int mode)
304 src = 0x0010 | nicam; 304 src = 0x0010 | nicam;
305 break; 305 break;
306 } 306 }
307 v4l_dbg(1, client, "setstereo final source/matrix = 0x%x\n", src); 307 v4l_dbg(1, msp_debug, client, "setstereo final source/matrix = 0x%x\n", src);
308 308
309 if (dolby) { 309 if (msp_dolby) {
310 msp_write_dsp(client, 0x0008, 0x0520); 310 msp_write_dsp(client, 0x0008, 0x0520);
311 msp_write_dsp(client, 0x0009, 0x0620); 311 msp_write_dsp(client, 0x0009, 0x0620);
312 msp_write_dsp(client, 0x000a, src); 312 msp_write_dsp(client, 0x000a, src);
@@ -327,20 +327,20 @@ static void msp3400c_print_mode(struct i2c_client *client)
327 struct msp_state *state = i2c_get_clientdata(client); 327 struct msp_state *state = i2c_get_clientdata(client);
328 328
329 if (state->main == state->second) { 329 if (state->main == state->second) {
330 v4l_dbg(1, client, "mono sound carrier: %d.%03d MHz\n", 330 v4l_dbg(1, msp_debug, client, "mono sound carrier: %d.%03d MHz\n",
331 state->main / 910000, (state->main / 910) % 1000); 331 state->main / 910000, (state->main / 910) % 1000);
332 } else { 332 } else {
333 v4l_dbg(1, client, "main sound carrier: %d.%03d MHz\n", 333 v4l_dbg(1, msp_debug, client, "main sound carrier: %d.%03d MHz\n",
334 state->main / 910000, (state->main / 910) % 1000); 334 state->main / 910000, (state->main / 910) % 1000);
335 } 335 }
336 if (state->mode == MSP_MODE_FM_NICAM1 || state->mode == MSP_MODE_FM_NICAM2) 336 if (state->mode == MSP_MODE_FM_NICAM1 || state->mode == MSP_MODE_FM_NICAM2)
337 v4l_dbg(1, client, "NICAM/FM carrier : %d.%03d MHz\n", 337 v4l_dbg(1, msp_debug, client, "NICAM/FM carrier : %d.%03d MHz\n",
338 state->second / 910000, (state->second/910) % 1000); 338 state->second / 910000, (state->second/910) % 1000);
339 if (state->mode == MSP_MODE_AM_NICAM) 339 if (state->mode == MSP_MODE_AM_NICAM)
340 v4l_dbg(1, client, "NICAM/AM carrier : %d.%03d MHz\n", 340 v4l_dbg(1, msp_debug, client, "NICAM/AM carrier : %d.%03d MHz\n",
341 state->second / 910000, (state->second / 910) % 1000); 341 state->second / 910000, (state->second / 910) % 1000);
342 if (state->mode == MSP_MODE_FM_TERRA && state->main != state->second) { 342 if (state->mode == MSP_MODE_FM_TERRA && state->main != state->second) {
343 v4l_dbg(1, client, "FM-stereo carrier : %d.%03d MHz\n", 343 v4l_dbg(1, msp_debug, client, "FM-stereo carrier : %d.%03d MHz\n",
344 state->second / 910000, (state->second / 910) % 1000); 344 state->second / 910000, (state->second / 910) % 1000);
345 } 345 }
346} 346}
@@ -360,7 +360,7 @@ int autodetect_stereo(struct i2c_client *client)
360 val = msp_read_dsp(client, 0x18); 360 val = msp_read_dsp(client, 0x18);
361 if (val > 32767) 361 if (val > 32767)
362 val -= 65536; 362 val -= 65536;
363 v4l_dbg(2, client, "stereo detect register: %d\n", val); 363 v4l_dbg(2, msp_debug, client, "stereo detect register: %d\n", val);
364 if (val > 4096) { 364 if (val > 4096) {
365 rxsubchans = V4L2_TUNER_SUB_STEREO | V4L2_TUNER_SUB_MONO; 365 rxsubchans = V4L2_TUNER_SUB_STEREO | V4L2_TUNER_SUB_MONO;
366 } else if (val < -4096) { 366 } else if (val < -4096) {
@@ -374,7 +374,7 @@ int autodetect_stereo(struct i2c_client *client)
374 case MSP_MODE_FM_NICAM2: 374 case MSP_MODE_FM_NICAM2:
375 case MSP_MODE_AM_NICAM: 375 case MSP_MODE_AM_NICAM:
376 val = msp_read_dem(client, 0x23); 376 val = msp_read_dem(client, 0x23);
377 v4l_dbg(2, client, "nicam sync=%d, mode=%d\n", 377 v4l_dbg(2, msp_debug, client, "nicam sync=%d, mode=%d\n",
378 val & 1, (val & 0x1e) >> 1); 378 val & 1, (val & 0x1e) >> 1);
379 379
380 if (val & 1) { 380 if (val & 1) {
@@ -407,7 +407,7 @@ int autodetect_stereo(struct i2c_client *client)
407 break; 407 break;
408 case MSP_MODE_BTSC: 408 case MSP_MODE_BTSC:
409 val = msp_read_dem(client, 0x200); 409 val = msp_read_dem(client, 0x200);
410 v4l_dbg(2, client, "status=0x%x (pri=%s, sec=%s, %s%s%s)\n", 410 v4l_dbg(2, msp_debug, client, "status=0x%x (pri=%s, sec=%s, %s%s%s)\n",
411 val, 411 val,
412 (val & 0x0002) ? "no" : "yes", 412 (val & 0x0002) ? "no" : "yes",
413 (val & 0x0004) ? "no" : "yes", 413 (val & 0x0004) ? "no" : "yes",
@@ -421,13 +421,13 @@ int autodetect_stereo(struct i2c_client *client)
421 } 421 }
422 if (rxsubchans != state->rxsubchans) { 422 if (rxsubchans != state->rxsubchans) {
423 update = 1; 423 update = 1;
424 v4l_dbg(1, client, "watch: rxsubchans %d => %d\n", 424 v4l_dbg(1, msp_debug, client, "watch: rxsubchans %d => %d\n",
425 state->rxsubchans,rxsubchans); 425 state->rxsubchans,rxsubchans);
426 state->rxsubchans = rxsubchans; 426 state->rxsubchans = rxsubchans;
427 } 427 }
428 if (newnicam != state->nicam_on) { 428 if (newnicam != state->nicam_on) {
429 update = 1; 429 update = 1;
430 v4l_dbg(1, client, "watch: nicam %d => %d\n", 430 v4l_dbg(1, msp_debug, client, "watch: nicam %d => %d\n",
431 state->nicam_on,newnicam); 431 state->nicam_on,newnicam);
432 state->nicam_on = newnicam; 432 state->nicam_on = newnicam;
433 } 433 }
@@ -452,7 +452,7 @@ static void watch_stereo(struct i2c_client *client)
452 msp3400c_setstereo(client, V4L2_TUNER_MODE_MONO); 452 msp3400c_setstereo(client, V4L2_TUNER_MODE_MONO);
453 } 453 }
454 454
455 if (once) 455 if (msp_once)
456 state->watch_stereo = 0; 456 state->watch_stereo = 0;
457} 457}
458 458
@@ -464,21 +464,21 @@ int msp3400c_thread(void *data)
464 int count, max1,max2,val1,val2, val,this; 464 int count, max1,max2,val1,val2, val,this;
465 465
466 466
467 v4l_dbg(1, client, "msp3400 daemon started\n"); 467 v4l_dbg(1, msp_debug, client, "msp3400 daemon started\n");
468 for (;;) { 468 for (;;) {
469 v4l_dbg(2, client, "msp3400 thread: sleep\n"); 469 v4l_dbg(2, msp_debug, client, "msp3400 thread: sleep\n");
470 msp_sleep(state, -1); 470 msp_sleep(state, -1);
471 v4l_dbg(2, client, "msp3400 thread: wakeup\n"); 471 v4l_dbg(2, msp_debug, client, "msp3400 thread: wakeup\n");
472 472
473 restart: 473 restart:
474 v4l_dbg(1, client, "thread: restart scan\n"); 474 v4l_dbg(1, msp_debug, client, "thread: restart scan\n");
475 state->restart = 0; 475 state->restart = 0;
476 if (kthread_should_stop()) 476 if (kthread_should_stop())
477 break; 477 break;
478 478
479 if (state->radio || MSP_MODE_EXTERN == state->mode) { 479 if (state->radio || MSP_MODE_EXTERN == state->mode) {
480 /* no carrier scan, just unmute */ 480 /* no carrier scan, just unmute */
481 v4l_dbg(1, client, "thread: no carrier scan\n"); 481 v4l_dbg(1, msp_debug, client, "thread: no carrier scan\n");
482 msp_set_audio(client); 482 msp_set_audio(client);
483 continue; 483 continue;
484 } 484 }
@@ -498,11 +498,11 @@ int msp3400c_thread(void *data)
498 cd = msp3400c_carrier_detect_main; 498 cd = msp3400c_carrier_detect_main;
499 count = ARRAY_SIZE(msp3400c_carrier_detect_main); 499 count = ARRAY_SIZE(msp3400c_carrier_detect_main);
500 500
501 if (amsound && (state->v4l2_std & V4L2_STD_SECAM)) { 501 if (msp_amsound && (state->v4l2_std & V4L2_STD_SECAM)) {
502 /* autodetect doesn't work well with AM ... */ 502 /* autodetect doesn't work well with AM ... */
503 max1 = 3; 503 max1 = 3;
504 count = 0; 504 count = 0;
505 v4l_dbg(1, client, "AM sound override\n"); 505 v4l_dbg(1, msp_debug, client, "AM sound override\n");
506 } 506 }
507 507
508 for (this = 0; this < count; this++) { 508 for (this = 0; this < count; this++) {
@@ -514,7 +514,7 @@ int msp3400c_thread(void *data)
514 val -= 65536; 514 val -= 65536;
515 if (val1 < val) 515 if (val1 < val)
516 val1 = val, max1 = this; 516 val1 = val, max1 = this;
517 v4l_dbg(1, client, "carrier1 val: %5d / %s\n", val,cd[this].name); 517 v4l_dbg(1, msp_debug, client, "carrier1 val: %5d / %s\n", val,cd[this].name);
518 } 518 }
519 519
520 /* carrier detect pass #2 -- second (stereo) carrier */ 520 /* carrier detect pass #2 -- second (stereo) carrier */
@@ -535,7 +535,7 @@ int msp3400c_thread(void *data)
535 break; 535 break;
536 } 536 }
537 537
538 if (amsound && (state->v4l2_std & V4L2_STD_SECAM)) { 538 if (msp_amsound && (state->v4l2_std & V4L2_STD_SECAM)) {
539 /* autodetect doesn't work well with AM ... */ 539 /* autodetect doesn't work well with AM ... */
540 cd = NULL; 540 cd = NULL;
541 count = 0; 541 count = 0;
@@ -550,7 +550,7 @@ int msp3400c_thread(void *data)
550 val -= 65536; 550 val -= 65536;
551 if (val2 < val) 551 if (val2 < val)
552 val2 = val, max2 = this; 552 val2 = val, max2 = this;
553 v4l_dbg(1, client, "carrier2 val: %5d / %s\n", val,cd[this].name); 553 v4l_dbg(1, msp_debug, client, "carrier2 val: %5d / %s\n", val,cd[this].name);
554 } 554 }
555 555
556 /* program the msp3400 according to the results */ 556 /* program the msp3400 according to the results */
@@ -627,7 +627,7 @@ int msp3400c_thread(void *data)
627 /* unmute */ 627 /* unmute */
628 msp_set_audio(client); 628 msp_set_audio(client);
629 629
630 if (debug) 630 if (msp_debug)
631 msp3400c_print_mode(client); 631 msp3400c_print_mode(client);
632 632
633 /* monitor tv audio mode */ 633 /* monitor tv audio mode */
@@ -637,7 +637,7 @@ int msp3400c_thread(void *data)
637 watch_stereo(client); 637 watch_stereo(client);
638 } 638 }
639 } 639 }
640 v4l_dbg(1, client, "thread: exit\n"); 640 v4l_dbg(1, msp_debug, client, "thread: exit\n");
641 return 0; 641 return 0;
642} 642}
643 643
@@ -648,22 +648,22 @@ int msp3410d_thread(void *data)
648 struct msp_state *state = i2c_get_clientdata(client); 648 struct msp_state *state = i2c_get_clientdata(client);
649 int val, i, std; 649 int val, i, std;
650 650
651 v4l_dbg(1, client, "msp3410 daemon started\n"); 651 v4l_dbg(1, msp_debug, client, "msp3410 daemon started\n");
652 652
653 for (;;) { 653 for (;;) {
654 v4l_dbg(2, client, "msp3410 thread: sleep\n"); 654 v4l_dbg(2, msp_debug, client, "msp3410 thread: sleep\n");
655 msp_sleep(state,-1); 655 msp_sleep(state,-1);
656 v4l_dbg(2, client, "msp3410 thread: wakeup\n"); 656 v4l_dbg(2, msp_debug, client, "msp3410 thread: wakeup\n");
657 657
658 restart: 658 restart:
659 v4l_dbg(1, client, "thread: restart scan\n"); 659 v4l_dbg(1, msp_debug, client, "thread: restart scan\n");
660 state->restart = 0; 660 state->restart = 0;
661 if (kthread_should_stop()) 661 if (kthread_should_stop())
662 break; 662 break;
663 663
664 if (state->mode == MSP_MODE_EXTERN) { 664 if (state->mode == MSP_MODE_EXTERN) {
665 /* no carrier scan needed, just unmute */ 665 /* no carrier scan needed, just unmute */
666 v4l_dbg(1, client, "thread: no carrier scan\n"); 666 v4l_dbg(1, msp_debug, client, "thread: no carrier scan\n");
667 msp_set_audio(client); 667 msp_set_audio(client);
668 continue; 668 continue;
669 } 669 }
@@ -682,8 +682,8 @@ int msp3410d_thread(void *data)
682 std = (state->v4l2_std & V4L2_STD_NTSC) ? 0x20 : 1; 682 std = (state->v4l2_std & V4L2_STD_NTSC) ? 0x20 : 1;
683 state->watch_stereo = 0; 683 state->watch_stereo = 0;
684 684
685 if (debug) 685 if (msp_debug)
686 v4l_dbg(1, client, "setting standard: %s (0x%04x)\n", 686 v4l_dbg(1, msp_debug, client, "setting standard: %s (0x%04x)\n",
687 msp_standard_std_name(std), std); 687 msp_standard_std_name(std), std);
688 688
689 if (std != 1) { 689 if (std != 1) {
@@ -700,22 +700,22 @@ int msp3410d_thread(void *data)
700 val = msp_read_dem(client, 0x7e); 700 val = msp_read_dem(client, 0x7e);
701 if (val < 0x07ff) 701 if (val < 0x07ff)
702 break; 702 break;
703 v4l_dbg(1, client, "detection still in progress\n"); 703 v4l_dbg(1, msp_debug, client, "detection still in progress\n");
704 } 704 }
705 } 705 }
706 for (i = 0; msp_stdlist[i].name != NULL; i++) 706 for (i = 0; msp_stdlist[i].name != NULL; i++)
707 if (msp_stdlist[i].retval == val) 707 if (msp_stdlist[i].retval == val)
708 break; 708 break;
709 v4l_dbg(1, client, "current standard: %s (0x%04x)\n", 709 v4l_dbg(1, msp_debug, client, "current standard: %s (0x%04x)\n",
710 msp_standard_std_name(val), val); 710 msp_standard_std_name(val), val);
711 state->main = msp_stdlist[i].main; 711 state->main = msp_stdlist[i].main;
712 state->second = msp_stdlist[i].second; 712 state->second = msp_stdlist[i].second;
713 state->std = val; 713 state->std = val;
714 714
715 if (amsound && !state->radio && (state->v4l2_std & V4L2_STD_SECAM) && 715 if (msp_amsound && !state->radio && (state->v4l2_std & V4L2_STD_SECAM) &&
716 (val != 0x0009)) { 716 (val != 0x0009)) {
717 /* autodetection has failed, let backup */ 717 /* autodetection has failed, let backup */
718 v4l_dbg(1, client, "autodetection failed," 718 v4l_dbg(1, msp_debug, client, "autodetection failed,"
719 " switching to backup standard: %s (0x%04x)\n", 719 " switching to backup standard: %s (0x%04x)\n",
720 msp_stdlist[8].name ? msp_stdlist[8].name : "unknown",val); 720 msp_stdlist[8].name ? msp_stdlist[8].name : "unknown",val);
721 val = 0x0009; 721 val = 0x0009;
@@ -798,13 +798,13 @@ int msp3410d_thread(void *data)
798 watch_stereo(client); 798 watch_stereo(client);
799 } 799 }
800 } 800 }
801 v4l_dbg(1, client, "thread: exit\n"); 801 v4l_dbg(1, msp_debug, client, "thread: exit\n");
802 return 0; 802 return 0;
803} 803}
804 804
805/* ----------------------------------------------------------------------- */ 805/* ----------------------------------------------------------------------- */
806 806
807/* msp34xxG + (autoselect no-thread) */ 807/* msp34xxG + (autoselect no-thread) */
808/* this one uses both automatic standard detection and automatic sound */ 808/* this one uses both automatic standard detection and automatic sound */
809/* select which are available in the newer G versions */ 809/* select which are available in the newer G versions */
810/* struct msp: only norm, acb and source are really used in this mode */ 810/* struct msp: only norm, acb and source are really used in this mode */
@@ -825,7 +825,7 @@ static void msp34xxg_set_source(struct i2c_client *client, int source)
825 */ 825 */
826 int value = (source & 0x07) << 8 | (source == 0 ? 0x30 : 0x20); 826 int value = (source & 0x07) << 8 | (source == 0 ? 0x30 : 0x20);
827 827
828 v4l_dbg(1, client, "set source to %d (0x%x)\n", source, value); 828 v4l_dbg(1, msp_debug, client, "set source to %d (0x%x)\n", source, value);
829 /* Loudspeaker Output */ 829 /* Loudspeaker Output */
830 msp_write_dsp(client, 0x08, value); 830 msp_write_dsp(client, 0x08, value);
831 /* SCART1 DA Output */ 831 /* SCART1 DA Output */
@@ -840,7 +840,7 @@ static void msp34xxg_set_source(struct i2c_client *client, int source)
840 * 0x7f0 = forced mono mode 840 * 0x7f0 = forced mono mode
841 */ 841 */
842 /* a2 threshold for stereo/bilingual */ 842 /* a2 threshold for stereo/bilingual */
843 msp_write_dem(client, 0x22, stereo_threshold); 843 msp_write_dem(client, 0x22, msp_stereo_thresh);
844 state->source = source; 844 state->source = source;
845} 845}
846 846
@@ -897,28 +897,28 @@ int msp34xxg_thread(void *data)
897 struct msp_state *state = i2c_get_clientdata(client); 897 struct msp_state *state = i2c_get_clientdata(client);
898 int val, std, i; 898 int val, std, i;
899 899
900 v4l_dbg(1, client, "msp34xxg daemon started\n"); 900 v4l_dbg(1, msp_debug, client, "msp34xxg daemon started\n");
901 901
902 state->source = 1; /* default */ 902 state->source = 1; /* default */
903 for (;;) { 903 for (;;) {
904 v4l_dbg(2, client, "msp34xxg thread: sleep\n"); 904 v4l_dbg(2, msp_debug, client, "msp34xxg thread: sleep\n");
905 msp_sleep(state, -1); 905 msp_sleep(state, -1);
906 v4l_dbg(2, client, "msp34xxg thread: wakeup\n"); 906 v4l_dbg(2, msp_debug, client, "msp34xxg thread: wakeup\n");
907 907
908 restart: 908 restart:
909 v4l_dbg(1, client, "thread: restart scan\n"); 909 v4l_dbg(1, msp_debug, client, "thread: restart scan\n");
910 state->restart = 0; 910 state->restart = 0;
911 if (kthread_should_stop()) 911 if (kthread_should_stop())
912 break; 912 break;
913 913
914 /* setup the chip*/ 914 /* setup the chip*/
915 msp34xxg_reset(client); 915 msp34xxg_reset(client);
916 std = standard; 916 std = msp_standard;
917 if (std != 0x01) 917 if (std != 0x01)
918 goto unmute; 918 goto unmute;
919 919
920 /* watch autodetect */ 920 /* watch autodetect */
921 v4l_dbg(1, client, "triggered autodetect, waiting for result\n"); 921 v4l_dbg(1, msp_debug, client, "triggered autodetect, waiting for result\n");
922 for (i = 0; i < 10; i++) { 922 for (i = 0; i < 10; i++) {
923 if (msp_sleep(state, 100)) 923 if (msp_sleep(state, 100))
924 goto restart; 924 goto restart;
@@ -929,16 +929,16 @@ int msp34xxg_thread(void *data)
929 std = val; 929 std = val;
930 break; 930 break;
931 } 931 }
932 v4l_dbg(2, client, "detection still in progress\n"); 932 v4l_dbg(2, msp_debug, client, "detection still in progress\n");
933 } 933 }
934 if (std == 1) { 934 if (std == 1) {
935 v4l_dbg(1, client, "detection still in progress after 10 tries. giving up.\n"); 935 v4l_dbg(1, msp_debug, client, "detection still in progress after 10 tries. giving up.\n");
936 continue; 936 continue;
937 } 937 }
938 938
939 unmute: 939 unmute:
940 state->std = std; 940 state->std = std;
941 v4l_dbg(1, client, "current standard: %s (0x%04x)\n", 941 v4l_dbg(1, msp_debug, client, "current standard: %s (0x%04x)\n",
942 msp_standard_std_name(std), std); 942 msp_standard_std_name(std), std);
943 943
944 /* unmute: dispatch sound to scart output, set scart volume */ 944 /* unmute: dispatch sound to scart output, set scart volume */
@@ -950,7 +950,7 @@ int msp34xxg_thread(void *data)
950 950
951 msp_write_dem(client, 0x40, state->i2s_mode); 951 msp_write_dem(client, 0x40, state->i2s_mode);
952 } 952 }
953 v4l_dbg(1, client, "thread: exit\n"); 953 v4l_dbg(1, msp_debug, client, "thread: exit\n");
954 return 0; 954 return 0;
955} 955}
956 956
@@ -976,7 +976,7 @@ void msp34xxg_detect_stereo(struct i2c_client *client)
976 * this is a problem, I'll handle SAP just like lang1/lang2. 976 * this is a problem, I'll handle SAP just like lang1/lang2.
977 */ 977 */
978 } 978 }
979 v4l_dbg(1, client, "status=0x%x, stereo=%d, bilingual=%d -> rxsubchans=%d\n", 979 v4l_dbg(1, msp_debug, client, "status=0x%x, stereo=%d, bilingual=%d -> rxsubchans=%d\n",
980 status, is_stereo, is_bilingual, state->rxsubchans); 980 status, is_stereo, is_bilingual, state->rxsubchans);
981} 981}
982 982