By Date: <-- -->
By Thread: <-- -->

bttv msp3400 2.6.15.6 - > 2.6.16 stereo stop working



On Wednesday 29 March 2006 04:00, Roland Scheidegger wrote:
> Hans Verkuil wrote:
> > Please apply the attached patch to msp3400-kthreads.c and let me
> > know if this fixes the problems.
>
> I've tried that patch and it doesn't help. I think the chip gets
> misprogrammed somewhere, the stereo detect reg always hovers around 0
> even after a long time (nowhere near that 4096 it needs to be for
> stereo).
>
>  >> 3) when pres enter(xawtv)  sound mute but when increase  volume
>  >> or switch channel some glitches are present.
>  >
>  > It's not likely that that will be solved. It's not present with
>  > msp3400d and newer versions. It may be a limitation of the
>  > msp3400c.
>
> Sorry, but this is a lame excuse at best :-) (Not that I'd accuse
> anyone of not fixing it, I understand it may not exactly be the most
> important thing...)
> One reason (there may be more) is that the chip simply is never muted
> when it does its am/fm scan (which takes a while). xawtv (and
> probably other progs) will mute sound, then switch channel, then
> unmute. Now, what happens is that xawtv mutes (which causes a restart
> scan but it doesn't really matter) and audio is muted. Then, channel
> is switched, which will cause the next restart scan (and audio is
> still muted). Then, xawtv unmutes, so audio gets unmuted, even though
> the msp3400 is still trying to find the carriers (and I think this
> causes another restart scan). I'm not exactly sure what happens next,
> but I see another restart_scan which mutes again, until finally audio
> gets unmuted for the last time. No wonder there's a lot of popping
> noise...
> Other things are wrong too. For instance that muting audio causes a
> full restart scan is just evil (and no wonder the popping noises are
> back with that).
> There is a fast_mute value too which could be used instead of setting
> volume to 0, which might prevent some popping noises, though I don't
> think it is needed (it certainly won't help with the fact that the
> chip simply is not muted while searching for the carriers). The 3410d
> may be way faster with detection so it doesn't have the problem that
> sound gets unmuted when it's still busy with detection, or it may
> just mute its output anyway when doing autodetection, so I'm not
> surprised there is no problem there.

Please try attached patch. I've added code to prevent unnecessary 
audmode changes and change the msp3400c thread to use the same muting 
mechanism as the msp3400d thread.

Note: you may want to get the latest v4l-dvb sources as my previous 
fixes have already been included.

Thanks,

	Hans
diff -r b3909aedea9e linux/drivers/media/video/msp3400-driver.c
--- a/linux/drivers/media/video/msp3400-driver.c	Wed Mar 29 23:02:51 2006 +0200
+++ b/linux/drivers/media/video/msp3400-driver.c	Wed Mar 29 23:53:52 2006 +0200
 (at)  (at)  -302,19 +302,6  (at)  (at)  void msp_set_scart(struct i2c_client *cl
 		msp_write_dem(client, 0x40, state->i2s_mode);
 }
 
-void msp_set_mute(struct i2c_client *client)
-{
-	struct msp_state *state = i2c_get_clientdata(client);
-
-	v4l_dbg(1, msp_debug, client, "mute audio\n");
-	msp_write_dsp(client, 0x0000, 0);
-	msp_write_dsp(client, 0x0007, 1);
-	if (state->has_scart2_out_volume)
-		msp_write_dsp(client, 0x0040, 1);
-	if (state->has_headphones)
-		msp_write_dsp(client, 0x0006, 0);
-}
-
 void msp_set_audio(struct i2c_client *client)
 {
 	struct msp_state *state = i2c_get_clientdata(client);
 (at)  (at)  -383,7 +370,6  (at)  (at)  static void msp_wake_thread(struct i2c_c
 
 	if (NULL == state->kthread)
 		return;
-	msp_set_mute(client);
 	state->watch_stereo = 0;
 	state->restart = 1;
 	wake_up_interruptible(&state->wq);
 (at)  (at)  -673,7 +659,8  (at)  (at)  static int msp_command(struct i2c_client
 		state->treble = va->treble;
 		msp_set_audio(client);
 
-		if (va->mode != 0 && state->radio == 0) {
+		if (va->mode != 0 && state->radio == 0 &&
+		    state->audmode != msp_mode_v4l1_to_v4l2(va->mode)) {
 			state->audmode = msp_mode_v4l1_to_v4l2(va->mode);
 			msp_set_audmode(client);
 		}
 (at)  (at)  -778,6 +765,8  (at)  (at)  static int msp_command(struct i2c_client
 		struct v4l2_tuner *vt = (struct v4l2_tuner *)arg;
 
 		if (state->radio)  /* TODO: add mono/stereo support for radio */
+			break;
+		if (state->audmode == vt->audmode)
 			break;
 		state->audmode = vt->audmode;
 		/* only set audmode */
diff -r b3909aedea9e linux/drivers/media/video/msp3400-driver.h
--- a/linux/drivers/media/video/msp3400-driver.h	Wed Mar 29 23:02:51 2006 +0200
+++ b/linux/drivers/media/video/msp3400-driver.h	Wed Mar 29 23:53:52 2006 +0200
 (at)  (at)  -103,7 +103,6  (at)  (at)  int msp_read_dsp(struct i2c_client *clie
 int msp_read_dsp(struct i2c_client *client, int addr);
 int msp_reset(struct i2c_client *client);
 void msp_set_scart(struct i2c_client *client, int in, int out);
-void msp_set_mute(struct i2c_client *client);
 void msp_set_audio(struct i2c_client *client);
 int msp_sleep(struct msp_state *state, int timeout);
 
diff -r b3909aedea9e linux/drivers/media/video/msp3400-kthreads.c
--- a/linux/drivers/media/video/msp3400-kthreads.c	Wed Mar 29 23:02:51 2006 +0200
+++ b/linux/drivers/media/video/msp3400-kthreads.c	Wed Mar 29 23:53:52 2006 +0200
 (at)  (at)  -488,9 +488,10  (at)  (at)  int msp3400c_thread(void *data)
 			msp_set_audio(client);
 			continue;
 		}
-
-		/* mute */
-		msp_set_mute(client);
+		
+		/* put into sane state (and mute) */
+		msp_reset(client);
+
 		msp3400c_set_mode(client, MSP_MODE_AM_DETECT);
 		val1 = val2 = 0;
 		max1 = max2 = -1;
 (at)  (at)  -621,8 +622,10  (at)  (at)  int msp3400c_thread(void *data)
 			break;
 		}
 
-		/* unmute */
+		/* unmute, restore misc registers */
 		msp_set_audio(client);
+
+		msp_write_dsp(client, 0x13, state->acb);
 		msp3400c_set_audmode(client);
 
 		if (msp_debug)
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request (at) redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list