Re: saa7134 FM radio problems (solved)

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

 



Final version of patch for SAA713X based cards and analog audio problems, It was tested on 3 different systems with 2 or 3 cards and It works without problems. I tested this patch only with FM radio, not with Analog TV audio.

Part of patch for tuner-core.c is only hack, there is maybe another problem with frequency range, but this works without any problems.

Based on manual for SAA713X, DSP access error has to be reseted manualy in driver.

Mirek Slugen

Mirek Slugeň napsal(a):
Hi, Is my problem with saa7134 and FM radio related to this
mailing-list? If not, can someone point me to correct mailing-list?

I have two LifeView FlyDVB-T trio PCI cards, and I have some serious
problems with FM radio tuner.

I am using kernel 2.6.21.3 SMP, but same problem is with kernel 2.6.20.X
and even with latest CVS tree from linux.tv (17.6.2007)

Sometimes (very often) one or both cards are just frozen, I can't tune
radio (hear nothing).

After restart, situation sometimes change.

 From log:

+ I am getting many dsp acces error on problematic card:
saa7133[0]: dsp access error
saa7133[0]: dsp access error
saa7133[0]: dsp access error
saa7133[0]: dsp access error
saa7133[0]: dsp access error
saa7133[0]: dsp access error
saa7133[0]: dsp access error

+ Problem is related to this message from dmesg
aa7133[0]/audio: tvaudio thread status: 0x100000 [no standard detected]

If you are developer I can give you full ssh access to this station.

Has someone similar issue, is there any working solution?

I am sending dmes log as attachment...

Mirek Slugen

PS: Sorry for my poor english


diff -Naur v4l-dvb-e57736b60075.old/linux/drivers/media/video/saa7134/saa7134-cards.c v4l-dvb-e57736b60075/linux/drivers/media/video/saa7134/saa7134-cards.c
--- v4l-dvb-e57736b60075.old/linux/drivers/media/video/saa7134/saa7134-cards.c	2008-01-02 16:50:02.000000000 +0100
+++ v4l-dvb-e57736b60075/linux/drivers/media/video/saa7134/saa7134-cards.c	2008-01-07 11:35:11.000000000 +0100
@@ -4624,6 +4624,12 @@
 		saa_andorl(SAA7134_GPIO_GPMODE0 >> 2,   0x8c040007, 0x8c040007);
 		saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x0c0007cd, 0x0c0007cd);
 		break;
+	case SAA7134_BOARD_FLYDVB_TRIO:
+	    saa7134_set_gpio(dev, 21, 0); //21 - 0 (reset-pin fall)
+	    msleep(10);
+	    saa7134_set_gpio(dev, 21, 1); //21 - 1 (reset-pin rise)
+	    msleep(1);
+	    break;
 	}
 	return 0;
 }
diff -Naur v4l-dvb-e57736b60075.old/linux/drivers/media/video/saa7134/saa7134-reg.h v4l-dvb-e57736b60075/linux/drivers/media/video/saa7134/saa7134-reg.h
--- v4l-dvb-e57736b60075.old/linux/drivers/media/video/saa7134/saa7134-reg.h	2008-01-02 16:50:02.000000000 +0100
+++ v4l-dvb-e57736b60075/linux/drivers/media/video/saa7134/saa7134-reg.h	2008-01-07 11:35:11.000000000 +0100
@@ -364,6 +364,7 @@
 #define SAA7135_DSP_RWSTATE_IDA                 (1 << 2)
 #define SAA7135_DSP_RWSTATE_RDB                 (1 << 1)
 #define SAA7135_DSP_RWSTATE_WRR                 (1 << 0)
+#define SAA7135_DSP_WRERR			0x586
 
 /* ------------------------------------------------------------------ */
 /*
diff -Naur v4l-dvb-e57736b60075.old/linux/drivers/media/video/saa7134/saa7134-tvaudio.c v4l-dvb-e57736b60075/linux/drivers/media/video/saa7134/saa7134-tvaudio.c
--- v4l-dvb-e57736b60075.old/linux/drivers/media/video/saa7134/saa7134-tvaudio.c	2008-01-02 16:50:02.000000000 +0100
+++ v4l-dvb-e57736b60075/linux/drivers/media/video/saa7134/saa7134-tvaudio.c	2008-01-07 11:30:47.000000000 +0100
@@ -682,6 +682,16 @@
 #define DSP_RETRY 32
 #define DSP_DELAY 16
 
+static inline int saa_dsp_reset_error_bit(struct saa7134_dev *dev)
+{
+	int state = saa_readb(SAA7135_DSP_RWSTATE);
+	if (unlikely(state & SAA7135_DSP_RWSTATE_ERR)) {
+		d2printk("%s: resetting error bit\n",dev->name);
+		saa_writeb(SAA7135_DSP_WRERR, 0x01);
+	}
+	return 0;
+}
+
 static inline int saa_dsp_wait_bit(struct saa7134_dev *dev, int bit)
 {
 	int state, count = DSP_RETRY;
@@ -689,7 +699,7 @@
 	state = saa_readb(SAA7135_DSP_RWSTATE);
 	if (unlikely(state & SAA7135_DSP_RWSTATE_ERR)) {
 		printk("%s: dsp access error\n",dev->name);
-		/* FIXME: send ack ... */
+		saa_dsp_reset_error_bit(dev);
 		return -EIO;
 	}
 	while (0 == (state & bit)) {
@@ -731,7 +741,8 @@
 int saa_dsp_writel(struct saa7134_dev *dev, int reg, u32 value)
 {
 	int err;
-
+	
+	saa_dsp_reset_error_bit(dev);
 	d2printk("dsp write reg 0x%x = 0x%06x\n",reg<<2,value);
 	err = saa_dsp_wait_bit(dev,SAA7135_DSP_RWSTATE_WRR);
 	if (err < 0)
diff -Naur v4l-dvb-e57736b60075.old/linux/drivers/media/video/tuner-core.c v4l-dvb-e57736b60075/linux/drivers/media/video/tuner-core.c
--- v4l-dvb-e57736b60075.old/linux/drivers/media/video/tuner-core.c	2008-01-02 16:50:02.000000000 +0100
+++ v4l-dvb-e57736b60075/linux/drivers/media/video/tuner-core.c	2008-01-07 11:35:11.000000000 +0100
@@ -278,7 +278,7 @@
 	}
 	if (analog_ops->set_params) {
 		tuner_warn ("tuner has no way to set radio frequency\n");
-		return;
+//		return;
 	}
 	if (freq < radio_range[0] * 16000 || freq > radio_range[1] * 16000) {
 		tuner_dbg ("radio freq (%d.%02d) out of range (%d-%d)\n",
@@ -286,10 +286,11 @@
 			   radio_range[0], radio_range[1]);
 		/* V4L2 spec: if the freq is not possible then the closest
 		   possible value should be selected */
-		if (freq < radio_range[0] * 16000)
+/*		if (freq < radio_range[0] * 16000)
 			freq = radio_range[0] * 16000;
 		else
 			freq = radio_range[1] * 16000;
+*/
 	}
 	params.frequency = freq;
 
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux