aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/msp3400-kthreads.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/media/video/msp3400-kthreads.c b/drivers/media/video/msp3400-kthreads.c
index c3984ea9ca07..2ee596db265a 100644
--- a/drivers/media/video/msp3400-kthreads.c
+++ b/drivers/media/video/msp3400-kthreads.c
@@ -228,6 +228,7 @@ static void msp3400c_set_audmode(struct i2c_client *client)
228 char *modestr = (state->audmode >= 0 && state->audmode < 5) ? 228 char *modestr = (state->audmode >= 0 && state->audmode < 5) ?
229 strmode[state->audmode] : "unknown"; 229 strmode[state->audmode] : "unknown";
230 int src = 0; /* channel source: FM/AM, nicam or SCART */ 230 int src = 0; /* channel source: FM/AM, nicam or SCART */
231 int audmode = state->audmode;
231 232
232 if (state->opmode == OPMODE_AUTOSELECT) { 233 if (state->opmode == OPMODE_AUTOSELECT) {
233 /* this method would break everything, let's make sure 234 /* this method would break everything, let's make sure
@@ -239,11 +240,22 @@ static void msp3400c_set_audmode(struct i2c_client *client)
239 return; 240 return;
240 } 241 }
241 242
243 /* If no second language is available, switch to the first language */
244 if ((audmode == V4L2_TUNER_MODE_LANG2 ||
245 audmode == V4L2_TUNER_MODE_LANG1_LANG2) &&
246 !(state->rxsubchans & V4L2_TUNER_SUB_LANG2))
247 audmode = V4L2_TUNER_MODE_LANG1;
248 /* switch to stereo for stereo transmission, otherwise
249 keep first language */
250 if (audmode == V4L2_TUNER_MODE_LANG1 &&
251 (state->rxsubchans & V4L2_TUNER_SUB_STEREO))
252 audmode = V4L2_TUNER_MODE_STEREO;
253
242 /* switch demodulator */ 254 /* switch demodulator */
243 switch (state->mode) { 255 switch (state->mode) {
244 case MSP_MODE_FM_TERRA: 256 case MSP_MODE_FM_TERRA:
245 v4l_dbg(1, msp_debug, client, "FM set_audmode: %s\n", modestr); 257 v4l_dbg(1, msp_debug, client, "FM set_audmode: %s\n", modestr);
246 switch (state->audmode) { 258 switch (audmode) {
247 case V4L2_TUNER_MODE_STEREO: 259 case V4L2_TUNER_MODE_STEREO:
248 msp_write_dsp(client, 0x000e, 0x3001); 260 msp_write_dsp(client, 0x000e, 0x3001);
249 break; 261 break;
@@ -257,7 +269,7 @@ static void msp3400c_set_audmode(struct i2c_client *client)
257 break; 269 break;
258 case MSP_MODE_FM_SAT: 270 case MSP_MODE_FM_SAT:
259 v4l_dbg(1, msp_debug, client, "SAT set_audmode: %s\n", modestr); 271 v4l_dbg(1, msp_debug, client, "SAT set_audmode: %s\n", modestr);
260 switch (state->audmode) { 272 switch (audmode) {
261 case V4L2_TUNER_MODE_MONO: 273 case V4L2_TUNER_MODE_MONO:
262 msp3400c_set_carrier(client, MSP_CARRIER(6.5), MSP_CARRIER(6.5)); 274 msp3400c_set_carrier(client, MSP_CARRIER(6.5), MSP_CARRIER(6.5));
263 break; 275 break;
@@ -296,7 +308,7 @@ static void msp3400c_set_audmode(struct i2c_client *client)
296 } 308 }
297 309
298 /* switch audio */ 310 /* switch audio */
299 switch (state->audmode) { 311 switch (audmode) {
300 case V4L2_TUNER_MODE_STEREO: 312 case V4L2_TUNER_MODE_STEREO:
301 case V4L2_TUNER_MODE_LANG1_LANG2: 313 case V4L2_TUNER_MODE_LANG1_LANG2:
302 src |= 0x0020; 314 src |= 0x0020;
@@ -314,10 +326,6 @@ static void msp3400c_set_audmode(struct i2c_client *client)
314 src = 0x0030; 326 src = 0x0030;
315 break; 327 break;
316 case V4L2_TUNER_MODE_LANG1: 328 case V4L2_TUNER_MODE_LANG1:
317 /* switch to stereo for stereo transmission, otherwise
318 keep first language */
319 if (state->rxsubchans & V4L2_TUNER_SUB_STEREO)
320 src |= 0x0020;
321 break; 329 break;
322 case V4L2_TUNER_MODE_LANG2: 330 case V4L2_TUNER_MODE_LANG2:
323 src |= 0x0010; 331 src |= 0x0010;
@@ -612,9 +620,9 @@ int msp3400c_thread(void *data)
612 if (msp_sleep(state, 1000)) 620 if (msp_sleep(state, 1000))
613 goto restart; 621 goto restart;
614 while (state->watch_stereo) { 622 while (state->watch_stereo) {
623 watch_stereo(client);
615 if (msp_sleep(state, 5000)) 624 if (msp_sleep(state, 5000))
616 goto restart; 625 goto restart;
617 watch_stereo(client);
618 } 626 }
619 } 627 }
620 v4l_dbg(1, msp_debug, client, "thread: exit\n"); 628 v4l_dbg(1, msp_debug, client, "thread: exit\n");