diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-03-10 10:29:15 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-03-24 14:26:49 -0500 |
commit | c7b0ac0546985fc6361a8d92cf808d46da797677 (patch) | |
tree | 2147eb2f6dd7b2b82e0d7b4b9a26e12ef5193252 /drivers/media/video/cx88/cx88-mpeg.c | |
parent | b2fd16b4ff2508ac16ae994f4bcd941f97754c00 (diff) |
V4L/DVB (3516): Make video_buf more generic
Video_buf were concerned to allow PCI devices to be used as
video capture devices. This patch extends video_buf features
by virtualizing pci-dependent functions and allowing other
type of devices to use it.
It is still DMA centric, although it may be used also by
devices that emulates scatter/gather behavior or a DMA device
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/cx88/cx88-mpeg.c')
-rw-r--r-- | drivers/media/video/cx88/cx88-mpeg.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index c79cc1d2bf8b..7d16888b4a86 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c | |||
@@ -163,8 +163,8 @@ static int cx8802_restart_queue(struct cx8802_dev *dev, | |||
163 | 163 | ||
164 | /* ------------------------------------------------------------------ */ | 164 | /* ------------------------------------------------------------------ */ |
165 | 165 | ||
166 | int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf, | 166 | int cx8802_buf_prepare(struct videobuf_queue *q, struct cx8802_dev *dev, |
167 | enum v4l2_field field) | 167 | struct cx88_buffer *buf, enum v4l2_field field) |
168 | { | 168 | { |
169 | int size = dev->ts_packet_size * dev->ts_packet_count; | 169 | int size = dev->ts_packet_size * dev->ts_packet_count; |
170 | int rc; | 170 | int rc; |
@@ -179,7 +179,7 @@ int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf, | |||
179 | buf->vb.size = size; | 179 | buf->vb.size = size; |
180 | buf->vb.field = field /*V4L2_FIELD_TOP*/; | 180 | buf->vb.field = field /*V4L2_FIELD_TOP*/; |
181 | 181 | ||
182 | if (0 != (rc = videobuf_iolock(dev->pci,&buf->vb,NULL))) | 182 | if (0 != (rc = videobuf_iolock(q,&buf->vb,NULL))) |
183 | goto fail; | 183 | goto fail; |
184 | cx88_risc_databuffer(dev->pci, &buf->risc, | 184 | cx88_risc_databuffer(dev->pci, &buf->risc, |
185 | buf->vb.dma.sglist, | 185 | buf->vb.dma.sglist, |
@@ -189,36 +189,36 @@ int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf, | |||
189 | return 0; | 189 | return 0; |
190 | 190 | ||
191 | fail: | 191 | fail: |
192 | cx88_free_buffer(dev->pci,buf); | 192 | cx88_free_buffer(q,buf); |
193 | return rc; | 193 | return rc; |
194 | } | 194 | } |
195 | 195 | ||
196 | void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf) | 196 | void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf) |
197 | { | 197 | { |
198 | struct cx88_buffer *prev; | 198 | struct cx88_buffer *prev; |
199 | struct cx88_dmaqueue *q = &dev->mpegq; | 199 | struct cx88_dmaqueue *cx88q = &dev->mpegq; |
200 | 200 | ||
201 | dprintk( 1, "cx8802_buf_queue\n" ); | 201 | dprintk( 1, "cx8802_buf_queue\n" ); |
202 | /* add jump to stopper */ | 202 | /* add jump to stopper */ |
203 | buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP | RISC_IRQ1 | RISC_CNT_INC); | 203 | buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP | RISC_IRQ1 | RISC_CNT_INC); |
204 | buf->risc.jmp[1] = cpu_to_le32(q->stopper.dma); | 204 | buf->risc.jmp[1] = cpu_to_le32(cx88q->stopper.dma); |
205 | 205 | ||
206 | if (list_empty(&q->active)) { | 206 | if (list_empty(&cx88q->active)) { |
207 | dprintk( 0, "queue is empty - first active\n" ); | 207 | dprintk( 0, "queue is empty - first active\n" ); |
208 | list_add_tail(&buf->vb.queue,&q->active); | 208 | list_add_tail(&buf->vb.queue,&cx88q->active); |
209 | cx8802_start_dma(dev, q, buf); | 209 | cx8802_start_dma(dev, cx88q, buf); |
210 | buf->vb.state = STATE_ACTIVE; | 210 | buf->vb.state = STATE_ACTIVE; |
211 | buf->count = q->count++; | 211 | buf->count = cx88q->count++; |
212 | mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); | 212 | mod_timer(&cx88q->timeout, jiffies+BUFFER_TIMEOUT); |
213 | dprintk(0,"[%p/%d] %s - first active\n", | 213 | dprintk(0,"[%p/%d] %s - first active\n", |
214 | buf, buf->vb.i, __FUNCTION__); | 214 | buf, buf->vb.i, __FUNCTION__); |
215 | 215 | ||
216 | } else { | 216 | } else { |
217 | dprintk( 1, "queue is not empty - append to active\n" ); | 217 | dprintk( 1, "queue is not empty - append to active\n" ); |
218 | prev = list_entry(q->active.prev, struct cx88_buffer, vb.queue); | 218 | prev = list_entry(cx88q->active.prev, struct cx88_buffer, vb.queue); |
219 | list_add_tail(&buf->vb.queue,&q->active); | 219 | list_add_tail(&buf->vb.queue,&cx88q->active); |
220 | buf->vb.state = STATE_ACTIVE; | 220 | buf->vb.state = STATE_ACTIVE; |
221 | buf->count = q->count++; | 221 | buf->count = cx88q->count++; |
222 | prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); | 222 | prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); |
223 | dprintk( 1, "[%p/%d] %s - append to active\n", | 223 | dprintk( 1, "[%p/%d] %s - append to active\n", |
224 | buf, buf->vb.i, __FUNCTION__); | 224 | buf, buf->vb.i, __FUNCTION__); |