[wellylug] SAA7134

Ewen McNeill wellylug at ewen.mcneill.gen.nz
Sun May 2 23:17:35 NZST 2004

In message <Pine.LNX.4.21.0404202312030.27171-100000 at wakko.wetstring.net>, David Zanetti writes:
>On Tue, 20 Apr 2004, David Antliff wrote:
>> I don't suppose you have had a problem where changing the channel causes
>> the sound carrier to be lost, resulting in loud static.
>I did have some carrier detection problems with 0.2.8 or so, and hacked
>the code to stop probing the carrier and just use whatever I insmod'd it
>with (since we're always 5.5MHz here). 

I've done some investigation of this, since the static issue was annoying
me (as was the delay for the scan), by insmod'ing with audio_debug=1.
At least for me it seems that the audio carrier scan almost always fails
and falls back to some sort of default (value passed in, value last
detected, or the compile time default (fortunately 5.5 MHz for PAL).
Sometimes the audio carrier scan finds something; it seems about half the
time if finds something it finds 5.5 MHz, and the other half the time it
finds something else (6 MHz or 6.5 MHz).  When it finds something else,
you get static.  If it finds something else, it'll keep using that until
another scan works (unless you've set a scan-failed default).

Since as David Z says, New Zealand is always using 5.5 MHz, all this
scanning and failing and sometimes getting the wrong results and getting
static is rather a waste of time.  So I've hacked my copy of the driver
to always use the audio_carrier parameter value if it is passed in (and
completely skip the scan).  From a little experimentation it appears to
produce quicker audio startup, and reliable results, here.  I've emailed
the patch to the driver author for consideration.

In case anyone's interested, the patch I've sent is enclosed below.
To use, simply apply the patch, recompile the module, and then
insmod/mopdprobe it with audio_carrier=5500.  If you set audio_debug=1
as well, you'll see messages about it skiping the audio scan.


-=- cut here -=-
--- saa7134-tvaudio.c-bkup-2004-05-02	Sun May  2 12:56:52 2004
+++ saa7134-tvaudio.c	Sun May  2 22:53:37 2004
@@ -505,7 +505,19 @@
 		carrier = 0;
-		for (retries = 3; retries > 0 && 0 == carrier; retries--) {
+		/* Patched by Ewen McNeill <ewen at naos.co.nz>, 2004/05/02
+		 * to skip audio scan if audo_carrier is passed in
+		 * (scanning for audio is unreliable).
+		*/
+		if (0 != audio_carrier) {
+			retries = 0;	/* Carrier passed in; skip scan */
+			dprintk("%s/audio: skipping audio scan "
+				"(value set at insmod)\n", dev->name);
+		}
+		else
+			retries = 3;
+		for (; retries > 0 && 0 == carrier; retries--) {
 			for (i = 0; i < MAX_SCAN; i++) {
 				if (!carr_scan[i])
@@ -535,7 +547,7 @@
 		} else if (0 != audio_carrier) {
 			/* no carrier -- try insmod option as fallback */
 			carrier = audio_carrier;
-			printk(KERN_WARNING "%s/audio: audio carrier scan failed, "
+			printk(KERN_WARNING "%s/audio: audio carrier scan skipped, "
 			       "using %d.%03d MHz [insmod option]\n",
 			       dev->name, carrier/1000, carrier%1000);
 		} else if (0 != dev->last_carrier) {
-=- cut here -=-

More information about the wellylug mailing list