diff options
author | Manu Abraham <manu@kromtek.com> | 2005-05-05 19:16:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-05 19:36:44 -0400 |
commit | fc9d53af37deeb830252f03c62724078d943686c (patch) | |
tree | 95e018111ee1db5657100077a25fa5d7d416d676 | |
parent | 2ef41634def0fcb0def3e3c90220c651ca478cb3 (diff) |
[PATCH] bttv: fix dst i2c read/write timeout failure.
Attached is a patch to bttv which fixes the following problems.
Affected cards and problems:
~~~~~~~~~~~~~~~~~~~~~~~~
o VP-1020 (200103A) Tuning problems, device detection.
o VP-1020 (DST-MOT) Errors during tuning, device detection fails in a while.
o VP-1030 (DST-CI) Tuning sometimes fails after CI commands.
o VP-2031 (DCT-CI) Tuning problems
The timeout happens before the actual timeout occured in the MCU
on the board, and hence the problems.
Changes: (bttv-i2c.diff)
~~~~~~~~~~~~~~~~~~~~~~~~
o Changed the custom wait queue to wait_event_interruptible_timeout()
- Suggestion by Johannes Stezenbach.
o Fixed the wait queue timeout problem
- This fixes the timeout problem on various cards.
- This problem was visible as many
* Cannot tune to channels, when signal levels are very low.
* app_info does not work in some conditions for CI based cards
- Smaller values worked good for newer cards, but the older cards
suffered, settled down to the worst case values that could happen in any
eventuality.
Signed-off-by: Manu Abraham <manu@kromtek.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/media/video/bttv-i2c.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c index e42f1ec13f3e..e3f477dff827 100644 --- a/drivers/media/video/bttv-i2c.c +++ b/drivers/media/video/bttv-i2c.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/moduleparam.h> | 29 | #include <linux/moduleparam.h> |
30 | #include <linux/init.h> | 30 | #include <linux/init.h> |
31 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
32 | #include <linux/jiffies.h> | ||
32 | #include <asm/io.h> | 33 | #include <asm/io.h> |
33 | 34 | ||
34 | #include "bttvp.h" | 35 | #include "bttvp.h" |
@@ -130,17 +131,14 @@ static u32 functionality(struct i2c_adapter *adap) | |||
130 | static int | 131 | static int |
131 | bttv_i2c_wait_done(struct bttv *btv) | 132 | bttv_i2c_wait_done(struct bttv *btv) |
132 | { | 133 | { |
133 | DECLARE_WAITQUEUE(wait, current); | ||
134 | int rc = 0; | 134 | int rc = 0; |
135 | 135 | ||
136 | add_wait_queue(&btv->i2c_queue, &wait); | 136 | /* timeout */ |
137 | if (0 == btv->i2c_done) | 137 | if (wait_event_interruptible_timeout(btv->i2c_queue, |
138 | msleep_interruptible(20); | 138 | btv->i2c_done, msecs_to_jiffies(85)) == -ERESTARTSYS) |
139 | remove_wait_queue(&btv->i2c_queue, &wait); | 139 | |
140 | rc = -EIO; | ||
140 | 141 | ||
141 | if (0 == btv->i2c_done) | ||
142 | /* timeout */ | ||
143 | rc = -EIO; | ||
144 | if (btv->i2c_done & BT848_INT_RACK) | 142 | if (btv->i2c_done & BT848_INT_RACK) |
145 | rc = 1; | 143 | rc = 1; |
146 | btv->i2c_done = 0; | 144 | btv->i2c_done = 0; |