lkml.org 
[lkml]   [1998]   [Jan]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectBugfix (?) for bttv [PATCH]
Hi!

To make the spurious lockups I get with the bttv driver go away,
I changed the for ever polling loop to try only a second.
The patch fixes also the VIDIOGPIC ioctl to fill in the right
Information. Patch is tested, but I don't had any lockups since
then...

Richard.

--
Richard Guenther <richard.guenther@student.uni-tuebingen.de>
PGP: 2E829319 - 2F 83 FC 93 E9 E4 19 E2 93 7A 32 42 45 37 23 57
WWW: http://www.anatom.uni-tuebingen.de/~richi/


--- linux-2.1.79/drivers/char/bttv.c.old Sun Jan 18 16:23:45 1998
+++ linux-2.1.79/drivers/char/bttv.c Mon Jan 19 01:07:13 1998
@@ -130,16 +130,22 @@
btwrite(BT848_INT_I2CDONE, BT848_INT_STAT);

btwrite(((addr & 0xff) << 24) | I2C_COMMAND, BT848_I2C);
-
- for (i=0x7fffffff; i; i--)
+
+ /*
+ * Timeout for I2CRead is 1 second (this should be enough, really!)
+ */
+ for (i=1000; i; i--)
{
stat=btread(BT848_INT_STAT);
if (stat & BT848_INT_I2CDONE)
break;
+ udelay(1000); /* 1ms, as I2C is 1kHz (?) */
}

- if (!i)
+ if (!i) {
+ printk(KERN_DEBUG "bttv: I2CRead timeout\n");
return -1;
+ }
if (!(stat & BT848_INT_RACK))
return -2;

@@ -168,15 +174,18 @@

btwrite(data, BT848_I2C);

- for (i=0x7fffffff; i; i--)
+ for (i=1000; i; i--)
{
stat=btread(BT848_INT_STAT);
if (stat & BT848_INT_I2CDONE)
break;
+ udelay(1000);
}

- if (!i)
+ if (!i) {
+ printk(KERN_DEBUG "bttv: I2CWrite timeout\n");
return -1;
+ }
if (!(stat & BT848_INT_RACK))
return -2;

@@ -780,7 +789,7 @@
/*
* 32bit depth frame buffers need extra flags setting
*/
-
+
if (depth==4)
mask=BT848_RISC_BYTE3;
else
@@ -1103,13 +1112,13 @@
case VIDIOCGPICT:
{
struct video_picture p=btv->picture;
- if(btv->win.bpp==8)
+ if(btv->win.bpp==1)
p.palette=VIDEO_PALETTE_HI240;
- if(btv->win.bpp==16)
+ if(btv->win.bpp==2)
p.palette=VIDEO_PALETTE_RGB565;
- if(btv->win.bpp==24)
+ if(btv->win.bpp==3)
p.palette=VIDEO_PALETTE_RGB24;
- if(btv->win.bpp==32)
+ if(btv->win.bpp==4)
p.palette=VIDEO_PALETTE_RGB32;
if(copy_to_user(arg, &p, sizeof(p)))
return -EFAULT;
\
 
 \ /
  Last update: 2005-03-22 13:41    [W:0.067 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site