@@ -37,7 +37,7 @@ static struct {
37
37
int retval ;
38
38
int main , second ;
39
39
char * name ;
40
- } msp_modelist [] = {
40
+ } msp_stdlist [] = {
41
41
{ 0x0000 , 0 , 0 , "could not detect sound standard" },
42
42
{ 0x0001 , 0 , 0 , "autodetect start" },
43
43
{ 0x0002 , MSP_CARRIER (4.5 ), MSP_CARRIER (4.72 ), "4.5/4.72 M Dual FM-Stereo" },
@@ -144,13 +144,13 @@ static struct msp3400c_carrier_detect msp3400c_carrier_detect_65[] = {
144
144
145
145
/* ------------------------------------------------------------------------ */
146
146
147
- const char * msp_standard_mode_name (int mode )
147
+ const char * msp_standard_std_name (int std )
148
148
{
149
149
int i ;
150
150
151
- for (i = 0 ; msp_modelist [i ].name != NULL ; i ++ )
152
- if (msp_modelist [i ].retval == mode )
153
- return msp_modelist [i ].name ;
151
+ for (i = 0 ; msp_stdlist [i ].name != NULL ; i ++ )
152
+ if (msp_stdlist [i ].retval == std )
153
+ return msp_stdlist [i ].name ;
154
154
return "unknown" ;
155
155
}
156
156
@@ -498,7 +498,7 @@ int msp3400c_thread(void *data)
498
498
cd = msp3400c_carrier_detect_main ;
499
499
count = ARRAY_SIZE (msp3400c_carrier_detect_main );
500
500
501
- if (amsound && (state -> std & V4L2_STD_SECAM )) {
501
+ if (amsound && (state -> v4l2_std & V4L2_STD_SECAM )) {
502
502
/* autodetect doesn't work well with AM ... */
503
503
max1 = 3 ;
504
504
count = 0 ;
@@ -535,7 +535,7 @@ int msp3400c_thread(void *data)
535
535
break ;
536
536
}
537
537
538
- if (amsound && (state -> std & V4L2_STD_SECAM )) {
538
+ if (amsound && (state -> v4l2_std & V4L2_STD_SECAM )) {
539
539
/* autodetect doesn't work well with AM ... */
540
540
cd = NULL ;
541
541
count = 0 ;
@@ -591,7 +591,7 @@ int msp3400c_thread(void *data)
591
591
state -> nicam_on = 0 ;
592
592
msp3400c_setstereo (client , V4L2_TUNER_MODE_MONO );
593
593
state -> watch_stereo = 1 ;
594
- } else if (max2 == 0 && (state -> std & V4L2_STD_SECAM )) {
594
+ } else if (max2 == 0 && (state -> v4l2_std & V4L2_STD_SECAM )) {
595
595
/* L NICAM or AM-mono */
596
596
state -> second = msp3400c_carrier_detect_65 [max2 ].cdo ;
597
597
msp3400c_setmode (client , MSP_MODE_AM_NICAM );
@@ -676,22 +676,22 @@ int msp3410d_thread(void *data)
676
676
goto restart ;
677
677
678
678
/* start autodetect */
679
- std = 1 ;
680
- if (state -> std & V4L2_STD_NTSC )
681
- std = 0x20 ;
679
+ if (state -> radio )
680
+ std = 0x40 ;
682
681
else
683
- msp_write_dem ( client , 0x20 , std ) ;
682
+ std = ( state -> v4l2_std & V4L2_STD_NTSC ) ? 0x20 : 1 ;
684
683
state -> watch_stereo = 0 ;
685
684
686
685
if (debug )
687
- v4l_dbg (1 , client , "setting mode : %s (0x%04x)\n" ,
688
- msp_standard_mode_name (std ), std );
686
+ v4l_dbg (1 , client , "setting standard : %s (0x%04x)\n" ,
687
+ msp_standard_std_name (std ), std );
689
688
690
689
if (std != 1 ) {
691
690
/* programmed some specific mode */
692
691
val = std ;
693
692
} else {
694
693
/* triggered autodetect */
694
+ msp_write_dem (client , 0x20 , std );
695
695
for (;;) {
696
696
if (msp_sleep (state , 100 ))
697
697
goto restart ;
@@ -703,19 +703,21 @@ int msp3410d_thread(void *data)
703
703
v4l_dbg (1 , client , "detection still in progress\n" );
704
704
}
705
705
}
706
- for (i = 0 ; msp_modelist [i ].name != NULL ; i ++ )
707
- if (msp_modelist [i ].retval == val )
706
+ for (i = 0 ; msp_stdlist [i ].name != NULL ; i ++ )
707
+ if (msp_stdlist [i ].retval == val )
708
708
break ;
709
- v4l_dbg (1 , client , "current mode: %s (0x%04x)\n" ,
710
- msp_standard_mode_name (val ), val );
711
- state -> main = msp_modelist [i ].main ;
712
- state -> second = msp_modelist [i ].second ;
713
-
714
- if (amsound && (state -> std & V4L2_STD_SECAM ) && (val != 0x0009 )) {
709
+ v4l_dbg (1 , client , "current standard: %s (0x%04x)\n" ,
710
+ msp_standard_std_name (val ), val );
711
+ state -> main = msp_stdlist [i ].main ;
712
+ state -> second = msp_stdlist [i ].second ;
713
+ state -> std = val ;
714
+
715
+ if (amsound && !state -> radio && (state -> v4l2_std & V4L2_STD_SECAM ) &&
716
+ (val != 0x0009 )) {
715
717
/* autodetection has failed, let backup */
716
718
v4l_dbg (1 , client , "autodetection failed,"
717
- " switching to backup mode : %s (0x%04x)\n" ,
718
- msp_modelist [8 ].name ? msp_modelist [8 ].name : "unknown" ,val );
719
+ " switching to backup standard : %s (0x%04x)\n" ,
720
+ msp_stdlist [8 ].name ? msp_stdlist [8 ].name : "unknown" ,val );
719
721
val = 0x0009 ;
720
722
msp_write_dem (client , 0x20 , val );
721
723
}
@@ -762,7 +764,7 @@ int msp3410d_thread(void *data)
762
764
state -> watch_stereo = 0 ;
763
765
/* not needed in theory if we have radio, but
764
766
short programming enables carrier mute */
765
- msp3400c_setmode (client ,MSP_MODE_FM_RADIO );
767
+ msp3400c_setmode (client , MSP_MODE_FM_RADIO );
766
768
msp3400c_setcarrier (client , MSP_CARRIER (10.7 ),
767
769
MSP_CARRIER (10.7 ));
768
770
/* scart routing */
@@ -775,7 +777,7 @@ int msp3410d_thread(void *data)
775
777
case 0x0003 :
776
778
case 0x0004 :
777
779
case 0x0005 :
778
- state -> mode = MSP_MODE_FM_TERRA ;
780
+ state -> mode = MSP_MODE_FM_TERRA ;
779
781
state -> rxsubchans = V4L2_TUNER_SUB_MONO ;
780
782
state -> audmode = V4L2_TUNER_MODE_MONO ;
781
783
state -> nicam_on = 0 ;
@@ -786,7 +788,8 @@ int msp3410d_thread(void *data)
786
788
/* unmute, restore misc registers */
787
789
msp_set_audio (client );
788
790
msp_write_dsp (client , 0x13 , state -> acb );
789
- msp_write_dem (client , 0x40 , state -> i2s_mode );
791
+ if (state -> has_i2s_conf )
792
+ msp_write_dem (client , 0x40 , state -> i2s_mode );
790
793
791
794
/* monitor tv audio mode */
792
795
while (state -> watch_stereo ) {
@@ -857,14 +860,15 @@ static int msp34xxg_reset(struct i2c_client *client)
857
860
if (msp_write_dsp (client , 0x13 , 0x0f20 ))
858
861
return -1 ;
859
862
860
- msp_write_dem (client , 0x40 , state -> i2s_mode );
863
+ if (state -> has_i2s_conf )
864
+ msp_write_dem (client , 0x40 , state -> i2s_mode );
861
865
862
866
/* step-by-step initialisation, as described in the manual */
863
867
modus = msp_modus (client );
864
868
if (state -> radio )
865
869
std = 0x40 ;
866
870
else
867
- std = (state -> std & V4L2_STD_NTSC ) ? 0x20 : 1 ;
871
+ std = (state -> v4l2_std & V4L2_STD_NTSC ) ? 0x20 : 1 ;
868
872
modus &= ~0x03 ; /* STATUS_CHANGE = 0 */
869
873
modus |= 0x01 ; /* AUTOMATIC_SOUND_DETECTION = 1 */
870
874
if (msp_write_dem (client , 0x30 , modus ))
@@ -933,9 +937,9 @@ int msp34xxg_thread(void *data)
933
937
}
934
938
935
939
unmute :
936
- state -> mode = std ;
937
- v4l_dbg (1 , client , "current mode : %s (0x%04x)\n" ,
938
- msp_standard_mode_name (std ), std );
940
+ state -> std = std ;
941
+ v4l_dbg (1 , client , "current standard : %s (0x%04x)\n" ,
942
+ msp_standard_std_name (std ), std );
939
943
940
944
/* unmute: dispatch sound to scart output, set scart volume */
941
945
msp_set_audio (client );
0 commit comments