summaryrefslogtreecommitdiff
path: root/linux/drivers/media/common/saa7146_vbi.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/common/saa7146_vbi.c')
-rw-r--r--linux/drivers/media/common/saa7146_vbi.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/linux/drivers/media/common/saa7146_vbi.c b/linux/drivers/media/common/saa7146_vbi.c
index 1b8661f4a..3766cf533 100644
--- a/linux/drivers/media/common/saa7146_vbi.c
+++ b/linux/drivers/media/common/saa7146_vbi.c
@@ -8,14 +8,14 @@ static int vbi_workaround(struct saa7146_dev *dev)
u32 *cpu;
dma_addr_t dma_addr;
-
+
int count = 0;
int i;
DECLARE_WAITQUEUE(wait, current);
-
+
DEB_VBI(("dev:%p\n",dev));
-
+
/* once again, a bug in the saa7146: the brs acquisition
is buggy and especially the BXO-counter does not work
as specified. there is this workaround, but please
@@ -29,7 +29,7 @@ static int vbi_workaround(struct saa7146_dev *dev)
saa7146_write(dev, BASE_EVEN3, dma_addr);
saa7146_write(dev, BASE_ODD3, dma_addr+vbi_pixel_to_capture);
saa7146_write(dev, PROT_ADDR3, dma_addr+4096);
- saa7146_write(dev, PITCH3, vbi_pixel_to_capture);
+ saa7146_write(dev, PITCH3, vbi_pixel_to_capture);
saa7146_write(dev, BASE_PAGE3, 0x0);
saa7146_write(dev, NUM_LINE_BYTE3, (2<<16)|((vbi_pixel_to_capture)<<0));
saa7146_write(dev, MC2, MASK_04|MASK_20);
@@ -37,7 +37,7 @@ static int vbi_workaround(struct saa7146_dev *dev)
/* load brs-control register */
WRITE_RPS1(CMD_WR_REG | (1 << 8) | (BRS_CTRL/4));
/* BXO = 1h, BRS to outbound */
- WRITE_RPS1(0xc000008c);
+ WRITE_RPS1(0xc000008c);
/* wait for vbi_a or vbi_b*/
if ( 0 != (SAA7146_USE_PORT_B_FOR_VBI & dev->ext_vv_data->flags)) {
DEB_D(("...using port b\n"));
@@ -67,7 +67,7 @@ static int vbi_workaround(struct saa7146_dev *dev)
/* load brs-control register */
WRITE_RPS1(CMD_WR_REG | (1 << 8) | (BRS_CTRL/4));
/* Set BRS right: note: this is an experimental value for BXO (=> PAL!) */
- WRITE_RPS1((540 << 7) | (5 << 19)); // 5 == vbi_start
+ WRITE_RPS1((540 << 7) | (5 << 19)); // 5 == vbi_start
/* wait for brs_done */
WRITE_RPS1(CMD_PAUSE | MASK_08);
/* upload brs and video-dma3*/
@@ -79,7 +79,7 @@ static int vbi_workaround(struct saa7146_dev *dev)
WRITE_RPS1(CMD_INTERRUPT);
/* stop rps1 */
WRITE_RPS1(CMD_STOP);
-
+
/* we have to do the workaround twice to be sure that
everything is ok */
for(i = 0; i < 2; i++) {
@@ -89,7 +89,7 @@ static int vbi_workaround(struct saa7146_dev *dev)
saa7146_write(dev, NUM_LINE_BYTE3, (1<<16)|(2<<0));
saa7146_write(dev, MC2, MASK_04|MASK_20);
-
+
/* enable rps1 irqs */
SAA7146_IER_ENABLE(dev,MASK_28);
@@ -99,12 +99,12 @@ static int vbi_workaround(struct saa7146_dev *dev)
/* start rps1 to enable workaround */
saa7146_write(dev, RPS_ADDR1, dev->d_rps1.dma_handle);
- saa7146_write(dev, MC1, (MASK_13 | MASK_29));
-
+ saa7146_write(dev, MC1, (MASK_13 | MASK_29));
+
schedule();
DEB_VBI(("brs bug workaround %d/1.\n",i));
-
+
remove_wait_queue(&vv->vbi_wq, &wait);
current->state = TASK_RUNNING;
@@ -115,7 +115,7 @@ static int vbi_workaround(struct saa7146_dev *dev)
saa7146_write(dev, MC1, MASK_20);
if(signal_pending(current)) {
-
+
DEB_VBI(("aborted (rps:0x%08x).\n",saa7146_read(dev,RPS_ADDR1)));
/* stop rps1 for sure */
@@ -166,29 +166,29 @@ static void saa7146_set_vbi_capture(struct saa7146_dev *dev, struct saa7146_buf
capture and might cause that the first buffer is only half filled (with only
one field). but since this is some sort of streaming data, this is not that negative.
but by doing this, we can use the whole engine from video-buf.c... */
-
+
/*
WRITE_RPS1(CMD_PAUSE | CMD_OAN | CMD_SIG1 | e_wait);
WRITE_RPS1(CMD_PAUSE | CMD_OAN | CMD_SIG1 | o_wait);
*/
/* set bit 1 */
- WRITE_RPS1(CMD_WR_REG | (1 << 8) | (MC2/4));
+ WRITE_RPS1(CMD_WR_REG | (1 << 8) | (MC2/4));
WRITE_RPS1(MASK_28 | MASK_12);
-
+
/* turn on video-dma3 */
- WRITE_RPS1(CMD_WR_REG_MASK | (MC1/4));
- WRITE_RPS1(MASK_04 | MASK_20); /* => mask */
+ WRITE_RPS1(CMD_WR_REG_MASK | (MC1/4));
+ WRITE_RPS1(MASK_04 | MASK_20); /* => mask */
WRITE_RPS1(MASK_04 | MASK_20); /* => values */
-
+
/* wait for o_fid_a/b / e_fid_a/b toggle */
WRITE_RPS1(CMD_PAUSE | o_wait);
WRITE_RPS1(CMD_PAUSE | e_wait);
/* generate interrupt */
- WRITE_RPS1(CMD_INTERRUPT);
+ WRITE_RPS1(CMD_INTERRUPT);
/* stop */
- WRITE_RPS1(CMD_STOP);
+ WRITE_RPS1(CMD_STOP);
/* enable rps1 irqs */
SAA7146_IER_ENABLE(dev, MASK_28);
@@ -197,7 +197,7 @@ static void saa7146_set_vbi_capture(struct saa7146_dev *dev, struct saa7146_buf
saa7146_write(dev, RPS_ADDR1, dev->d_rps1.dma_handle);
/* turn on rps */
- saa7146_write(dev, MC1, (MASK_13 | MASK_29));
+ saa7146_write(dev, MC1, (MASK_13 | MASK_29));
}
static int buffer_activate(struct saa7146_dev *dev,
@@ -234,12 +234,12 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,e
size = lines * llength;
DEB_VBI(("vb:%p\n",vb));
-
+
if (0 != buf->vb.baddr && buf->vb.bsize < size) {
DEB_VBI(("size mismatch.\n"));
return -EINVAL;
}
-
+
if (buf->vb.size != size)
saa7146_dma_free(dev,buf);
@@ -278,7 +278,7 @@ static int buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned
#endif
{
int llength,lines;
-
+
lines = 16 * 2 ; /* 2 fields */
llength = vbi_pixel_to_capture;
@@ -302,7 +302,7 @@ static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb)
struct saa7146_dev *dev = fh->dev;
struct saa7146_vv *vv = dev->vv_data;
struct saa7146_buf *buf = (struct saa7146_buf *)vb;
-
+
DEB_VBI(("vb:%p\n",vb));
saa7146_buffer_queue(dev,&vv->vbi_q,buf);
}
@@ -318,7 +318,7 @@ static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
struct saa7146_fh *fh = file->private_data;
struct saa7146_dev *dev = fh->dev;
struct saa7146_buf *buf = (struct saa7146_buf *)vb;
-
+
DEB_VBI(("vb:%p\n",vb));
saa7146_dma_free(dev,buf);
}
@@ -373,7 +373,7 @@ static void vbi_read_timeout(unsigned long data)
struct file *file = (struct file*)data;
struct saa7146_fh *fh = file->private_data;
struct saa7146_dev *dev = fh->dev;
-
+
DEB_VBI(("dev:%p, fh:%p\n",dev, fh));
vbi_stop(fh, file);
@@ -396,10 +396,10 @@ static void vbi_init(struct saa7146_dev *dev, struct saa7146_vv *vv)
static int vbi_open(struct saa7146_dev *dev, struct file *file)
{
struct saa7146_fh *fh = (struct saa7146_fh *)file->private_data;
-
+
u32 arbtr_ctrl = saa7146_read(dev, PCI_BT_V1);
int ret = 0;
-
+
DEB_VBI(("dev:%p, fh:%p\n",dev,fh));
ret = saa7146_res_get(fh, RESOURCE_DMA3_BRS);
@@ -412,12 +412,12 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file)
arbtr_ctrl &= ~0x1f0000;
arbtr_ctrl |= 0x1d0000;
saa7146_write(dev, PCI_BT_V1, arbtr_ctrl);
- saa7146_write(dev, MC2, (MASK_04|MASK_20));
-
+ saa7146_write(dev, MC2, (MASK_04|MASK_20));
+
memset(&fh->vbi_fmt,0,sizeof(fh->vbi_fmt));
fh->vbi_fmt.sampling_rate = 27000000;
- fh->vbi_fmt.offset = 248; /* todo */
+ fh->vbi_fmt.offset = 248; /* todo */
fh->vbi_fmt.samples_per_line = vbi_pixel_to_capture;
fh->vbi_fmt.sample_format = V4L2_PIX_FMT_GREY;
@@ -456,7 +456,7 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file)
/* upload brs register */
saa7146_write(dev, MC2, (MASK_08|MASK_24));
- return 0;
+ return 0;
}
static void vbi_close(struct saa7146_dev *dev, struct file *file)
@@ -498,7 +498,7 @@ static ssize_t vbi_read(struct file *file, char __user *data, size_t count, loff
ssize_t ret = 0;
DEB_VBI(("dev:%p, fh:%p\n",dev,fh));
-
+
if( NULL == vv->vbi_streaming ) {
// fixme: check if dma3 is available
// fixme: activate vbi engine here if necessary. (really?)