diff options
author | Steven Toth <stoth@kernellabs.com> | 2009-08-12 12:14:37 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-09-19 00:15:08 -0300 |
commit | 39e469ab6dee0977a6fb632c711fba1ec5fca401 (patch) | |
tree | 5b68506d3b860fcff958fe865a4b51c068a39df3 /drivers/media/video/saa7164/saa7164-cmd.c | |
parent | 068ed40b8fc14cd3d16b5cf2db59ecd735a68ca8 (diff) |
V4L/DVB (12940): SAA7164: IRQ / message timeout related change
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.
Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/saa7164/saa7164-cmd.c')
-rw-r--r-- | drivers/media/video/saa7164/saa7164-cmd.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/media/video/saa7164/saa7164-cmd.c b/drivers/media/video/saa7164/saa7164-cmd.c index cd3af4d4364..e097f1a0969 100644 --- a/drivers/media/video/saa7164/saa7164-cmd.c +++ b/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; |