Some patches for bttv 0.7.80

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hi Gerd,

These patches supersede the ones I've been sending over the last few
days.  I redid them against 0.7.80:




Patch 1: fixes bug that headphone and i2s outputs aren't switched to scart_in2
when FM radio is detected

diff -Nrau bttv-0.7.80-orig/driver/msp3400.c bttv-0.7.80/driver/msp3400.c
--- bttv-0.7.80-orig/driver/msp3400.c	Fri Sep 14 14:52:29 2001
+++ bttv-0.7.80/driver/msp3400.c	Fri Oct  5 16:08:57 2001
@@ -1166,6 +1166,8 @@
 			/* scart routing */
 			msp3400c_set_scart(client,SCART_IN2,0);
 			msp3400c_write(client,I2C_MSP3400C_DFP, 0x08, 0x0220);
+			msp3400c_write(client,I2C_MSP3400C_DFP, 0x09, 0x0220);
+			msp3400c_write(client,I2C_MSP3400C_DFP, 0x0b, 0x0220);
 			break;
 		case 0x0003:
 			msp->mode   = MSP_MODE_FM_TERRA;

------------------------------------

Patch 2: Implement SNDCTL_DSP_GETISPACE ioctl that is required by mp1e:

diff -Nrau bttv-0.7.80-orig/driver/btaudio.c bttv-0.7.80/driver/btaudio.c
--- bttv-0.7.80-orig/driver/btaudio.c	Fri Sep 14 14:52:29 2001
+++ bttv-0.7.80/driver/btaudio.c	Fri Oct  5 16:16:53 2001
@@ -757,6 +757,25 @@
         case SNDCTL_DSP_SYNC:
 		/* NOP */
 		return 0;
+	case SNDCTL_DSP_GETISPACE:
+	{
+		audio_buf_info info;
+		if (!bta->recording) return -EINVAL;
+		info.fragsize = bta->block_bytes>>bta->sampleshift;
+		info.fragstotal = bta->block_count;
+		info.bytes = bta->read_count;
+		info.fragments = info.bytes / info.fragsize;
+#if 0
+		if (debug) {
+			printk(KERN_DEBUG "Called SNDCTL_DSP_GETISPACE on a btaudio fd!\n");
+			printk(KERN_DEBUG "Returning fragsize=%d, fragstotal=%d bytes=%d fragments=%d\n",
+					info.fragsize, info.fragstotal, info.bytes, info.fragments);
+		}
+#endif
+		if (copy_to_user((void *)arg, &info, sizeof(info)))
+			return -EFAULT;
+		return 0;
+	}
 #if 0 /* TODO */
         case SNDCTL_DSP_GETTRIGGER:
         case SNDCTL_DSP_SETTRIGGER:

------------------------------------

Patch 3: fixes bug that dsp isn't switched to stereo when you were
tuned to a non-NICAM station and setinput to Composite.

To reproduce this bug, v4lctl setstation non-nicam-station, then
v4lctl setinput Composite1.  You will hear that audio is not stereo.

The change also makes the detection thread run whenever input is
flipped to tuner.  This helps fix some issues as you flip between
inputs.  For instance: when you switch from radio mode to Television
(via tuner), the audio source to the dsp is never flipped back from
scart.  Its mainly cosmetic as the tuner is still tuned on fm so
there's no valid tv video or audio anyway.  But this way audio mutes
whereas the other way you hear noise coming from the fm tuner output.


--- bttv-0.7.80/driver/msp3400.c-pre-stereo-fix	Fri Oct  5 16:30:31 2001
+++ bttv-0.7.80/driver/msp3400.c	Fri Oct  5 16:40:46 2001
@@ -514,6 +514,9 @@
 		dprintk("msp3400: BTSC setstereo: %d\n",mode);
 		nicam=0x0300;
 		break;
+	case MSP_MODE_FM_RADIO:
+		dprintk("msp3400: FM-Radio setstereo: %d\n", mode);
+		break;
 	default:
 		dprintk("msp3400: mono setstereo\n");
 		return;
@@ -546,6 +549,7 @@
 	}
 	if (msp->scart)
 		src |= 0x0200;
+	dprintk("msp3400: setstereo final source/matrix = 0x%x\n", src);
 	if (dolby) {
 		msp3400c_write(client,I2C_MSP3400C_DFP, 0x0008,0x0520);
 		msp3400c_write(client,I2C_MSP3400C_DFP, 0x0009,0x0620);
@@ -1380,18 +1384,26 @@
 		msp->scart = 0;
 		switch (*sarg) {
 		case AUDIO_RADIO:
+			msp->stereo = 2;
 			msp3400c_set_scart(client,SCART_IN2,0);
 			msp3400c_write(client,I2C_MSP3400C_DFP,0x000d,0x1900);
 			msp3400c_setstereo(client,msp->stereo);
 			break;
 		case AUDIO_EXTERN:
-			msp->scart = 1;
+			msp->scart = 1;  msp->stereo = 2;
 			msp3400c_set_scart(client,SCART_IN1,0);
 			msp3400c_write(client,I2C_MSP3400C_DFP,0x000d,0x1900);
 			msp3400c_setstereo(client,msp->stereo);
 			break;
 		case AUDIO_TUNER:
 			msp3400c_setstereo(client,msp->stereo);
+			/* SLD: Run the detection thread now to find the audio */
+			msp3400c_setvolume(client,msp->muted,0,0);
+			msp->watch_stereo=0;
+			del_timer(&msp->wake_stereo);
+			if (msp->active)
+				msp->restart = 1;
+			wake_up_interruptible(&msp->wq);
 			break;
 		default:
 			if (*sarg & AUDIO_MUTE)

------------------------------------

Patch 4: Get rid of the pointless (as far as I can tell) SCART_MUTE
that seems to disrupt composite audio.  My system mutes just as well
without it, so I'm not sure what its for...


--- bttv-0.7.80/driver/msp3400.c-pre-mute-fix	Fri Oct  5 16:45:12 2001
+++ bttv-0.7.80/driver/msp3400.c	Fri Oct  5 16:47:16 2001
@@ -1406,8 +1406,12 @@
 			wake_up_interruptible(&msp->wq);
 			break;
 		default:
+#if 0
+/* This code somehow results in composite audio being lost */
+/* Doesn't seem to do any harm to leave it out... */
 			if (*sarg & AUDIO_MUTE)
 				msp3400c_set_scart(client,SCART_MUTE,0);
+#endif
 			break;
 		}
 		if (msp->active)


Regards,
Steve Davies






[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux