Re: SAA7146 glitch on cold boot

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

 



Attached is a patch fixing this problem - can someone try it as well using the 
test procedure in my previous mail? This fixes it for me.

This only fixes budget cards - the problem may affect fullfeatured cards too, 
but I don't have one so cannot test it.
diff -r 0bcf77433dc0 linux/drivers/media/dvb/ttpci/budget-av.c
--- a/linux/drivers/media/dvb/ttpci/budget-av.c	Thu Jun 29 21:30:51 2006 +0200
+++ b/linux/drivers/media/dvb/ttpci/budget-av.c	Fri Jun 30 11:25:37 2006 +0100
@@ -1196,6 +1196,9 @@ static void frontend_init(struct budget_
 			budget_av->budget.dvb_frontend->ops.release(budget_av->budget.dvb_frontend);
 		budget_av->budget.dvb_frontend = NULL;
 	}
+
+	if (budget_av->budget.dvb_frontend)
+		ttpci_install_ts_streaming_workaround(&budget_av->budget);
 }
 
 
diff -r 0bcf77433dc0 linux/drivers/media/dvb/ttpci/budget-ci.c
--- a/linux/drivers/media/dvb/ttpci/budget-ci.c	Thu Jun 29 21:30:51 2006 +0200
+++ b/linux/drivers/media/dvb/ttpci/budget-ci.c	Fri Jun 30 11:25:37 2006 +0100
@@ -1070,6 +1070,9 @@ static void frontend_init(struct budget_
 			budget_ci->budget.dvb_frontend = NULL;
 		}
 	}
+
+	if (budget_ci->budget.dvb_frontend)
+		ttpci_install_ts_streaming_workaround(&budget_ci->budget);
 }
 
 static int budget_ci_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info)
diff -r 0bcf77433dc0 linux/drivers/media/dvb/ttpci/budget-core.c
--- a/linux/drivers/media/dvb/ttpci/budget-core.c	Thu Jun 29 21:30:51 2006 +0200
+++ b/linux/drivers/media/dvb/ttpci/budget-core.c	Fri Jun 30 11:25:37 2006 +0100
@@ -295,6 +295,26 @@ static int budget_stop_feed(struct dvb_d
 	return status;
 }
 
+static int budget_fix_feed(struct dvb_frontend* fe, fe_status_t* status)
+{
+	struct budget* budget = (struct budget*) fe->dvb->priv;
+	int ret = -EINVAL;
+
+	if (budget->read_status_fix)
+		ret = budget->read_status_fix(fe, status);
+
+	if ((ret == 0) && ((*status) & FE_HAS_LOCK)) {
+		spin_lock(&budget->feedlock);
+		stop_ts_capture(budget);
+		start_ts_capture(budget);
+		spin_unlock(&budget->feedlock);
+		printk("budget: Performing SAA7146 ts streaming workaround %p\n", budget);
+		budget->dvb_frontend->ops.read_status = budget->read_status_fix;
+	}
+
+	return ret;
+}
+
 static int budget_register(struct budget *budget)
 {
 	struct dvb_demux *dvbdemux = &budget->demux;
@@ -491,6 +511,14 @@ int ttpci_budget_deinit(struct budget *b
 	return 0;
 }
 
+void ttpci_install_ts_streaming_workaround(struct budget *budget)
+{
+	if (budget->dvb_frontend) {
+		budget->read_status_fix = budget->dvb_frontend->ops.read_status;
+		budget->dvb_frontend->ops.read_status = budget_fix_feed;
+	}
+}
+
 void ttpci_budget_irq10_handler(struct saa7146_dev *dev, u32 * isr)
 {
 	struct budget *budget = (struct budget *) dev->ext_priv;
@@ -523,6 +551,7 @@ EXPORT_SYMBOL_GPL(ttpci_budget_deinit);
 EXPORT_SYMBOL_GPL(ttpci_budget_deinit);
 EXPORT_SYMBOL_GPL(ttpci_budget_irq10_handler);
 EXPORT_SYMBOL_GPL(ttpci_budget_set_video_port);
+EXPORT_SYMBOL_GPL(ttpci_install_ts_streaming_workaround);
 EXPORT_SYMBOL_GPL(budget_debug);
 
 MODULE_LICENSE("GPL");
diff -r 0bcf77433dc0 linux/drivers/media/dvb/ttpci/budget-patch.c
--- a/linux/drivers/media/dvb/ttpci/budget-patch.c	Thu Jun 29 21:30:51 2006 +0200
+++ b/linux/drivers/media/dvb/ttpci/budget-patch.c	Fri Jun 30 11:25:37 2006 +0100
@@ -372,6 +372,9 @@ static void frontend_init(struct budget_
 			budget->dvb_frontend = NULL;
 		}
 	}
+
+	if (budget->dvb_frontend)
+		ttpci_install_ts_streaming_workaround(budget);
 }
 
 /* written by Emard */
diff -r 0bcf77433dc0 linux/drivers/media/dvb/ttpci/budget.c
--- a/linux/drivers/media/dvb/ttpci/budget.c	Thu Jun 29 21:30:51 2006 +0200
+++ b/linux/drivers/media/dvb/ttpci/budget.c	Fri Jun 30 11:25:37 2006 +0100
@@ -441,6 +441,7 @@ static void frontend_init(struct budget 
 		if (dvb_register_frontend(&budget->dvb_adapter, budget->dvb_frontend))
 			goto error_out;
 	}
+	ttpci_install_ts_streaming_workaround(budget);
 	return;
 
 error_out:
diff -r 0bcf77433dc0 linux/drivers/media/dvb/ttpci/budget.h
--- a/linux/drivers/media/dvb/ttpci/budget.h	Thu Jun 29 21:30:51 2006 +0200
+++ b/linux/drivers/media/dvb/ttpci/budget.h	Fri Jun 30 11:25:37 2006 +0100
@@ -86,6 +86,7 @@ struct budget {
 
 	struct dvb_adapter dvb_adapter;
 	struct dvb_frontend *dvb_frontend;
+	int (*read_status_fix)(struct dvb_frontend* fe, fe_status_t* status);
 	void *priv;
 };
 
@@ -126,4 +127,8 @@ extern int ttpci_budget_debiwrite(struct
 extern int ttpci_budget_debiwrite(struct budget *budget, u32 config, int addr, int count, u32 value,
 				  int uselocks, int nobusyloop);
 
+// should be called after the frontend is registered to install the fix
+// for cold-booted-no-TS-data saa7146 workaround.
+extern void ttpci_install_ts_streaming_workaround(struct budget *budget);
+
 #endif
_______________________________________________

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