aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Toth <stoth@kernellabs.com>2009-08-12 11:14:37 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-18 23:15:08 -0400
commit39e469ab6dee0977a6fb632c711fba1ec5fca401 (patch)
tree5b68506d3b860fcff958fe865a4b51c068a39df3
parent068ed40b8fc14cd3d16b5cf2db59ecd735a68ca8 (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>
-rw-r--r--drivers/media/video/saa7164/saa7164-cmd.c37
-rw-r--r--drivers/media/video/saa7164/saa7164-core.c2
-rw-r--r--drivers/media/video/saa7164/saa7164.h1
3 files changed, 39 insertions, 1 deletions
diff --git a/drivers/media/video/saa7164/saa7164-cmd.c b/drivers/media/video/saa7164/saa7164-cmd.c
index cd3af4d4364f..e097f1a0969a 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)
80 80
81/* Commands to the f/w get marshelled to/from this code then onto the PCI 81/* Commands to the f/w get marshelled to/from this code then onto the PCI
82 * -bus/c running buffer. */ 82 * -bus/c running buffer. */
83int saa7164_irq_dequeue(struct saa7164_dev *dev)
84{
85 int ret = SAA_OK;
86 u32 timeout;
87 wait_queue_head_t *q = 0;
88 dprintk(DBGLVL_CMD, "%s()\n", __func__);
89
90 /* While any outstand message on the bus exists... */
91 do {
92
93 /* Peek the msg bus */
94 tmComResInfo_t tRsp = { 0, 0, 0, 0, 0, 0 };
95 ret = saa7164_bus_get(dev, &tRsp, NULL, 1);
96 if (ret != SAA_OK)
97 break;
98
99 q = &dev->cmds[tRsp.seqno].wait;
100 timeout = saa7164_cmd_timeout_get(dev, tRsp.seqno);
101 dprintk(DBGLVL_CMD, "%s() timeout = %d\n", __func__, timeout);
102 if (!timeout) {
103 dprintk(DBGLVL_CMD,
104 "%s() signalled seqno(%d) (for dequeue)\n",
105 __func__, tRsp.seqno);
106 dev->cmds[tRsp.seqno].signalled = 1;
107 wake_up(q);
108 } else {
109 printk(KERN_ERR
110 "%s() found timed out command on the bus\n",
111 __func__);
112 }
113 } while (0);
114
115 return ret;
116}
117
118/* Commands to the f/w get marshelled to/from this code then onto the PCI
119 * -bus/c running buffer. */
83int saa7164_cmd_dequeue(struct saa7164_dev *dev) 120int saa7164_cmd_dequeue(struct saa7164_dev *dev)
84{ 121{
85 int loop = 1; 122 int loop = 1;
diff --git a/drivers/media/video/saa7164/saa7164-core.c b/drivers/media/video/saa7164/saa7164-core.c
index 3753b52e0294..e878fbcbb1eb 100644
--- a/drivers/media/video/saa7164/saa7164-core.c
+++ b/drivers/media/video/saa7164/saa7164-core.c
@@ -69,7 +69,7 @@ static void saa7164_work_cmdhandler(struct work_struct *w)
69 struct saa7164_dev *dev = container_of(w, struct saa7164_dev, workcmd); 69 struct saa7164_dev *dev = container_of(w, struct saa7164_dev, workcmd);
70 70
71 /* Wake up any complete commands */ 71 /* Wake up any complete commands */
72 saa7164_cmd_signal(dev, 0); 72 saa7164_irq_dequeue(dev);
73} 73}
74 74
75static void saa7164_buffer_deliver(struct saa7164_buffer *buf) 75static void saa7164_buffer_deliver(struct saa7164_buffer *buf)
diff --git a/drivers/media/video/saa7164/saa7164.h b/drivers/media/video/saa7164/saa7164.h
index 93a75e15d211..6753008a9c9b 100644
--- a/drivers/media/video/saa7164/saa7164.h
+++ b/drivers/media/video/saa7164/saa7164.h
@@ -328,6 +328,7 @@ int saa7164_cmd_send(struct saa7164_dev *dev,
328 u8 id, tmComResCmd_t command, u16 controlselector, 328 u8 id, tmComResCmd_t command, u16 controlselector,
329 u16 size, void *buf); 329 u16 size, void *buf);
330void saa7164_cmd_signal(struct saa7164_dev *dev, u8 seqno); 330void saa7164_cmd_signal(struct saa7164_dev *dev, u8 seqno);
331int saa7164_irq_dequeue(struct saa7164_dev *dev);
331 332
332/* ----------------------------------------------------------- */ 333/* ----------------------------------------------------------- */
333/* saa7164-api.c */ 334/* saa7164-api.c */