aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/omap/Kconfig2
-rw-r--r--drivers/media/video/omap/omap_vout.c46
2 files changed, 16 insertions, 32 deletions
diff --git a/drivers/media/video/omap/Kconfig b/drivers/media/video/omap/Kconfig
index c1d19335891a..e63233fd2aaa 100644
--- a/drivers/media/video/omap/Kconfig
+++ b/drivers/media/video/omap/Kconfig
@@ -2,7 +2,7 @@ config VIDEO_OMAP2_VOUT
2 tristate "OMAP2/OMAP3 V4L2-Display driver" 2 tristate "OMAP2/OMAP3 V4L2-Display driver"
3 depends on ARCH_OMAP2 || ARCH_OMAP3 3 depends on ARCH_OMAP2 || ARCH_OMAP3
4 select VIDEOBUF_GEN 4 select VIDEOBUF_GEN
5 select VIDEOBUF_DMA_SG 5 select VIDEOBUF_DMA_CONTIG
6 select OMAP2_DSS 6 select OMAP2_DSS
7 select OMAP2_VRAM 7 select OMAP2_VRAM
8 select OMAP2_VRFB 8 select OMAP2_VRFB
diff --git a/drivers/media/video/omap/omap_vout.c b/drivers/media/video/omap/omap_vout.c
index dfa68268a73b..929073e792c9 100644
--- a/drivers/media/video/omap/omap_vout.c
+++ b/drivers/media/video/omap/omap_vout.c
@@ -40,7 +40,7 @@
40#include <linux/videodev2.h> 40#include <linux/videodev2.h>
41#include <linux/slab.h> 41#include <linux/slab.h>
42 42
43#include <media/videobuf-dma-sg.h> 43#include <media/videobuf-dma-contig.h>
44#include <media/v4l2-device.h> 44#include <media/v4l2-device.h>
45#include <media/v4l2-ioctl.h> 45#include <media/v4l2-ioctl.h>
46 46
@@ -1054,9 +1054,9 @@ static int omap_vout_buffer_prepare(struct videobuf_queue *q,
1054 struct videobuf_buffer *vb, 1054 struct videobuf_buffer *vb,
1055 enum v4l2_field field) 1055 enum v4l2_field field)
1056{ 1056{
1057 dma_addr_t dmabuf;
1057 struct vid_vrfb_dma *tx; 1058 struct vid_vrfb_dma *tx;
1058 enum dss_rotation rotation; 1059 enum dss_rotation rotation;
1059 struct videobuf_dmabuf *dmabuf = NULL;
1060 struct omap_vout_device *vout = q->priv_data; 1060 struct omap_vout_device *vout = q->priv_data;
1061 u32 dest_frame_index = 0, src_element_index = 0; 1061 u32 dest_frame_index = 0, src_element_index = 0;
1062 u32 dest_element_index = 0, src_frame_index = 0; 1062 u32 dest_element_index = 0, src_frame_index = 0;
@@ -1075,24 +1075,17 @@ static int omap_vout_buffer_prepare(struct videobuf_queue *q,
1075 if (V4L2_MEMORY_USERPTR == vb->memory) { 1075 if (V4L2_MEMORY_USERPTR == vb->memory) {
1076 if (0 == vb->baddr) 1076 if (0 == vb->baddr)
1077 return -EINVAL; 1077 return -EINVAL;
1078 /* Virtual address */
1079 /* priv points to struct videobuf_pci_sg_memory. But we went
1080 * pointer to videobuf_dmabuf, which is member of
1081 * videobuf_pci_sg_memory */
1082 dmabuf = videobuf_to_dma(q->bufs[vb->i]);
1083 dmabuf->vmalloc = (void *) vb->baddr;
1084
1085 /* Physical address */ 1078 /* Physical address */
1086 dmabuf->bus_addr = 1079 vout->queued_buf_addr[vb->i] = (u8 *)
1087 (dma_addr_t) omap_vout_uservirt_to_phys(vb->baddr); 1080 omap_vout_uservirt_to_phys(vb->baddr);
1081 } else {
1082 vout->queued_buf_addr[vb->i] = (u8 *)vout->buf_phy_addr[vb->i];
1088 } 1083 }
1089 1084
1090 if (!rotation_enabled(vout)) { 1085 if (!rotation_enabled(vout))
1091 dmabuf = videobuf_to_dma(q->bufs[vb->i]);
1092 vout->queued_buf_addr[vb->i] = (u8 *) dmabuf->bus_addr;
1093 return 0; 1086 return 0;
1094 } 1087
1095 dmabuf = videobuf_to_dma(q->bufs[vb->i]); 1088 dmabuf = vout->buf_phy_addr[vb->i];
1096 /* If rotation is enabled, copy input buffer into VRFB 1089 /* If rotation is enabled, copy input buffer into VRFB
1097 * memory space using DMA. We are copying input buffer 1090 * memory space using DMA. We are copying input buffer
1098 * into VRFB memory space of desired angle and DSS will 1091 * into VRFB memory space of desired angle and DSS will
@@ -1121,7 +1114,7 @@ static int omap_vout_buffer_prepare(struct videobuf_queue *q,
1121 tx->dev_id, 0x0); 1114 tx->dev_id, 0x0);
1122 /* src_port required only for OMAP1 */ 1115 /* src_port required only for OMAP1 */
1123 omap_set_dma_src_params(tx->dma_ch, 0, OMAP_DMA_AMODE_POST_INC, 1116 omap_set_dma_src_params(tx->dma_ch, 0, OMAP_DMA_AMODE_POST_INC,
1124 dmabuf->bus_addr, src_element_index, src_frame_index); 1117 dmabuf, src_element_index, src_frame_index);
1125 /*set dma source burst mode for VRFB */ 1118 /*set dma source burst mode for VRFB */
1126 omap_set_dma_src_burst_mode(tx->dma_ch, OMAP_DMA_DATA_BURST_16); 1119 omap_set_dma_src_burst_mode(tx->dma_ch, OMAP_DMA_DATA_BURST_16);
1127 rotation = calc_rotation(vout); 1120 rotation = calc_rotation(vout);
@@ -1212,7 +1205,6 @@ static int omap_vout_mmap(struct file *file, struct vm_area_struct *vma)
1212 void *pos; 1205 void *pos;
1213 unsigned long start = vma->vm_start; 1206 unsigned long start = vma->vm_start;
1214 unsigned long size = (vma->vm_end - vma->vm_start); 1207 unsigned long size = (vma->vm_end - vma->vm_start);
1215 struct videobuf_dmabuf *dmabuf = NULL;
1216 struct omap_vout_device *vout = file->private_data; 1208 struct omap_vout_device *vout = file->private_data;
1217 struct videobuf_queue *q = &vout->vbq; 1209 struct videobuf_queue *q = &vout->vbq;
1218 1210
@@ -1242,8 +1234,7 @@ static int omap_vout_mmap(struct file *file, struct vm_area_struct *vma)
1242 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); 1234 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
1243 vma->vm_ops = &omap_vout_vm_ops; 1235 vma->vm_ops = &omap_vout_vm_ops;
1244 vma->vm_private_data = (void *) vout; 1236 vma->vm_private_data = (void *) vout;
1245 dmabuf = videobuf_to_dma(q->bufs[i]); 1237 pos = (void *)vout->buf_virt_addr[i];
1246 pos = dmabuf->vmalloc;
1247 vma->vm_pgoff = virt_to_phys((void *)pos) >> PAGE_SHIFT; 1238 vma->vm_pgoff = virt_to_phys((void *)pos) >> PAGE_SHIFT;
1248 while (size > 0) { 1239 while (size > 0) {
1249 unsigned long pfn; 1240 unsigned long pfn;
@@ -1348,8 +1339,8 @@ static int omap_vout_open(struct file *file)
1348 video_vbq_ops.buf_queue = omap_vout_buffer_queue; 1339 video_vbq_ops.buf_queue = omap_vout_buffer_queue;
1349 spin_lock_init(&vout->vbq_lock); 1340 spin_lock_init(&vout->vbq_lock);
1350 1341
1351 videobuf_queue_sg_init(q, &video_vbq_ops, NULL, &vout->vbq_lock, 1342 videobuf_queue_dma_contig_init(q, &video_vbq_ops, q->dev,
1352 vout->type, V4L2_FIELD_NONE, 1343 &vout->vbq_lock, vout->type, V4L2_FIELD_NONE,
1353 sizeof(struct videobuf_buffer), vout); 1344 sizeof(struct videobuf_buffer), vout);
1354 1345
1355 v4l2_dbg(1, debug, &vout->vid_dev->v4l2_dev, "Exiting %s\n", __func__); 1346 v4l2_dbg(1, debug, &vout->vid_dev->v4l2_dev, "Exiting %s\n", __func__);
@@ -1800,7 +1791,6 @@ static int vidioc_reqbufs(struct file *file, void *fh,
1800 unsigned int i, num_buffers = 0; 1791 unsigned int i, num_buffers = 0;
1801 struct omap_vout_device *vout = fh; 1792 struct omap_vout_device *vout = fh;
1802 struct videobuf_queue *q = &vout->vbq; 1793 struct videobuf_queue *q = &vout->vbq;
1803 struct videobuf_dmabuf *dmabuf = NULL;
1804 1794
1805 if ((req->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) || (req->count < 0)) 1795 if ((req->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) || (req->count < 0))
1806 return -EINVAL; 1796 return -EINVAL;
@@ -1826,8 +1816,7 @@ static int vidioc_reqbufs(struct file *file, void *fh,
1826 num_buffers = (vout->vid == OMAP_VIDEO1) ? 1816 num_buffers = (vout->vid == OMAP_VIDEO1) ?
1827 video1_numbuffers : video2_numbuffers; 1817 video1_numbuffers : video2_numbuffers;
1828 for (i = num_buffers; i < vout->buffer_allocated; i++) { 1818 for (i = num_buffers; i < vout->buffer_allocated; i++) {
1829 dmabuf = videobuf_to_dma(q->bufs[i]); 1819 omap_vout_free_buffer(vout->buf_virt_addr[i],
1830 omap_vout_free_buffer((u32)dmabuf->vmalloc,
1831 vout->buffer_size); 1820 vout->buffer_size);
1832 vout->buf_virt_addr[i] = 0; 1821 vout->buf_virt_addr[i] = 0;
1833 vout->buf_phy_addr[i] = 0; 1822 vout->buf_phy_addr[i] = 0;
@@ -1856,12 +1845,7 @@ static int vidioc_reqbufs(struct file *file, void *fh,
1856 goto reqbuf_err; 1845 goto reqbuf_err;
1857 1846
1858 vout->buffer_allocated = req->count; 1847 vout->buffer_allocated = req->count;
1859 for (i = 0; i < req->count; i++) { 1848
1860 dmabuf = videobuf_to_dma(q->bufs[i]);
1861 dmabuf->vmalloc = (void *) vout->buf_virt_addr[i];
1862 dmabuf->bus_addr = (dma_addr_t) vout->buf_phy_addr[i];
1863 dmabuf->sglen = 1;
1864 }
1865reqbuf_err: 1849reqbuf_err:
1866 mutex_unlock(&vout->lock); 1850 mutex_unlock(&vout->lock);
1867 return ret; 1851 return ret;