|
@@ -383,7 +383,7 @@ static int msp3400c_detect_stereo(struct i2c_client *client)
|
|
if (val > 32767)
|
|
if (val > 32767)
|
|
val -= 65536;
|
|
val -= 65536;
|
|
v4l_dbg(2, msp_debug, client, "stereo detect register: %d\n", val);
|
|
v4l_dbg(2, msp_debug, client, "stereo detect register: %d\n", val);
|
|
- if (val > 4096) {
|
|
|
|
|
|
+ if (val > 8192) {
|
|
rxsubchans = V4L2_TUNER_SUB_STEREO;
|
|
rxsubchans = V4L2_TUNER_SUB_STEREO;
|
|
} else if (val < -4096) {
|
|
} else if (val < -4096) {
|
|
rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
|
|
rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
|
|
@@ -480,12 +480,14 @@ int msp3400c_thread(void *data)
|
|
if (state->radio || MSP_MODE_EXTERN == state->mode) {
|
|
if (state->radio || MSP_MODE_EXTERN == state->mode) {
|
|
/* no carrier scan, just unmute */
|
|
/* no carrier scan, just unmute */
|
|
v4l_dbg(1, msp_debug, client, "thread: no carrier scan\n");
|
|
v4l_dbg(1, msp_debug, client, "thread: no carrier scan\n");
|
|
|
|
+ state->scan_in_progress = 0;
|
|
msp_set_audio(client);
|
|
msp_set_audio(client);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
- /* put into sane state (and mute) */
|
|
|
|
- msp_reset(client);
|
|
|
|
|
|
+ /* mute audio */
|
|
|
|
+ state->scan_in_progress = 1;
|
|
|
|
+ msp_set_audio(client);
|
|
|
|
|
|
msp3400c_set_mode(client, MSP_MODE_AM_DETECT);
|
|
msp3400c_set_mode(client, MSP_MODE_AM_DETECT);
|
|
val1 = val2 = 0;
|
|
val1 = val2 = 0;
|
|
@@ -493,7 +495,7 @@ int msp3400c_thread(void *data)
|
|
state->watch_stereo = 0;
|
|
state->watch_stereo = 0;
|
|
state->nicam_on = 0;
|
|
state->nicam_on = 0;
|
|
|
|
|
|
- /* some time for the tuner to sync */
|
|
|
|
|
|
+ /* wait for tuner to settle down after a channel change */
|
|
if (msp_sleep(state, 200))
|
|
if (msp_sleep(state, 200))
|
|
goto restart;
|
|
goto restart;
|
|
|
|
|
|
@@ -608,28 +610,26 @@ int msp3400c_thread(void *data)
|
|
no_second:
|
|
no_second:
|
|
state->second = msp3400c_carrier_detect_main[max1].cdo;
|
|
state->second = msp3400c_carrier_detect_main[max1].cdo;
|
|
msp3400c_set_mode(client, MSP_MODE_FM_TERRA);
|
|
msp3400c_set_mode(client, MSP_MODE_FM_TERRA);
|
|
- state->rxsubchans = V4L2_TUNER_SUB_MONO;
|
|
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
msp3400c_set_carrier(client, state->second, state->main);
|
|
msp3400c_set_carrier(client, state->second, state->main);
|
|
|
|
|
|
- /* unmute, restore misc registers */
|
|
|
|
- msp_set_audio(client);
|
|
|
|
-
|
|
|
|
- msp_write_dsp(client, 0x13, state->acb);
|
|
|
|
|
|
+ /* unmute */
|
|
|
|
+ state->scan_in_progress = 0;
|
|
msp3400c_set_audmode(client);
|
|
msp3400c_set_audmode(client);
|
|
|
|
+ msp_set_audio(client);
|
|
|
|
|
|
if (msp_debug)
|
|
if (msp_debug)
|
|
msp3400c_print_mode(client);
|
|
msp3400c_print_mode(client);
|
|
|
|
|
|
/* monitor tv audio mode, the first time don't wait
|
|
/* monitor tv audio mode, the first time don't wait
|
|
so long to get a quick stereo/bilingual result */
|
|
so long to get a quick stereo/bilingual result */
|
|
- count = 20;
|
|
|
|
|
|
+ count = 3;
|
|
while (state->watch_stereo) {
|
|
while (state->watch_stereo) {
|
|
- watch_stereo(client);
|
|
|
|
- if (msp_sleep(state, count ? 200 : 5000))
|
|
|
|
|
|
+ if (msp_sleep(state, count ? 1000 : 5000))
|
|
goto restart;
|
|
goto restart;
|
|
if (count) count--;
|
|
if (count) count--;
|
|
|
|
+ watch_stereo(client);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
v4l_dbg(1, msp_debug, client, "thread: exit\n");
|
|
v4l_dbg(1, msp_debug, client, "thread: exit\n");
|
|
@@ -659,16 +659,14 @@ int msp3410d_thread(void *data)
|
|
if (state->mode == MSP_MODE_EXTERN) {
|
|
if (state->mode == MSP_MODE_EXTERN) {
|
|
/* no carrier scan needed, just unmute */
|
|
/* no carrier scan needed, just unmute */
|
|
v4l_dbg(1, msp_debug, client, "thread: no carrier scan\n");
|
|
v4l_dbg(1, msp_debug, client, "thread: no carrier scan\n");
|
|
|
|
+ state->scan_in_progress = 0;
|
|
msp_set_audio(client);
|
|
msp_set_audio(client);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
- /* put into sane state (and mute) */
|
|
|
|
- msp_reset(client);
|
|
|
|
-
|
|
|
|
- /* some time for the tuner to sync */
|
|
|
|
- if (msp_sleep(state,200))
|
|
|
|
- goto restart;
|
|
|
|
|
|
+ /* mute audio */
|
|
|
|
+ state->scan_in_progress = 1;
|
|
|
|
+ msp_set_audio(client);
|
|
|
|
|
|
/* start autodetect. Note: autodetect is not supported for
|
|
/* start autodetect. Note: autodetect is not supported for
|
|
NTSC-M and radio, hence we force the standard in those cases. */
|
|
NTSC-M and radio, hence we force the standard in those cases. */
|
|
@@ -679,6 +677,10 @@ int msp3410d_thread(void *data)
|
|
state->watch_stereo = 0;
|
|
state->watch_stereo = 0;
|
|
state->nicam_on = 0;
|
|
state->nicam_on = 0;
|
|
|
|
|
|
|
|
+ /* wait for tuner to settle down after a channel change */
|
|
|
|
+ if (msp_sleep(state, 200))
|
|
|
|
+ goto restart;
|
|
|
|
+
|
|
if (msp_debug)
|
|
if (msp_debug)
|
|
v4l_dbg(2, msp_debug, client, "setting standard: %s (0x%04x)\n",
|
|
v4l_dbg(2, msp_debug, client, "setting standard: %s (0x%04x)\n",
|
|
msp_standard_std_name(std), std);
|
|
msp_standard_std_name(std), std);
|
|
@@ -708,6 +710,7 @@ int msp3410d_thread(void *data)
|
|
state->main = msp_stdlist[i].main;
|
|
state->main = msp_stdlist[i].main;
|
|
state->second = msp_stdlist[i].second;
|
|
state->second = msp_stdlist[i].second;
|
|
state->std = val;
|
|
state->std = val;
|
|
|
|
+ state->rxsubchans = V4L2_TUNER_SUB_MONO;
|
|
|
|
|
|
if (msp_amsound && !state->radio && (state->v4l2_std & V4L2_STD_SECAM) &&
|
|
if (msp_amsound && !state->radio && (state->v4l2_std & V4L2_STD_SECAM) &&
|
|
(val != 0x0009)) {
|
|
(val != 0x0009)) {
|
|
@@ -729,20 +732,17 @@ int msp3410d_thread(void *data)
|
|
else
|
|
else
|
|
state->mode = MSP_MODE_FM_NICAM1;
|
|
state->mode = MSP_MODE_FM_NICAM1;
|
|
/* just turn on stereo */
|
|
/* just turn on stereo */
|
|
- state->rxsubchans = V4L2_TUNER_SUB_STEREO;
|
|
|
|
state->nicam_on = 1;
|
|
state->nicam_on = 1;
|
|
state->watch_stereo = 1;
|
|
state->watch_stereo = 1;
|
|
break;
|
|
break;
|
|
case 0x0009:
|
|
case 0x0009:
|
|
state->mode = MSP_MODE_AM_NICAM;
|
|
state->mode = MSP_MODE_AM_NICAM;
|
|
- state->rxsubchans = V4L2_TUNER_SUB_MONO;
|
|
|
|
state->nicam_on = 1;
|
|
state->nicam_on = 1;
|
|
state->watch_stereo = 1;
|
|
state->watch_stereo = 1;
|
|
break;
|
|
break;
|
|
case 0x0020: /* BTSC */
|
|
case 0x0020: /* BTSC */
|
|
/* The pre-'G' models only have BTSC-mono */
|
|
/* The pre-'G' models only have BTSC-mono */
|
|
state->mode = MSP_MODE_BTSC;
|
|
state->mode = MSP_MODE_BTSC;
|
|
- state->rxsubchans = V4L2_TUNER_SUB_MONO;
|
|
|
|
break;
|
|
break;
|
|
case 0x0040: /* FM radio */
|
|
case 0x0040: /* FM radio */
|
|
state->mode = MSP_MODE_FM_RADIO;
|
|
state->mode = MSP_MODE_FM_RADIO;
|
|
@@ -752,15 +752,12 @@ int msp3410d_thread(void *data)
|
|
msp3400c_set_mode(client, MSP_MODE_FM_RADIO);
|
|
msp3400c_set_mode(client, MSP_MODE_FM_RADIO);
|
|
msp3400c_set_carrier(client, MSP_CARRIER(10.7),
|
|
msp3400c_set_carrier(client, MSP_CARRIER(10.7),
|
|
MSP_CARRIER(10.7));
|
|
MSP_CARRIER(10.7));
|
|
- /* scart routing (this doesn't belong here I think) */
|
|
|
|
- msp_set_scart(client,SCART_IN2,0);
|
|
|
|
break;
|
|
break;
|
|
case 0x0002:
|
|
case 0x0002:
|
|
case 0x0003:
|
|
case 0x0003:
|
|
case 0x0004:
|
|
case 0x0004:
|
|
case 0x0005:
|
|
case 0x0005:
|
|
state->mode = MSP_MODE_FM_TERRA;
|
|
state->mode = MSP_MODE_FM_TERRA;
|
|
- state->rxsubchans = V4L2_TUNER_SUB_MONO;
|
|
|
|
state->watch_stereo = 1;
|
|
state->watch_stereo = 1;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -774,20 +771,19 @@ int msp3410d_thread(void *data)
|
|
if (state->has_i2s_conf)
|
|
if (state->has_i2s_conf)
|
|
msp_write_dem(client, 0x40, state->i2s_mode);
|
|
msp_write_dem(client, 0x40, state->i2s_mode);
|
|
|
|
|
|
- /* unmute, restore misc registers */
|
|
|
|
- msp_set_audio(client);
|
|
|
|
-
|
|
|
|
- msp_write_dsp(client, 0x13, state->acb);
|
|
|
|
|
|
+ /* unmute */
|
|
msp3400c_set_audmode(client);
|
|
msp3400c_set_audmode(client);
|
|
|
|
+ state->scan_in_progress = 0;
|
|
|
|
+ msp_set_audio(client);
|
|
|
|
|
|
/* monitor tv audio mode, the first time don't wait
|
|
/* monitor tv audio mode, the first time don't wait
|
|
so long to get a quick stereo/bilingual result */
|
|
so long to get a quick stereo/bilingual result */
|
|
- count = 20;
|
|
|
|
|
|
+ count = 3;
|
|
while (state->watch_stereo) {
|
|
while (state->watch_stereo) {
|
|
- watch_stereo(client);
|
|
|
|
- if (msp_sleep(state, count ? 200 : 5000))
|
|
|
|
|
|
+ if (msp_sleep(state, count ? 1000 : 5000))
|
|
goto restart;
|
|
goto restart;
|
|
if (count) count--;
|
|
if (count) count--;
|
|
|
|
+ watch_stereo(client);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
v4l_dbg(1, msp_debug, client, "thread: exit\n");
|
|
v4l_dbg(1, msp_debug, client, "thread: exit\n");
|
|
@@ -902,10 +898,6 @@ static void msp34xxg_reset(struct i2c_client *client)
|
|
|
|
|
|
msp_reset(client);
|
|
msp_reset(client);
|
|
|
|
|
|
- /* make sure that input/output is muted (paranoid mode) */
|
|
|
|
- /* ACB, mute DSP input, mute SCART 1 */
|
|
|
|
- msp_write_dsp(client, 0x13, 0x0f20);
|
|
|
|
-
|
|
|
|
if (state->has_i2s_conf)
|
|
if (state->has_i2s_conf)
|
|
msp_write_dem(client, 0x40, state->i2s_mode);
|
|
msp_write_dem(client, 0x40, state->i2s_mode);
|
|
|
|
|