summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/cx18
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2008-11-21 23:23:22 -0500
committerAndy Walls <awalls@radix.net>2008-11-21 23:23:22 -0500
commitcbd9b1715c3df1c998013c4606b32512a4ac1beb (patch)
tree92ad7db6822e3ee66b91b8a29e2e34b1821c5cb9 /linux/drivers/media/video/cx18
parentab836bf8e5b5007ce7e1e2e6513637e99fea6a83 (diff)
downloadmediapointer-dvb-s2-cbd9b1715c3df1c998013c4606b32512a4ac1beb.tar.gz
mediapointer-dvb-s2-cbd9b1715c3df1c998013c4606b32512a4ac1beb.tar.bz2
cx18: Adjust outgoing mailbox timeouts and remove statistics logging
From: Andy Walls <awalls@radix.net> cx18: Adjust outgoing mailbox timeouts and remove statistics logging. This saves some wasted storage in struct cx18 for each card. Cutting the outgoing mailbox timeouts in half from the previous value appears to be safe with MythTV. Got rid of interrupted case code path after a wait uninterruptable returns. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
Diffstat (limited to 'linux/drivers/media/video/cx18')
-rw-r--r--linux/drivers/media/video/cx18/cx18-driver.c2
-rw-r--r--linux/drivers/media/video/cx18/cx18-driver.h8
-rw-r--r--linux/drivers/media/video/cx18/cx18-io.c14
-rw-r--r--linux/drivers/media/video/cx18/cx18-io.h4
-rw-r--r--linux/drivers/media/video/cx18/cx18-ioctl.c1
-rw-r--r--linux/drivers/media/video/cx18/cx18-mailbox.c33
6 files changed, 8 insertions, 54 deletions
diff --git a/linux/drivers/media/video/cx18/cx18-driver.c b/linux/drivers/media/video/cx18/cx18-driver.c
index 15c1fb9b2..1fa9a670b 100644
--- a/linux/drivers/media/video/cx18/cx18-driver.c
+++ b/linux/drivers/media/video/cx18/cx18-driver.c
@@ -839,7 +839,6 @@ err:
if (retval == 0)
retval = -ENODEV;
CX18_ERR("Error %d on initialization\n", retval);
- cx18_log_statistics(cx);
i = cx->num;
spin_lock(&cx18_cards_lock);
@@ -956,7 +955,6 @@ static void cx18_remove(struct pci_dev *pci_dev)
pci_disable_device(cx->dev);
- cx18_log_statistics(cx);
CX18_INFO("Removed %s, card #%d\n", cx->card_name, cx->num);
}
diff --git a/linux/drivers/media/video/cx18/cx18-driver.h b/linux/drivers/media/video/cx18/cx18-driver.h
index f06290d32..6e4c90e6c 100644
--- a/linux/drivers/media/video/cx18/cx18-driver.h
+++ b/linux/drivers/media/video/cx18/cx18-driver.h
@@ -367,11 +367,6 @@ struct cx18_i2c_algo_callback_data {
};
#define CX18_MAX_MMIO_WR_RETRIES 10
-#define CX18_MAX_MB_ACK_DELAY 100
-
-struct cx18_mbox_stats {
- atomic_t mb_ack_delay[CX18_MAX_MB_ACK_DELAY+1];
-};
/* Struct to hold info about cx18 cards */
struct cx18 {
@@ -467,9 +462,6 @@ struct cx18 {
u32 gpio_val;
struct mutex gpio_lock;
- /* Statistics */
- struct cx18_mbox_stats mbox_stats;
-
/* v4l2 and User settings */
/* codec settings */
diff --git a/linux/drivers/media/video/cx18/cx18-io.c b/linux/drivers/media/video/cx18/cx18-io.c
index c6f1d0d7f..ec5b3d7bc 100644
--- a/linux/drivers/media/video/cx18/cx18-io.c
+++ b/linux/drivers/media/video/cx18/cx18-io.c
@@ -24,20 +24,6 @@
#include "cx18-io.h"
#include "cx18-irq.h"
-void cx18_log_statistics(struct cx18 *cx)
-{
- int i;
-
- if (!(cx18_debug & CX18_DBGFLG_INFO))
- return;
-
- for (i = 0; i <= CX18_MAX_MB_ACK_DELAY; i++)
- if (atomic_read(&cx->mbox_stats.mb_ack_delay[i]))
- CX18_DEBUG_INFO("mb_ack_delay[%d] = %d\n", i,
- atomic_read(&cx->mbox_stats.mb_ack_delay[i]));
- return;
-}
-
void cx18_memset_io(struct cx18 *cx, void __iomem *addr, int val, size_t count)
{
u8 __iomem *dst = addr;
diff --git a/linux/drivers/media/video/cx18/cx18-io.h b/linux/drivers/media/video/cx18/cx18-io.h
index 73321fb4c..e6716dcb1 100644
--- a/linux/drivers/media/video/cx18/cx18-io.h
+++ b/linux/drivers/media/video/cx18/cx18-io.h
@@ -34,10 +34,6 @@
* *read* functions never retry the mmio (it never helps to do so)
*/
-/* Statistics gathering */
-
-void cx18_log_statistics(struct cx18 *cx);
-
/* Non byteswapping memory mapped IO */
static inline u32 cx18_raw_readl(struct cx18 *cx, const void __iomem *addr)
{
diff --git a/linux/drivers/media/video/cx18/cx18-ioctl.c b/linux/drivers/media/video/cx18/cx18-ioctl.c
index 20c7650d7..cc3774012 100644
--- a/linux/drivers/media/video/cx18/cx18-ioctl.c
+++ b/linux/drivers/media/video/cx18/cx18-ioctl.c
@@ -857,7 +857,6 @@ static int cx18_log_status(struct file *file, void *fh)
CX18_INFO("Read MPEG/VBI: %lld/%lld bytes\n",
(long long)cx->mpg_data_received,
(long long)cx->vbi_data_inserted);
- cx18_log_statistics(cx);
CX18_INFO("================== END STATUS CARD #%d ==================\n", cx->num);
return 0;
}
diff --git a/linux/drivers/media/video/cx18/cx18-mailbox.c b/linux/drivers/media/video/cx18/cx18-mailbox.c
index a1060880a..322402185 100644
--- a/linux/drivers/media/video/cx18/cx18-mailbox.c
+++ b/linux/drivers/media/video/cx18/cx18-mailbox.c
@@ -468,13 +468,6 @@ void cx18_api_epu_cmd_irq(struct cx18 *cx, int rpu)
* Functions called from a non-interrupt, non work_queue context
*/
-static void cx18_api_log_ack_delay(struct cx18 *cx, int msecs)
-{
- if (msecs > CX18_MAX_MB_ACK_DELAY)
- msecs = CX18_MAX_MB_ACK_DELAY;
- atomic_inc(&cx->mbox_stats.mb_ack_delay[msecs]);
-}
-
static int cx18_api_call(struct cx18 *cx, u32 cmd, int args, u32 data[])
{
const struct cx18_api_info *info = find_api_info(cmd);
@@ -529,7 +522,7 @@ static int cx18_api_call(struct cx18 *cx, u32 cmd, int args, u32 data[])
*/
state = cx18_readl(cx, xpu_state);
req = cx18_readl(cx, &mb->request);
- timeout = msecs_to_jiffies(20); /* 1 field at 50 Hz vertical refresh */
+ timeout = msecs_to_jiffies(10);
ret = wait_event_timeout(*waitq,
(ack = cx18_readl(cx, &mb->ack)) == req,
timeout);
@@ -539,8 +532,8 @@ static int cx18_api_call(struct cx18 *cx, u32 cmd, int args, u32 data[])
CX18_ERR("mbox was found stuck busy when setting up for %s; "
"clearing busy and trying to proceed\n", info->name);
} else if (ret != timeout)
- CX18_DEBUG_API("waited %u usecs for busy mbox to be acked\n",
- jiffies_to_usecs(timeout-ret));
+ CX18_DEBUG_API("waited %u msecs for busy mbox to be acked\n",
+ jiffies_to_msecs(timeout-ret));
/* Build the outgoing mailbox */
req = ((req & 0xfffffffe) == 0xfffffffe) ? 1 : req + 1;
@@ -554,10 +547,8 @@ static int cx18_api_call(struct cx18 *cx, u32 cmd, int args, u32 data[])
/*
* Notify the XPU and wait for it to send an Ack back
- * 21 ms = ~ 0.5 frames at a frame rate of 24 fps
- * 42 ms = ~ 1 frame at a frame rate of 24 fps
*/
- timeout = msecs_to_jiffies((info->flags & API_FAST) ? 21 : 42);
+ timeout = msecs_to_jiffies((info->flags & API_FAST) ? 10 : 20);
CX18_DEBUG_HI_IRQ("sending interrupt SW1: %x to send %s\n",
irq, info->name);
@@ -567,27 +558,19 @@ static int cx18_api_call(struct cx18 *cx, u32 cmd, int args, u32 data[])
*waitq,
cx18_readl(cx, &mb->ack) == cx18_readl(cx, &mb->request),
timeout);
+
if (ret == 0) {
/* Timed out */
mutex_unlock(mb_lock);
- i = jiffies_to_msecs(timeout);
- cx18_api_log_ack_delay(cx, i);
CX18_WARN("sending %s timed out waiting %d msecs for RPU "
- "acknowledgement\n", info->name, i);
+ "acknowledgement\n",
+ info->name, jiffies_to_msecs(timeout));
return -EINVAL;
- } else if (ret < 0) {
- /* Interrupted */
- mutex_unlock(mb_lock);
- CX18_WARN("sending %s was interrupted waiting for RPU"
- "acknowledgement\n", info->name);
- return -EINTR;
}
- i = jiffies_to_msecs(timeout-ret);
- cx18_api_log_ack_delay(cx, i);
if (ret != timeout)
CX18_DEBUG_HI_API("waited %u msecs for %s to be acked\n",
- i, info->name);
+ jiffies_to_msecs(timeout-ret), info->name);
/* Collect data returned by the XPU */
for (i = 0; i < MAX_MB_ARGUMENTS; i++)