diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2006-03-29 12:31:44 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-04-02 03:55:48 -0400 |
commit | 7061561e640c2947ab93c4e2a437327657c4482e (patch) | |
tree | 1f5ab8893f8fe4346515993e8059e63ff243a107 /drivers/media | |
parent | dc555aa63c798af097f5c303bcf72a8390b03da5 (diff) |
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>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/msp3400-kthreads.c | 24 |
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"); |