diff options
-rw-r--r-- | drivers/media/video/videobuf-dma-sg.c | 62 | ||||
-rw-r--r-- | include/media/videobuf-core.h | 3 | ||||
-rw-r--r-- | include/media/videobuf-dma-sg.h | 19 |
3 files changed, 4 insertions, 80 deletions
diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c index 05dd38343fa3..a38efe10feb4 100644 --- a/drivers/media/video/videobuf-dma-sg.c +++ b/drivers/media/video/videobuf-dma-sg.c | |||
@@ -220,7 +220,6 @@ int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction, | |||
220 | int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma) | 220 | int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma) |
221 | { | 221 | { |
222 | void *dev=q->dev; | 222 | void *dev=q->dev; |
223 | struct videobuf_dma_sg_ops *ops=q->priv_ops; | ||
224 | 223 | ||
225 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); | 224 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); |
226 | BUG_ON(0 == dma->nr_pages); | 225 | BUG_ON(0 == dma->nr_pages); |
@@ -247,10 +246,8 @@ int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma) | |||
247 | return -ENOMEM; | 246 | return -ENOMEM; |
248 | } | 247 | } |
249 | if (!dma->bus_addr) { | 248 | if (!dma->bus_addr) { |
250 | if (ops && ops->vb_map_sg) { | 249 | dma->sglen = pci_map_sg(dev,dma->sglist, |
251 | dma->sglen = ops->vb_map_sg(dev,dma->sglist, | ||
252 | dma->nr_pages, dma->direction); | 250 | dma->nr_pages, dma->direction); |
253 | } | ||
254 | if (0 == dma->sglen) { | 251 | if (0 == dma->sglen) { |
255 | printk(KERN_WARNING | 252 | printk(KERN_WARNING |
256 | "%s: videobuf_map_sg failed\n",__FUNCTION__); | 253 | "%s: videobuf_map_sg failed\n",__FUNCTION__); |
@@ -266,30 +263,24 @@ int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma) | |||
266 | int videobuf_dma_sync(struct videobuf_queue *q,struct videobuf_dmabuf *dma) | 263 | int videobuf_dma_sync(struct videobuf_queue *q,struct videobuf_dmabuf *dma) |
267 | { | 264 | { |
268 | void *dev=q->dev; | 265 | void *dev=q->dev; |
269 | struct videobuf_dma_sg_ops *ops=q->priv_ops; | ||
270 | 266 | ||
271 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); | 267 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); |
272 | BUG_ON(!dma->sglen); | 268 | BUG_ON(!dma->sglen); |
273 | 269 | ||
274 | if (!dma->bus_addr && ops && ops->vb_dma_sync_sg) | 270 | pci_dma_sync_sg_for_cpu (dev,dma->sglist,dma->nr_pages,dma->direction); |
275 | ops->vb_dma_sync_sg(dev,dma->sglist,dma->nr_pages, | ||
276 | dma->direction); | ||
277 | |||
278 | return 0; | 271 | return 0; |
279 | } | 272 | } |
280 | 273 | ||
281 | int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma) | 274 | int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma) |
282 | { | 275 | { |
283 | void *dev=q->dev; | 276 | void *dev=q->dev; |
284 | struct videobuf_dma_sg_ops *ops=q->priv_ops; | ||
285 | 277 | ||
286 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); | 278 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); |
287 | if (!dma->sglen) | 279 | if (!dma->sglen) |
288 | return 0; | 280 | return 0; |
289 | 281 | ||
290 | if (!dma->bus_addr && ops && ops->vb_unmap_sg) | 282 | pci_unmap_sg (dev,dma->sglist,dma->nr_pages,dma->direction); |
291 | ops->vb_unmap_sg(dev,dma->sglist,dma->nr_pages, | 283 | |
292 | dma->direction); | ||
293 | kfree(dma->sglist); | 284 | kfree(dma->sglist); |
294 | dma->sglist = NULL; | 285 | dma->sglist = NULL; |
295 | dma->sglen = 0; | 286 | dma->sglen = 0; |
@@ -325,12 +316,8 @@ int videobuf_dma_free(struct videobuf_dmabuf *dma) | |||
325 | int videobuf_pci_dma_map(struct pci_dev *pci,struct videobuf_dmabuf *dma) | 316 | int videobuf_pci_dma_map(struct pci_dev *pci,struct videobuf_dmabuf *dma) |
326 | { | 317 | { |
327 | struct videobuf_queue q; | 318 | struct videobuf_queue q; |
328 | struct videobuf_dma_sg_ops qops; | ||
329 | 319 | ||
330 | q.dev=pci; | 320 | q.dev=pci; |
331 | qops.vb_map_sg=(vb_map_sg_t *)pci_map_sg; | ||
332 | qops.vb_unmap_sg=(vb_map_sg_t *)pci_unmap_sg; | ||
333 | q.priv_ops = &qops; | ||
334 | 321 | ||
335 | return (videobuf_dma_map(&q,dma)); | 322 | return (videobuf_dma_map(&q,dma)); |
336 | } | 323 | } |
@@ -338,12 +325,8 @@ int videobuf_pci_dma_map(struct pci_dev *pci,struct videobuf_dmabuf *dma) | |||
338 | int videobuf_pci_dma_unmap(struct pci_dev *pci,struct videobuf_dmabuf *dma) | 325 | int videobuf_pci_dma_unmap(struct pci_dev *pci,struct videobuf_dmabuf *dma) |
339 | { | 326 | { |
340 | struct videobuf_queue q; | 327 | struct videobuf_queue q; |
341 | struct videobuf_dma_sg_ops qops; | ||
342 | 328 | ||
343 | q.dev=pci; | 329 | q.dev=pci; |
344 | qops.vb_map_sg=(vb_map_sg_t *)pci_map_sg; | ||
345 | qops.vb_unmap_sg=(vb_map_sg_t *)pci_unmap_sg; | ||
346 | q.priv_ops = &qops; | ||
347 | 330 | ||
348 | return (videobuf_dma_unmap(&q,dma)); | 331 | return (videobuf_dma_unmap(&q,dma)); |
349 | } | 332 | } |
@@ -712,46 +695,10 @@ void videobuf_queue_pci_init(struct videobuf_queue* q, | |||
712 | unsigned int msize, | 695 | unsigned int msize, |
713 | void *priv) | 696 | void *priv) |
714 | { | 697 | { |
715 | struct videobuf_dma_sg_ops *priv_ops; | ||
716 | |||
717 | videobuf_queue_init(q, ops, dev, irqlock, type, field, msize, priv); | 698 | videobuf_queue_init(q, ops, dev, irqlock, type, field, msize, priv); |
718 | q->int_ops=&pci_ops; | 699 | q->int_ops=&pci_ops; |
719 | |||
720 | /* FIXME: the code bellow should be removed after having a proper | ||
721 | * memory allocation method for vivi and tm6000 | ||
722 | */ | ||
723 | q->priv_ops= kzalloc(sizeof(struct videobuf_dma_sg_ops), GFP_KERNEL); | ||
724 | BUG_ON (!q->priv_ops); | ||
725 | |||
726 | priv_ops=q->priv_ops; | ||
727 | |||
728 | /* Sets default methods for handling Scatter Gather mapping */ | ||
729 | priv_ops->vb_map_sg=(vb_map_sg_t *)pci_map_sg; | ||
730 | priv_ops->vb_unmap_sg=(vb_map_sg_t *)pci_unmap_sg; | ||
731 | priv_ops->vb_dma_sync_sg=(vb_map_sg_t *)pci_dma_sync_sg_for_cpu; | ||
732 | } | 700 | } |
733 | 701 | ||
734 | void videobuf_set_pci_ops (struct videobuf_queue* q, | ||
735 | struct videobuf_dma_sg_ops *ops) | ||
736 | { | ||
737 | kfree (q->priv_ops); | ||
738 | |||
739 | q->priv_ops=ops; | ||
740 | |||
741 | if (!ops) | ||
742 | return; | ||
743 | |||
744 | /* If not specified, defaults to PCI map sg */ | ||
745 | if (!ops->vb_map_sg) | ||
746 | ops->vb_map_sg=(vb_map_sg_t *)pci_map_sg; | ||
747 | |||
748 | if (!ops->vb_dma_sync_sg) | ||
749 | ops->vb_dma_sync_sg=(vb_map_sg_t *)pci_dma_sync_sg_for_cpu; | ||
750 | if (!ops->vb_unmap_sg) | ||
751 | ops->vb_unmap_sg=(vb_map_sg_t *)pci_unmap_sg; | ||
752 | } | ||
753 | |||
754 | |||
755 | /* --------------------------------------------------------------------- */ | 702 | /* --------------------------------------------------------------------- */ |
756 | 703 | ||
757 | EXPORT_SYMBOL_GPL(videobuf_vmalloc_to_sg); | 704 | EXPORT_SYMBOL_GPL(videobuf_vmalloc_to_sg); |
@@ -771,7 +718,6 @@ EXPORT_SYMBOL_GPL(videobuf_pci_dma_unmap); | |||
771 | EXPORT_SYMBOL_GPL(videobuf_pci_alloc); | 718 | EXPORT_SYMBOL_GPL(videobuf_pci_alloc); |
772 | 719 | ||
773 | EXPORT_SYMBOL_GPL(videobuf_queue_pci_init); | 720 | EXPORT_SYMBOL_GPL(videobuf_queue_pci_init); |
774 | EXPORT_SYMBOL_GPL(videobuf_set_pci_ops); | ||
775 | 721 | ||
776 | /* | 722 | /* |
777 | * Local variables: | 723 | * Local variables: |
diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h index 96949e31eaf8..9bae5a2eda66 100644 --- a/include/media/videobuf-core.h +++ b/include/media/videobuf-core.h | |||
@@ -173,9 +173,6 @@ struct videobuf_queue { | |||
173 | 173 | ||
174 | /* driver private data */ | 174 | /* driver private data */ |
175 | void *priv_data; | 175 | void *priv_data; |
176 | |||
177 | /*FIXME: should be removed after completing the vb conversion */ | ||
178 | void *priv_ops; | ||
179 | }; | 176 | }; |
180 | 177 | ||
181 | int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr); | 178 | int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr); |
diff --git a/include/media/videobuf-dma-sg.h b/include/media/videobuf-dma-sg.h index 206d9027b39f..38105031db23 100644 --- a/include/media/videobuf-dma-sg.h +++ b/include/media/videobuf-dma-sg.h | |||
@@ -89,19 +89,6 @@ struct videbuf_pci_sg_memory | |||
89 | struct videobuf_dmabuf dma; | 89 | struct videobuf_dmabuf dma; |
90 | }; | 90 | }; |
91 | 91 | ||
92 | /* FIXME: To be removed soon */ | ||
93 | typedef int (vb_map_sg_t)(void *dev, struct scatterlist *sglist, int nr_pages, | ||
94 | int direction); | ||
95 | |||
96 | /* FIXME: To be removed soon */ | ||
97 | struct videobuf_dma_sg_ops | ||
98 | { | ||
99 | vb_map_sg_t *vb_map_sg; | ||
100 | vb_map_sg_t *vb_dma_sync_sg; | ||
101 | vb_map_sg_t *vb_unmap_sg; | ||
102 | |||
103 | }; | ||
104 | |||
105 | void videobuf_dma_init(struct videobuf_dmabuf *dma); | 92 | void videobuf_dma_init(struct videobuf_dmabuf *dma); |
106 | int videobuf_dma_init_user(struct videobuf_dmabuf *dma, int direction, | 93 | int videobuf_dma_init_user(struct videobuf_dmabuf *dma, int direction, |
107 | unsigned long data, unsigned long size); | 94 | unsigned long data, unsigned long size); |
@@ -133,9 +120,3 @@ void videobuf_queue_pci_init(struct videobuf_queue* q, | |||
133 | int videobuf_pci_dma_map(struct pci_dev *pci,struct videobuf_dmabuf *dma); | 120 | int videobuf_pci_dma_map(struct pci_dev *pci,struct videobuf_dmabuf *dma); |
134 | int videobuf_pci_dma_unmap(struct pci_dev *pci,struct videobuf_dmabuf *dma); | 121 | int videobuf_pci_dma_unmap(struct pci_dev *pci,struct videobuf_dmabuf *dma); |
135 | 122 | ||
136 | /* FIXME: temporary routine for vivi and tm6000, while lacking implementation | ||
137 | * of videobuf-vmalloc | ||
138 | */ | ||
139 | void videobuf_set_pci_ops (struct videobuf_queue* q, | ||
140 | struct videobuf_dma_sg_ops *ops); | ||
141 | |||