summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Toth <stoth@kernellabs.com>2009-08-12 11:14:37 -0400
committerSteven Toth <stoth@kernellabs.com>2009-08-12 11:14:37 -0400
commit905d8e60473a50843e5b7a0ef0198b26a36f798d (patch)
tree164692f258d8ddd9413de246050958a3ebe68333
parent3bd8828857b7afd88d61b5c1082ef06a0993550b (diff)
downloadmediapointer-dvb-s2-905d8e60473a50843e5b7a0ef0198b26a36f798d.tar.gz
mediapointer-dvb-s2-905d8e60473a50843e5b7a0ef0198b26a36f798d.tar.bz2
SAA7164: IRQ / message timeout related change
From: Steven Toth <stoth@kernellabs.com> In some cases we're seeing large timeouts on commands. I'm changing the implementation so that the deferred worker checks the PCI bus for any messages and signals the waiting caller accordingly. The previous mechanism was too unreliable. Priority: normal Signed-off-by: Steven Toth <stoth@kernellabs.com>
-rw-r--r--linux/drivers/media/video/saa7164/saa7164-cmd.c37
-rw-r--r--linux/drivers/media/video/saa7164/saa7164-core.c2
-rw-r--r--linux/drivers/media/video/saa7164/saa7164.h1
3 files changed, 39 insertions, 1 deletions
diff --git a/linux/drivers/media/video/saa7164/saa7164-cmd.c b/linux/drivers/media/video/saa7164/saa7164-cmd.c
index cd3af4d43..e097f1a09 100644
--- a/linux/drivers/media/video/saa7164/saa7164-cmd.c
+++ b/linux/drivers/media/video/saa7164/saa7164-cmd.c
@@ -80,6 +80,43 @@ u32 saa7164_cmd_timeout_get(struct saa7164_dev *dev, u8 seqno)
/* Commands to the f/w get marshelled to/from this code then onto the PCI
* -bus/c running buffer. */
+int saa7164_irq_dequeue(struct saa7164_dev *dev)
+{
+ int ret = SAA_OK;
+ u32 timeout;
+ wait_queue_head_t *q = 0;
+ dprintk(DBGLVL_CMD, "%s()\n", __func__);
+
+ /* While any outstand message on the bus exists... */
+ do {
+
+ /* Peek the msg bus */
+ tmComResInfo_t tRsp = { 0, 0, 0, 0, 0, 0 };
+ ret = saa7164_bus_get(dev, &tRsp, NULL, 1);
+ if (ret != SAA_OK)
+ break;
+
+ q = &dev->cmds[tRsp.seqno].wait;
+ timeout = saa7164_cmd_timeout_get(dev, tRsp.seqno);
+ dprintk(DBGLVL_CMD, "%s() timeout = %d\n", __func__, timeout);
+ if (!timeout) {
+ dprintk(DBGLVL_CMD,
+ "%s() signalled seqno(%d) (for dequeue)\n",
+ __func__, tRsp.seqno);
+ dev->cmds[tRsp.seqno].signalled = 1;
+ wake_up(q);
+ } else {
+ printk(KERN_ERR
+ "%s() found timed out command on the bus\n",
+ __func__);
+ }
+ } while (0);
+
+ return ret;
+}
+
+/* Commands to the f/w get marshelled to/from this code then onto the PCI
+ * -bus/c running buffer. */
int saa7164_cmd_dequeue(struct saa7164_dev *dev)
{
int loop = 1;
diff --git a/linux/drivers/media/video/saa7164/saa7164-core.c b/linux/drivers/media/video/saa7164/saa7164-core.c
index 175213b4c..d26bdfcb7 100644
--- a/linux/drivers/media/video/saa7164/saa7164-core.c
+++ b/linux/drivers/media/video/saa7164/saa7164-core.c
@@ -70,7 +70,7 @@ static void saa7164_work_cmdhandler(struct work_struct *w)
struct saa7164_dev *dev = container_of(w, struct saa7164_dev, workcmd);
/* Wake up any complete commands */
- saa7164_cmd_signal(dev, 0);
+ saa7164_irq_dequeue(dev);
}
static void saa7164_buffer_deliver(struct saa7164_buffer *buf)
diff --git a/linux/drivers/media/video/saa7164/saa7164.h b/linux/drivers/media/video/saa7164/saa7164.h
index 9620b736a..34d36f55e 100644
--- a/linux/drivers/media/video/saa7164/saa7164.h
+++ b/linux/drivers/media/video/saa7164/saa7164.h
@@ -329,6 +329,7 @@ int saa7164_cmd_send(struct saa7164_dev *dev,
u8 id, tmComResCmd_t command, u16 controlselector,
u16 size, void *buf);
void saa7164_cmd_signal(struct saa7164_dev *dev, u8 seqno);
+int saa7164_irq_dequeue(struct saa7164_dev *dev);
/* ----------------------------------------------------------- */
/* saa7164-api.c */