public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereo detection
@ 2008-03-26  2:07 Marton Balint
  2008-03-26  2:07 ` [PATCH 1 of 3] cx88: fix oops on module removal caused by IR worker Marton Balint
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Marton Balint @ 2008-03-26  2:07 UTC (permalink / raw)
  To: video4linux-list

Here are the updated versions of my cx88 patches (I only sent the old versions
to the linux-dvb list, and they did not draw too much attention there) maybe
better luck here...

The first is a simple fix for a possible Oops on the removal of cx88xx module
caused by the IR worker. This patch is independent from the other two.

The second and the third patches are enhachments of the cx88 audio code, I
tried to implement the detection of stereo TV channels for A2 mode. I had no
idea how to detect it, and falling back to EN_A2_AUTO_STEREO instead of
EN_A2_FORCE_MONO1 did not help either. (The card changed the audio mode
periodically on both mono and stereo channels) Forcing STEREO mode also did not
help, because it resulted a loud static noise on mono tv channels.

Testing proved that AUD_NICAM_STATUS1 and AUD_NICAM_STATUS2 registers change
randomly if and only if the second audio channel is missing, so if these
registers are constant (Usually 0x0000 and 0x01), we can assume that the tv
channel has two audio channels, so we can use STEREO mode. This method seems a
bit ugly, but nicam detection works the same way, so to avoid further
msleep()-ing, the A2 stereo detection code is in the nicam detection function.

By the way, the audio thread in the cx88 code is totally useless, in fact, it
occaisonally sets the audio to MONO after starting a TV application, so i think
it should be removed. My patch does NOT fix cx88_get_stereo, and even if it
would, the audio thread would not work as expected, because
core->audiomode_current is not set in cx88_set_tvaudio, and AUTO stereo modes
(EN_BTSC_AUTO_STEREO, EN_NICAM_AUTO_STEREO) would also cause problems, the
autodetected audio mode should be set to core->audiomode_current to make it
work.

Who is now the cx88 maintainer? I should send him a copy of the patches...


Regards,

 Marton Balint


--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1 of 3] cx88: fix oops on module removal caused by IR worker
  2008-03-26  2:07 [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereo detection Marton Balint
@ 2008-03-26  2:07 ` Marton Balint
  2008-03-28 18:38   ` Mauro Carvalho Chehab
  2008-03-26  2:07 ` [PATCH 2 of 3] cx88: fix stereo dematrix for A2 sound system Marton Balint
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Marton Balint @ 2008-03-26  2:07 UTC (permalink / raw)
  To: video4linux-list

# HG changeset patch
# User Marton Balint <cus@fazekas.hu>
# Date 1206487800 -3600
# Node ID 54d0fc010ab0225fbed97df3267d26e91aa03a2a
# Parent  cc6c65fe4ce0543e14afdd2b850c991081f7b9ac
cx88: fix oops on module removal caused by IR worker

From: Marton Balint <cus@fazekas.hu>

If the IR worker is not stopped before the removal of the cx88xx module,
an OOPS may occur, because the worker function cx88_ir_work gets called.
So stop the ir worker.


Signed-off-by: Marton Balint <cus@fazekas.hu>

diff -r cc6c65fe4ce0 -r 54d0fc010ab0 linux/drivers/media/video/cx88/cx88-video.c
--- a/linux/drivers/media/video/cx88/cx88-video.c	Tue Mar 25 14:33:20 2008 -0300
+++ b/linux/drivers/media/video/cx88/cx88-video.c	Wed Mar 26 00:30:00 2008 +0100
@@ -2221,6 +2221,9 @@ static void __devexit cx8800_finidev(str
 		core->kthread = NULL;
 	}
 
+	if (core->ir)
+		cx88_ir_stop(core, core->ir);
+
 	cx88_shutdown(core); /* FIXME */
 	pci_disable_device(pci_dev);
 


--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 2 of 3] cx88: fix stereo dematrix for A2 sound system
  2008-03-26  2:07 [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereo detection Marton Balint
  2008-03-26  2:07 ` [PATCH 1 of 3] cx88: fix oops on module removal caused by IR worker Marton Balint
@ 2008-03-26  2:07 ` Marton Balint
  2008-03-26  2:07 ` [PATCH 3 of 3] cx88: detect stereo output instead of mono fallback in " Marton Balint
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Marton Balint @ 2008-03-26  2:07 UTC (permalink / raw)
  To: video4linux-list

# HG changeset patch
# User Marton Balint <cus@fazekas.hu>
# Date 1206488442 -3600
# Node ID 2c020dc87db5511e6cbaae05389e3bda225d4879
# Parent  54d0fc010ab0225fbed97df3267d26e91aa03a2a
cx88: fix stereo dematrix for A2 sound system

From: Marton Balint <cus@fazekas.hu>

Using A2 sound system, in stereo mode, the first sound channel is L+R, the
second channel is 2*R. So the dematrix control should be SUMR instead of
SUMDIFF. Let's use SUMR for stereo mode, and use SUMDIFF for everything
else, just like before.

Signed-off-by: Marton Balint <cus@fazekas.hu>

diff -r 54d0fc010ab0 -r 2c020dc87db5 linux/drivers/media/video/cx88/cx88-tvaudio.c
--- a/linux/drivers/media/video/cx88/cx88-tvaudio.c	Wed Mar 26 00:30:00 2008 +0100
+++ b/linux/drivers/media/video/cx88/cx88-tvaudio.c	Wed Mar 26 00:40:42 2008 +0100
@@ -632,7 +632,12 @@ static void set_audio_standard_A2(struct
 		break;
 	};
 
-	mode |= EN_FMRADIO_EN_RDS | EN_DMTRX_SUMDIFF;
+	mode |= EN_FMRADIO_EN_RDS;
+	if ((mode & 0x3f) == EN_A2_FORCE_STEREO)
+		mode |= EN_DMTRX_SUMR;
+	else
+		mode |= EN_DMTRX_SUMDIFF;
+
 	set_audio_finish(core, mode);
 }
 


--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 3 of 3] cx88: detect stereo output instead of mono fallback in A2 sound system
  2008-03-26  2:07 [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereo detection Marton Balint
  2008-03-26  2:07 ` [PATCH 1 of 3] cx88: fix oops on module removal caused by IR worker Marton Balint
  2008-03-26  2:07 ` [PATCH 2 of 3] cx88: fix stereo dematrix for A2 sound system Marton Balint
@ 2008-03-26  2:07 ` Marton Balint
  2008-03-26  7:02 ` [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereo detection Peter Vágner
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Marton Balint @ 2008-03-26  2:07 UTC (permalink / raw)
  To: video4linux-list

# HG changeset patch
# User Marton Balint <cus@fazekas.hu>
# Date 1206489018 -3600
# Node ID 1fabe9b19f0c356704aad5bbb0ce045ff3e05947
# Parent  2c020dc87db5511e6cbaae05389e3bda225d4879
cx88: detect stereo output instead of mono fallback in A2 sound system

From: Marton Balint <cus@fazekas.hu>

Testing proved that AUD_NICAM_STATUS1 and AUD_NICAM_STATUS2 registers
change randomly if and only if the second audio channel is missing, so if
these registers are constant (Usually 0x0000 and 0x01), we can assume that
the tv channel has two audio channels, so we can use STEREO mode. This
method seems a bit ugly, but nicam detection works the same way. And
now stereo channel detection also works for me.

Since my cable TV provider only broadcasts in PAL BG mode with A2 sound
system, i couldn't test other systems, but they should work just like
before.


Signed-off-by: Marton Balint <cus@fazekas.hu>

diff -r 2c020dc87db5 -r 1fabe9b19f0c linux/drivers/media/video/cx88/cx88-tvaudio.c
--- a/linux/drivers/media/video/cx88/cx88-tvaudio.c	Wed Mar 26 00:40:42 2008 +0100
+++ b/linux/drivers/media/video/cx88/cx88-tvaudio.c	Wed Mar 26 00:50:18 2008 +0100
@@ -725,31 +725,47 @@ static void set_audio_standard_FM(struct
 
 /* ----------------------------------------------------------- */
 
-static int cx88_detect_nicam(struct cx88_core *core)
-{
-	int i, j = 0;
+static int cx88_detect_nicam_or_stereo(struct cx88_core *core)
+{
+	int i, stereo = 0;
+	u32 status1, status2;
+	u32 last_status1, last_status2;
 
 	dprintk("start nicam autodetect.\n");
-
-	for (i = 0; i < 6; i++) {
+	last_status1 = cx_read(AUD_NICAM_STATUS1);
+	last_status2 = cx_read(AUD_NICAM_STATUS2);
+
+	/* wait here max 50 ms or if stereo is ambigous then max 70 ms */
+	for (i = 0; i < 5 || (stereo > 0 && stereo < 3 && i < 7); i++) {
+		/* wait a little bit for next reading status */
+		msleep(10);
+
+		status1 = cx_read(AUD_NICAM_STATUS1);
+		status2 = cx_read(AUD_NICAM_STATUS2);
+
 		/* if bit1=1 then nicam is detected */
-		j += ((cx_read(AUD_NICAM_STATUS2) & 0x02) >> 1);
-
-		if (j == 1) {
+		if (status2 & 0x02) {
 			dprintk("nicam is detected.\n");
 			return 1;
 		}
 
-		/* wait a little bit for next reading status */
-		msleep(10);
-	}
-
+		if (last_status1 == status1 && last_status2 == status2)
+			stereo++;
+		else
+			stereo = 0;
+		last_status1 = status1;
+		last_status2 = status2;
+	}
+
+	dprintk("stereo detection result: %d\n", stereo);
 	dprintk("nicam is not detected.\n");
-	return 0;
+	return stereo >= 3 ? 2 : 0;
 }
 
 void cx88_set_tvaudio(struct cx88_core *core)
 {
+	int nicam_or_stereo;
+
 	switch (core->tvaudio) {
 	case WW_BTSC:
 		set_audio_standard_BTSC(core, 0, EN_BTSC_AUTO_STEREO);
@@ -764,12 +780,13 @@ void cx88_set_tvaudio(struct cx88_core *
 		/* set nicam mode - otherwise
 		   AUD_NICAM_STATUS2 contains wrong values */
 		set_audio_standard_NICAM(core, EN_NICAM_AUTO_STEREO);
-		if (0 == cx88_detect_nicam(core)) {
-			/* fall back to fm / am mono */
-			set_audio_standard_A2(core, EN_A2_FORCE_MONO1);
+		nicam_or_stereo = cx88_detect_nicam_or_stereo(core);
+		if (nicam_or_stereo == 1) {
+			core->use_nicam = 1;
+		} else {
+			/* fall back to fm / am stereo or mono */
+			set_audio_standard_A2(core, nicam_or_stereo == 2 ? EN_A2_FORCE_STEREO : EN_A2_FORCE_MONO1);
 			core->use_nicam = 0;
-		} else {
-			core->use_nicam = 1;
 		}
 		break;
 	case WW_EIAJ:


--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereo detection
  2008-03-26  2:07 [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereo detection Marton Balint
                   ` (2 preceding siblings ...)
  2008-03-26  2:07 ` [PATCH 3 of 3] cx88: detect stereo output instead of mono fallback in " Marton Balint
@ 2008-03-26  7:02 ` Peter Vágner
  2008-03-26 14:40   ` Balint Marton
  2008-03-26 20:39 ` [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereodetection Torsten Seeboth
  2008-04-17 21:35 ` [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereo detection Marton Balint
  5 siblings, 1 reply; 13+ messages in thread
From: Peter Vágner @ 2008-03-26  7:02 UTC (permalink / raw)
  To: Marton Balint; +Cc: video4linux-list

Hello there,
I am interested in ability to get stereo channels working with my avertv 
studio 303 which is a cx88 based.
I am not a developer nor I understand this stuff very well but anyway 
I'd like to try this out if it may help. With current v4l builds I am 
getting mono sound each time tv app is started (I am using mplayer btw).

So here are a few questions hopefully it's not a problem to ask them here:
1) are these patches already included in some repository? If not how 
should I go about applying them? Is the diff command the right way? What 
branch are they against?

2) The comments below indicates audio functionality for cx88 is not 
working as it should. So shal I be able to get stereo sound after 
applying these patches?

3) are there any tunner settings required in order to get stereo sound? 
or perhaps settings for some other modules?


Thanks


Peter


Marton Balint  wrote / napísal(a):
> Here are the updated versions of my cx88 patches (I only sent the old versions
> to the linux-dvb list, and they did not draw too much attention there) maybe
> better luck here...
>
> The first is a simple fix for a possible Oops on the removal of cx88xx module
> caused by the IR worker. This patch is independent from the other two.
>
> The second and the third patches are enhachments of the cx88 audio code, I
> tried to implement the detection of stereo TV channels for A2 mode. I had no
> idea how to detect it, and falling back to EN_A2_AUTO_STEREO instead of
> EN_A2_FORCE_MONO1 did not help either. (The card changed the audio mode
> periodically on both mono and stereo channels) Forcing STEREO mode also did not
> help, because it resulted a loud static noise on mono tv channels.
>
> Testing proved that AUD_NICAM_STATUS1 and AUD_NICAM_STATUS2 registers change
> randomly if and only if the second audio channel is missing, so if these
> registers are constant (Usually 0x0000 and 0x01), we can assume that the tv
> channel has two audio channels, so we can use STEREO mode. This method seems a
> bit ugly, but nicam detection works the same way, so to avoid further
> msleep()-ing, the A2 stereo detection code is in the nicam detection function.
>
> By the way, the audio thread in the cx88 code is totally useless, in fact, it
> occaisonally sets the audio to MONO after starting a TV application, so i think
> it should be removed. My patch does NOT fix cx88_get_stereo, and even if it
> would, the audio thread would not work as expected, because
> core->audiomode_current is not set in cx88_set_tvaudio, and AUTO stereo modes
> (EN_BTSC_AUTO_STEREO, EN_NICAM_AUTO_STEREO) would also cause problems, the
> autodetected audio mode should be set to core->audiomode_current to make it
> work.
>
> Who is now the cx88 maintainer? I should send him a copy of the patches...
>
>
> Regards,
>
>   Marton Balint
>
>
> --
> video4linux-list mailing list
> Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/video4linux-list

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereo detection
  2008-03-26  7:02 ` [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereo detection Peter Vágner
@ 2008-03-26 14:40   ` Balint Marton
  2008-03-26 17:39     ` Peter Vágner
  0 siblings, 1 reply; 13+ messages in thread
From: Balint Marton @ 2008-03-26 14:40 UTC (permalink / raw)
  To: Peter Vágner; +Cc: video4linux-list

[-- Attachment #1: Type: TEXT/PLAIN, Size: 939 bytes --]

On Wed, 26 Mar 2008, Peter Vágner wrote:
> 1) are these patches already included in some repository? If not how should I
> go about applying them? Is the diff command the right way? What branch are
> they against?
The patches are not inculded in any public repository. You can apply them 
using the patch command. The patches are against the current v4l-dvb tree: 
http://linuxtv.org/hg/v4l-dvb

> 2) The comments below indicates audio functionality for cx88 is not working as
> it should. So shal I be able to get stereo sound after applying these patches?
Yes. Maybe the first tv channel after you start mplayer will be mono 
(because of the buggy audio thread), but after you change the channel, auto 
detection should work.

> 3) are there any tunner settings required in order to get stereo sound? or
> perhaps settings for some other modules?
No.

> Thanks
You are welcome! Happy testing! :)

Regards, 
  Marton

[-- Attachment #2: Type: text/plain, Size: 164 bytes --]

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereo detection
  2008-03-26 14:40   ` Balint Marton
@ 2008-03-26 17:39     ` Peter Vágner
  2008-03-26 19:40       ` Balint Marton
  0 siblings, 1 reply; 13+ messages in thread
From: Peter Vágner @ 2008-03-26 17:39 UTC (permalink / raw)
  To: Balint Marton; +Cc: video4linux-list

Hello,
On St, 2008-03-26 at 15:40 +0100, Balint Marton wrote:
> Yes. Maybe the first tv channel after you start mplayer will be mono 
> (because of the buggy audio thread), but after you change the channel, auto 
> detection should work.
> 
Thanks a lot. I am very happy this works at least partially. I see there
will be problems while recording because when starting mencoder in the
scheduler I won't be able to switch channels to detect the stereo
reliably. I am just wondering might there be a way to fix also this
issue? Sometimes it works even at startup of the player but more
frequently it does not.

thanks once again

Peter

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereo detection
  2008-03-26 17:39     ` Peter Vágner
@ 2008-03-26 19:40       ` Balint Marton
  2008-03-28  6:59         ` Peter Vágner
  0 siblings, 1 reply; 13+ messages in thread
From: Balint Marton @ 2008-03-26 19:40 UTC (permalink / raw)
  To: Peter Vágner; +Cc: video4linux-list

[-- Attachment #1: Type: TEXT/PLAIN, Size: 236 bytes --]

> I am just wondering might there be a way to fix also this
> issue? Sometimes it works even at startup of the player but more
> frequently it does not.
Try the attached patch. It disables the audio thread completely.

Regards,
  Marton

[-- Attachment #2: Type: TEXT/X-PATCH, Size: 631 bytes --]

diff -r 1fabe9b19f0c linux/drivers/media/video/cx88/cx88-video.c
--- a/linux/drivers/media/video/cx88/cx88-video.c	Wed Mar 26 00:50:18 2008 +0100
+++ b/linux/drivers/media/video/cx88/cx88-video.c	Wed Mar 26 20:29:52 2008 +0100
@@ -2181,6 +2181,7 @@ static int __devinit cx8800_initdev(stru
 	cx88_video_mux(core,0);
 	mutex_unlock(&core->lock);
 
+#if 0
 	/* start tvaudio thread */
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 	if (core->board.tuner_type != TUNER_ABSENT) {
@@ -2198,6 +2199,7 @@ static int __devinit cx8800_initdev(stru
 
 	core->kthread = NULL;
 #endif
+#endif
 	return 0;
 
 fail_unreg:

[-- Attachment #3: Type: text/plain, Size: 164 bytes --]

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereodetection
  2008-03-26  2:07 [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereo detection Marton Balint
                   ` (3 preceding siblings ...)
  2008-03-26  7:02 ` [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereo detection Peter Vágner
@ 2008-03-26 20:39 ` Torsten Seeboth
  2008-03-26 22:25   ` Balint Marton
  2008-04-17 21:35 ` [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereo detection Marton Balint
  5 siblings, 1 reply; 13+ messages in thread
From: Torsten Seeboth @ 2008-03-26 20:39 UTC (permalink / raw)
  To: Marton Balint; +Cc: video4linux-list

> The second and the third patches are enhachments of the cx88 audio code, I
> tried to implement the detection of stereo TV channels for A2 mode. I had
> no idea how to detect it, and falling back to EN_A2_AUTO_STEREO instead of
> EN_A2_FORCE_MONO1 did not help either. (The card changed the audio mode
> periodically on both mono and stereo channels) Forcing STEREO mode also
> did not help, because it resulted a loud static noise on mono tv channels.

It's a bug of the audio dsp part.

> Testing proved that AUD_NICAM_STATUS1 and AUD_NICAM_STATUS2 registers
> change randomly if and only if the second audio channel is missing, so if
> these registers are constant (Usually 0x0000 and 0x01), we can assume that
> the
> tv channel has two audio channels, so we can use STEREO mode. This method
> seems a bit ugly, but nicam detection works the same way, so to avoid
> further msleep()-ing, the A2 stereo detection code is in the nicam
> detection
> function.

No, the Nicam_Status_Regs contain only and only if Nicam is forced before.
Your patch _can_ work for B/G, but I don't think so for others, like D/K
etc.

> By the way, the audio thread in the cx88 code is totally useless, in fact,
> it occaisonally sets the audio to MONO after starting a TV application, so
> i think it should be removed. My patch does NOT fix cx88_get_stereo, and
> even if it would, the audio thread would not work as expected, because
> core->audiomode_current is not set in cx88_set_tvaudio, and AUTO stereo
> modes (EN_BTSC_AUTO_STEREO, EN_NICAM_AUTO_STEREO) would also cause
> problems, the autodetected audio mode should be set to
> core->audiomode_current
> to make it work.

Sorry, not an native english speaker here.

If it were easy it would already be done. ;)

I am the one who did that in cx88-tvaudio.c. With Mauro's and many others
help I have moved this part from DScaler project where I am from into this
file.

Still not finished as you can see in comments. There is much more to do if
you want to get safe mono/stereo or a2/nicam/btsc detection.

I did many things trying to understand on how audio things are going on on
this chip. Together witht some others from this list I have learned from m$
driver how it really works by using de-asm/debuggers tools. To make a long
story short: The only way is to take some audio samples into memory, compare
it to tables and do some calculations depands on video-mode.

Torsten

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereodetection
  2008-03-26 20:39 ` [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereodetection Torsten Seeboth
@ 2008-03-26 22:25   ` Balint Marton
  0 siblings, 0 replies; 13+ messages in thread
From: Balint Marton @ 2008-03-26 22:25 UTC (permalink / raw)
  To: Torsten Seeboth; +Cc: video4linux-list

> No, the Nicam_Status_Regs contain only and only if Nicam is forced before.
> Your patch _can_ work for B/G, but I don't think so for others, like D/K
> etc.
It works for me on B/G. Unfortunately i can't test the others, because my 
cable tv provider only uses B/G. Anyway, if it really doesn't work on 
other sound systems, we can use the mono fallback there, like before, and 
use the stereo detection based on Nicam_Status regs only for B/G mode.

> Still not finished as you can see in comments. There is much more to do if
> you want to get safe mono/stereo or a2/nicam/btsc detection.
> 
> I did many things trying to understand on how audio things are going on on
> this chip. Together witht some others from this list I have learned from m$
> driver how it really works by using de-asm/debuggers tools. To make a long
> story short: The only way is to take some audio samples into memory, compare
> it to tables and do some calculations depands on video-mode.

I don't see much chance anyone will ever going to do it. On top of 
that, taking audio samples is not easy, if the tuner card is connected to 
a sound card input... Considering what you said, detecting the audio mode 
properly in the audio thread seems impossible to me. So I still think the 
audio thread should be removed, unless someone came up with a better idea.

Regards,
   Marton

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereo detection
  2008-03-26 19:40       ` Balint Marton
@ 2008-03-28  6:59         ` Peter Vágner
  0 siblings, 0 replies; 13+ messages in thread
From: Peter Vágner @ 2008-03-28  6:59 UTC (permalink / raw)
  To: Balint Marton; +Cc: video4linux-list

Hello,

Balint Marton  wrote / napísal(a):
> Try the attached patch. It disables the audio thread completely.
>


Thanks now this is wonderfull for recording.

Based on some comments posted to this list I have tryed to let the tv 
runing for a few hours and I am getting no unusual behaviour nor 
distorted sound. Here in slovakia all the channels I can tune to are 
also pal-BG. Literally I can tune no mono channels here. Their are 
either broadcasting stereo, or dual (2 independent language track per 
audio channel) or they are sending the same mono track to each channel 
So I am really not woried about the mono audio. The only thing which is 
not very confortable is stereo versus dual audio detection. If it's 
forced to stereo, I am getting both the audio tracks when it changes 
during a viewing session. Ideally it would be nice to be able to switch 
this on the fly. Or perhaps mplayer has some filter where I can 
temporarily enable left or right channel only based off my actual 
preference. I have to look into this further.
I am saying it's fine for the recording because in that case both 
language tracks are great if stereo is not broadcasted. It can be 
processed later.

thanks much again Now I think I can get more from this card using v4l 
than I was used to do under windows. E.G. channel switching is almost 
instantaneous.


Peter

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1 of 3] cx88: fix oops on module removal caused by IR worker
  2008-03-26  2:07 ` [PATCH 1 of 3] cx88: fix oops on module removal caused by IR worker Marton Balint
@ 2008-03-28 18:38   ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 13+ messages in thread
From: Mauro Carvalho Chehab @ 2008-03-28 18:38 UTC (permalink / raw)
  To: Marton Balint; +Cc: video4linux-list

On Wed, 26 Mar 2008 03:07:35 +0100
Marton Balint <cus@fazekas.hu> wrote:

> # HG changeset patch
> # User Marton Balint <cus@fazekas.hu>
> # Date 1206487800 -3600
> # Node ID 54d0fc010ab0225fbed97df3267d26e91aa03a2a
> # Parent  cc6c65fe4ce0543e14afdd2b850c991081f7b9ac
> cx88: fix oops on module removal caused by IR worker

Applied, thanks.

I'll wait for some conclusions about the other two patches.

Cheers,
Mauro

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereo detection
  2008-03-26  2:07 [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereo detection Marton Balint
                   ` (4 preceding siblings ...)
  2008-03-26 20:39 ` [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereodetection Torsten Seeboth
@ 2008-04-17 21:35 ` Marton Balint
  5 siblings, 0 replies; 13+ messages in thread
From: Marton Balint @ 2008-04-17 21:35 UTC (permalink / raw)
  To: video4linux-list; +Cc: Mauro Carvalho Chehab

Hi!

Mauro, have you come to a decision about patch 2 and patch 3?

Unfotunately I can't test other sound systems than BG, so it is
still unknown if the detection also works on other systems, or not. I 
only confirmed one thing with the help of an old video casette 
recorder: mono DK sound is not misdetected as stereo.

Another question is the audio thread. Like I explained in my original 
post, it does more harm than good, because it occaisonally sets the audio 
to mono after starting a TV application. Altough my patches are not 
dependant on the removal of the thread, I think it should be removed.
What would be the correct way to do that? Delete the relevant lines, or 
just #ifdef them out?

Regards,
  Marton Balint


> Here are the updated versions of my cx88 patches (I only sent the old versions
> to the linux-dvb list, and they did not draw too much attention there) maybe
> better luck here...
> 
> The first is a simple fix for a possible Oops on the removal of cx88xx module
> caused by the IR worker. This patch is independent from the other two.
> 
> The second and the third patches are enhachments of the cx88 audio code, I
> tried to implement the detection of stereo TV channels for A2 mode. I had no
> idea how to detect it, and falling back to EN_A2_AUTO_STEREO instead of
> EN_A2_FORCE_MONO1 did not help either. (The card changed the audio mode
> periodically on both mono and stereo channels) Forcing STEREO mode also did not
> help, because it resulted a loud static noise on mono tv channels.
> 
> Testing proved that AUD_NICAM_STATUS1 and AUD_NICAM_STATUS2 registers change
> randomly if and only if the second audio channel is missing, so if these
> registers are constant (Usually 0x0000 and 0x01), we can assume that the tv
> channel has two audio channels, so we can use STEREO mode. This method seems a
> bit ugly, but nicam detection works the same way, so to avoid further
> msleep()-ing, the A2 stereo detection code is in the nicam detection function.
> 
> By the way, the audio thread in the cx88 code is totally useless, in fact, it
> occaisonally sets the audio to MONO after starting a TV application, so i think
> it should be removed. My patch does NOT fix cx88_get_stereo, and even if it
> would, the audio thread would not work as expected, because
> core->audiomode_current is not set in cx88_set_tvaudio, and AUTO stereo modes
> (EN_BTSC_AUTO_STEREO, EN_NICAM_AUTO_STEREO) would also cause problems, the
> autodetected audio mode should be set to core->audiomode_current to make it
> work.
> 
> Who is now the cx88 maintainer? I should send him a copy of the patches...
> 
> 
> Regards,
> 
>  Marton Balint
> 
> 
> --
> video4linux-list mailing list
> Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/video4linux-list
> 

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2008-04-17 21:36 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-26  2:07 [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereo detection Marton Balint
2008-03-26  2:07 ` [PATCH 1 of 3] cx88: fix oops on module removal caused by IR worker Marton Balint
2008-03-28 18:38   ` Mauro Carvalho Chehab
2008-03-26  2:07 ` [PATCH 2 of 3] cx88: fix stereo dematrix for A2 sound system Marton Balint
2008-03-26  2:07 ` [PATCH 3 of 3] cx88: detect stereo output instead of mono fallback in " Marton Balint
2008-03-26  7:02 ` [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereo detection Peter Vágner
2008-03-26 14:40   ` Balint Marton
2008-03-26 17:39     ` Peter Vágner
2008-03-26 19:40       ` Balint Marton
2008-03-28  6:59         ` Peter Vágner
2008-03-26 20:39 ` [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereodetection Torsten Seeboth
2008-03-26 22:25   ` Balint Marton
2008-04-17 21:35 ` [PATCH 0 of 3] cx88: fix oops on rmmod and implement stereo detection Marton Balint

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox