aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/msp3400-kthreads.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/msp3400-kthreads.c')
-rw-r--r--drivers/media/video/msp3400-kthreads.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/media/video/msp3400-kthreads.c b/drivers/media/video/msp3400-kthreads.c
index 934f0d3b913..4ecbf56b008 100644
--- a/drivers/media/video/msp3400-kthreads.c
+++ b/drivers/media/video/msp3400-kthreads.c
@@ -203,7 +203,7 @@ void msp3400c_setmode(struct i2c_client *client, int type)
203 msp_write_dsp(client, 0x000a, msp3400c_init_data[type].dsp_src); 203 msp_write_dsp(client, 0x000a, msp3400c_init_data[type].dsp_src);
204 msp_write_dsp(client, 0x000e, msp3400c_init_data[type].dsp_matrix); 204 msp_write_dsp(client, 0x000e, msp3400c_init_data[type].dsp_matrix);
205 205
206 if (HAVE_NICAM(state)) { 206 if (state->has_nicam) {
207 /* nicam prescale */ 207 /* nicam prescale */
208 msp_write_dsp(client, 0x0010, 0x5a00); /* was: 0x3000 */ 208 msp_write_dsp(client, 0x0010, 0x5a00); /* was: 0x3000 */
209 } 209 }
@@ -487,8 +487,7 @@ int msp3400c_thread(void *data)
487 if (kthread_should_stop()) 487 if (kthread_should_stop())
488 break; 488 break;
489 489
490 if (VIDEO_MODE_RADIO == state->norm || 490 if (state->radio || MSP_MODE_EXTERN == state->mode) {
491 MSP_MODE_EXTERN == state->mode) {
492 /* no carrier scan, just unmute */ 491 /* no carrier scan, just unmute */
493 v4l_dbg(1, client, "thread: no carrier scan\n"); 492 v4l_dbg(1, client, "thread: no carrier scan\n");
494 msp_set_audio(client); 493 msp_set_audio(client);
@@ -510,7 +509,7 @@ int msp3400c_thread(void *data)
510 cd = msp3400c_carrier_detect_main; 509 cd = msp3400c_carrier_detect_main;
511 count = ARRAY_SIZE(msp3400c_carrier_detect_main); 510 count = ARRAY_SIZE(msp3400c_carrier_detect_main);
512 511
513 if (amsound && (state->norm == VIDEO_MODE_SECAM)) { 512 if (amsound && (state->std & V4L2_STD_SECAM)) {
514 /* autodetect doesn't work well with AM ... */ 513 /* autodetect doesn't work well with AM ... */
515 max1 = 3; 514 max1 = 3;
516 count = 0; 515 count = 0;
@@ -547,7 +546,7 @@ int msp3400c_thread(void *data)
547 break; 546 break;
548 } 547 }
549 548
550 if (amsound && (state->norm == VIDEO_MODE_SECAM)) { 549 if (amsound && (state->std & V4L2_STD_SECAM)) {
551 /* autodetect doesn't work well with AM ... */ 550 /* autodetect doesn't work well with AM ... */
552 cd = NULL; 551 cd = NULL;
553 count = 0; 552 count = 0;
@@ -576,7 +575,7 @@ int msp3400c_thread(void *data)
576 state->nicam_on = 0; 575 state->nicam_on = 0;
577 msp3400c_setstereo(client, V4L2_TUNER_MODE_MONO); 576 msp3400c_setstereo(client, V4L2_TUNER_MODE_MONO);
578 state->watch_stereo = 1; 577 state->watch_stereo = 1;
579 } else if (max2 == 1 && HAVE_NICAM(state)) { 578 } else if (max2 == 1 && state->has_nicam) {
580 /* B/G NICAM */ 579 /* B/G NICAM */
581 state->second = msp3400c_carrier_detect_55[max2].cdo; 580 state->second = msp3400c_carrier_detect_55[max2].cdo;
582 msp3400c_setmode(client, MSP_MODE_FM_NICAM1); 581 msp3400c_setmode(client, MSP_MODE_FM_NICAM1);
@@ -603,8 +602,7 @@ int msp3400c_thread(void *data)
603 state->nicam_on = 0; 602 state->nicam_on = 0;
604 msp3400c_setstereo(client, V4L2_TUNER_MODE_MONO); 603 msp3400c_setstereo(client, V4L2_TUNER_MODE_MONO);
605 state->watch_stereo = 1; 604 state->watch_stereo = 1;
606 } else if (max2 == 0 && 605 } else if (max2 == 0 && (state->std & V4L2_STD_SECAM)) {
607 state->norm == VIDEO_MODE_SECAM) {
608 /* L NICAM or AM-mono */ 606 /* L NICAM or AM-mono */
609 state->second = msp3400c_carrier_detect_65[max2].cdo; 607 state->second = msp3400c_carrier_detect_65[max2].cdo;
610 msp3400c_setmode(client, MSP_MODE_AM_NICAM); 608 msp3400c_setmode(client, MSP_MODE_AM_NICAM);
@@ -614,7 +612,7 @@ int msp3400c_thread(void *data)
614 /* volume prescale for SCART (AM mono input) */ 612 /* volume prescale for SCART (AM mono input) */
615 msp_write_dsp(client, 0x000d, 0x1900); 613 msp_write_dsp(client, 0x000d, 0x1900);
616 state->watch_stereo = 1; 614 state->watch_stereo = 1;
617 } else if (max2 == 0 && HAVE_NICAM(state)) { 615 } else if (max2 == 0 && state->has_nicam) {
618 /* D/K NICAM */ 616 /* D/K NICAM */
619 state->second = msp3400c_carrier_detect_65[max2].cdo; 617 state->second = msp3400c_carrier_detect_65[max2].cdo;
620 msp3400c_setmode(client, MSP_MODE_FM_NICAM1); 618 msp3400c_setmode(client, MSP_MODE_FM_NICAM1);
@@ -689,8 +687,8 @@ int msp3410d_thread(void *data)
689 goto restart; 687 goto restart;
690 688
691 /* start autodetect */ 689 /* start autodetect */
692 mode = msp_modus(client, state->norm); 690 mode = msp_modus(client);
693 std = msp_standard(state->norm); 691 std = (state->std & V4L2_STD_NTSC) ? 0x20 : 1;
694 msp_write_dem(client, 0x30, mode); 692 msp_write_dem(client, 0x30, mode);
695 msp_write_dem(client, 0x20, std); 693 msp_write_dem(client, 0x20, std);
696 state->watch_stereo = 0; 694 state->watch_stereo = 0;
@@ -723,7 +721,7 @@ int msp3410d_thread(void *data)
723 state->main = msp_modelist[i].main; 721 state->main = msp_modelist[i].main;
724 state->second = msp_modelist[i].second; 722 state->second = msp_modelist[i].second;
725 723
726 if (amsound && (state->norm == VIDEO_MODE_SECAM) && (val != 0x0009)) { 724 if (amsound && (state->std & V4L2_STD_SECAM) && (val != 0x0009)) {
727 /* autodetection has failed, let backup */ 725 /* autodetection has failed, let backup */
728 v4l_dbg(1, client, "autodetection failed," 726 v4l_dbg(1, client, "autodetection failed,"
729 " switching to backup mode: %s (0x%04x)\n", 727 " switching to backup mode: %s (0x%04x)\n",
@@ -767,12 +765,12 @@ int msp3410d_thread(void *data)
767 msp3400c_setstereo(client,V4L2_TUNER_MODE_STEREO); 765 msp3400c_setstereo(client,V4L2_TUNER_MODE_STEREO);
768 break; 766 break;
769 case 0x0040: /* FM radio */ 767 case 0x0040: /* FM radio */
770 state->mode = MSP_MODE_FM_RADIO; 768 state->mode = MSP_MODE_FM_RADIO;
771 state->rxsubchans = V4L2_TUNER_SUB_STEREO; 769 state->rxsubchans = V4L2_TUNER_SUB_STEREO;
772 state->audmode = V4L2_TUNER_MODE_STEREO; 770 state->audmode = V4L2_TUNER_MODE_STEREO;
773 state->nicam_on = 0; 771 state->nicam_on = 0;
774 state->watch_stereo = 0; 772 state->watch_stereo = 0;
775 /* not needed in theory if HAVE_RADIO(), but 773 /* not needed in theory if we have radio, but
776 short programming enables carrier mute */ 774 short programming enables carrier mute */
777 msp3400c_setmode(client,MSP_MODE_FM_RADIO); 775 msp3400c_setmode(client,MSP_MODE_FM_RADIO);
778 msp3400c_setcarrier(client, MSP_CARRIER(10.7), 776 msp3400c_setcarrier(client, MSP_CARRIER(10.7),
@@ -872,8 +870,11 @@ static int msp34xxg_reset(struct i2c_client *client)
872 msp_write_dem(client, 0x40, state->i2s_mode); 870 msp_write_dem(client, 0x40, state->i2s_mode);
873 871
874 /* step-by-step initialisation, as described in the manual */ 872 /* step-by-step initialisation, as described in the manual */
875 modus = msp_modus(client, state->norm); 873 modus = msp_modus(client);
876 std = msp_standard(state->norm); 874 if (state->radio)
875 std = 0x40;
876 else
877 std = (state->std & V4L2_STD_NTSC) ? 0x20 : 1;
877 modus &= ~0x03; /* STATUS_CHANGE = 0 */ 878 modus &= ~0x03; /* STATUS_CHANGE = 0 */
878 modus |= 0x01; /* AUTOMATIC_SOUND_DETECTION = 1 */ 879 modus |= 0x01; /* AUTOMATIC_SOUND_DETECTION = 1 */
879 if (msp_write_dem(client, 0x30, modus)) 880 if (msp_write_dem(client, 0x30, modus))