Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

V4L/DVB (3663): Fix msp3400c wait time and better audio mode fallbacks

- The wait time until the first time the audio mode was detected was
1+5=6 seconds instead of just 1 second (wrong statement order).
msp3400c specific bug.
- Implemented audio mode fallback for msp3400c/d just like the msp3400g
does automatically. E.g. fallback to stereo if no second language exists,
etc.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
7061561e dc555aa6

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