aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/omap/omap_vout.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-08-03 20:26:03 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-08-03 20:26:03 -0400
commit412a4ac5e9cf7fdeb6af562c25547a9b9da7674f (patch)
treea8ce13cbc9c47c99799e5e3e3ad26ba78274ee73 /drivers/media/video/omap/omap_vout.c
parente8e5c2155b0035b6e04f29be67f6444bc914005b (diff)
parent0c2daaafcdec726e89cbccca61d576de8429c537 (diff)
Merge commit 'gcl/next' into next
Diffstat (limited to 'drivers/media/video/omap/omap_vout.c')
-rw-r--r--drivers/media/video/omap/omap_vout.c81
1 files changed, 34 insertions, 47 deletions
diff --git a/drivers/media/video/omap/omap_vout.c b/drivers/media/video/omap/omap_vout.c
index e7db0554949a..929073e792c9 100644
--- a/drivers/media/video/omap/omap_vout.c
+++ b/drivers/media/video/omap/omap_vout.c
@@ -38,8 +38,9 @@
38#include <linux/dma-mapping.h> 38#include <linux/dma-mapping.h>
39#include <linux/irq.h> 39#include <linux/irq.h>
40#include <linux/videodev2.h> 40#include <linux/videodev2.h>
41#include <linux/slab.h>
41 42
42#include <media/videobuf-dma-sg.h> 43#include <media/videobuf-dma-contig.h>
43#include <media/v4l2-device.h> 44#include <media/v4l2-device.h>
44#include <media/v4l2-ioctl.h> 45#include <media/v4l2-ioctl.h>
45 46
@@ -1053,9 +1054,9 @@ static int omap_vout_buffer_prepare(struct videobuf_queue *q,
1053 struct videobuf_buffer *vb, 1054 struct videobuf_buffer *vb,
1054 enum v4l2_field field) 1055 enum v4l2_field field)
1055{ 1056{
1057 dma_addr_t dmabuf;
1056 struct vid_vrfb_dma *tx; 1058 struct vid_vrfb_dma *tx;
1057 enum dss_rotation rotation; 1059 enum dss_rotation rotation;
1058 struct videobuf_dmabuf *dmabuf = NULL;
1059 struct omap_vout_device *vout = q->priv_data; 1060 struct omap_vout_device *vout = q->priv_data;
1060 u32 dest_frame_index = 0, src_element_index = 0; 1061 u32 dest_frame_index = 0, src_element_index = 0;
1061 u32 dest_element_index = 0, src_frame_index = 0; 1062 u32 dest_element_index = 0, src_frame_index = 0;
@@ -1074,24 +1075,17 @@ static int omap_vout_buffer_prepare(struct videobuf_queue *q,
1074 if (V4L2_MEMORY_USERPTR == vb->memory) { 1075 if (V4L2_MEMORY_USERPTR == vb->memory) {
1075 if (0 == vb->baddr) 1076 if (0 == vb->baddr)
1076 return -EINVAL; 1077 return -EINVAL;
1077 /* Virtual address */
1078 /* priv points to struct videobuf_pci_sg_memory. But we went
1079 * pointer to videobuf_dmabuf, which is member of
1080 * videobuf_pci_sg_memory */
1081 dmabuf = videobuf_to_dma(q->bufs[vb->i]);
1082 dmabuf->vmalloc = (void *) vb->baddr;
1083
1084 /* Physical address */ 1078 /* Physical address */
1085 dmabuf->bus_addr = 1079 vout->queued_buf_addr[vb->i] = (u8 *)
1086 (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];
1087 } 1083 }
1088 1084
1089 if (!rotation_enabled(vout)) { 1085 if (!rotation_enabled(vout))
1090 dmabuf = videobuf_to_dma(q->bufs[vb->i]);
1091 vout->queued_buf_addr[vb->i] = (u8 *) dmabuf->bus_addr;
1092 return 0; 1086 return 0;
1093 } 1087
1094 dmabuf = videobuf_to_dma(q->bufs[vb->i]); 1088 dmabuf = vout->buf_phy_addr[vb->i];
1095 /* If rotation is enabled, copy input buffer into VRFB 1089 /* If rotation is enabled, copy input buffer into VRFB
1096 * memory space using DMA. We are copying input buffer 1090 * memory space using DMA. We are copying input buffer
1097 * into VRFB memory space of desired angle and DSS will 1091 * into VRFB memory space of desired angle and DSS will
@@ -1120,7 +1114,7 @@ static int omap_vout_buffer_prepare(struct videobuf_queue *q,
1120 tx->dev_id, 0x0); 1114 tx->dev_id, 0x0);
1121 /* src_port required only for OMAP1 */ 1115 /* src_port required only for OMAP1 */
1122 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,
1123 dmabuf->bus_addr, src_element_index, src_frame_index); 1117 dmabuf, src_element_index, src_frame_index);
1124 /*set dma source burst mode for VRFB */ 1118 /*set dma source burst mode for VRFB */
1125 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);
1126 rotation = calc_rotation(vout); 1120 rotation = calc_rotation(vout);
@@ -1211,7 +1205,6 @@ static int omap_vout_mmap(struct file *file, struct vm_area_struct *vma)
1211 void *pos; 1205 void *pos;
1212 unsigned long start = vma->vm_start; 1206 unsigned long start = vma->vm_start;
1213 unsigned long size = (vma->vm_end - vma->vm_start); 1207 unsigned long size = (vma->vm_end - vma->vm_start);
1214 struct videobuf_dmabuf *dmabuf = NULL;
1215 struct omap_vout_device *vout = file->private_data; 1208 struct omap_vout_device *vout = file->private_data;
1216 struct videobuf_queue *q = &vout->vbq; 1209 struct videobuf_queue *q = &vout->vbq;
1217 1210
@@ -1241,8 +1234,7 @@ static int omap_vout_mmap(struct file *file, struct vm_area_struct *vma)
1241 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); 1234 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
1242 vma->vm_ops = &omap_vout_vm_ops; 1235 vma->vm_ops = &omap_vout_vm_ops;
1243 vma->vm_private_data = (void *) vout; 1236 vma->vm_private_data = (void *) vout;
1244 dmabuf = videobuf_to_dma(q->bufs[i]); 1237 pos = (void *)vout->buf_virt_addr[i];
1245 pos = dmabuf->vmalloc;
1246 vma->vm_pgoff = virt_to_phys((void *)pos) >> PAGE_SHIFT; 1238 vma->vm_pgoff = virt_to_phys((void *)pos) >> PAGE_SHIFT;
1247 while (size > 0) { 1239 while (size > 0) {
1248 unsigned long pfn; 1240 unsigned long pfn;
@@ -1347,8 +1339,8 @@ static int omap_vout_open(struct file *file)
1347 video_vbq_ops.buf_queue = omap_vout_buffer_queue; 1339 video_vbq_ops.buf_queue = omap_vout_buffer_queue;
1348 spin_lock_init(&vout->vbq_lock); 1340 spin_lock_init(&vout->vbq_lock);
1349 1341
1350 videobuf_queue_sg_init(q, &video_vbq_ops, NULL, &vout->vbq_lock, 1342 videobuf_queue_dma_contig_init(q, &video_vbq_ops, q->dev,
1351 vout->type, V4L2_FIELD_NONE, 1343 &vout->vbq_lock, vout->type, V4L2_FIELD_NONE,
1352 sizeof(struct videobuf_buffer), vout); 1344 sizeof(struct videobuf_buffer), vout);
1353 1345
1354 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__);
@@ -1799,7 +1791,6 @@ static int vidioc_reqbufs(struct file *file, void *fh,
1799 unsigned int i, num_buffers = 0; 1791 unsigned int i, num_buffers = 0;
1800 struct omap_vout_device *vout = fh; 1792 struct omap_vout_device *vout = fh;
1801 struct videobuf_queue *q = &vout->vbq; 1793 struct videobuf_queue *q = &vout->vbq;
1802 struct videobuf_dmabuf *dmabuf = NULL;
1803 1794
1804 if ((req->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) || (req->count < 0)) 1795 if ((req->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) || (req->count < 0))
1805 return -EINVAL; 1796 return -EINVAL;
@@ -1825,8 +1816,7 @@ static int vidioc_reqbufs(struct file *file, void *fh,
1825 num_buffers = (vout->vid == OMAP_VIDEO1) ? 1816 num_buffers = (vout->vid == OMAP_VIDEO1) ?
1826 video1_numbuffers : video2_numbuffers; 1817 video1_numbuffers : video2_numbuffers;
1827 for (i = num_buffers; i < vout->buffer_allocated; i++) { 1818 for (i = num_buffers; i < vout->buffer_allocated; i++) {
1828 dmabuf = videobuf_to_dma(q->bufs[i]); 1819 omap_vout_free_buffer(vout->buf_virt_addr[i],
1829 omap_vout_free_buffer((u32)dmabuf->vmalloc,
1830 vout->buffer_size); 1820 vout->buffer_size);
1831 vout->buf_virt_addr[i] = 0; 1821 vout->buf_virt_addr[i] = 0;
1832 vout->buf_phy_addr[i] = 0; 1822 vout->buf_phy_addr[i] = 0;
@@ -1855,12 +1845,7 @@ static int vidioc_reqbufs(struct file *file, void *fh,
1855 goto reqbuf_err; 1845 goto reqbuf_err;
1856 1846
1857 vout->buffer_allocated = req->count; 1847 vout->buffer_allocated = req->count;
1858 for (i = 0; i < req->count; i++) { 1848
1859 dmabuf = videobuf_to_dma(q->bufs[i]);
1860 dmabuf->vmalloc = (void *) vout->buf_virt_addr[i];
1861 dmabuf->bus_addr = (dma_addr_t) vout->buf_phy_addr[i];
1862 dmabuf->sglen = 1;
1863 }
1864reqbuf_err: 1849reqbuf_err:
1865 mutex_unlock(&vout->lock); 1850 mutex_unlock(&vout->lock);
1866 return ret; 1851 return ret;
@@ -2488,7 +2473,7 @@ static int omap_vout_remove(struct platform_device *pdev)
2488 2473
2489 for (k = 0; k < vid_dev->num_displays; k++) { 2474 for (k = 0; k < vid_dev->num_displays; k++) {
2490 if (vid_dev->displays[k]->state != OMAP_DSS_DISPLAY_DISABLED) 2475 if (vid_dev->displays[k]->state != OMAP_DSS_DISPLAY_DISABLED)
2491 vid_dev->displays[k]->disable(vid_dev->displays[k]); 2476 vid_dev->displays[k]->driver->disable(vid_dev->displays[k]);
2492 2477
2493 omap_dss_put_device(vid_dev->displays[k]); 2478 omap_dss_put_device(vid_dev->displays[k]);
2494 } 2479 }
@@ -2545,7 +2530,9 @@ static int __init omap_vout_probe(struct platform_device *pdev)
2545 def_display = NULL; 2530 def_display = NULL;
2546 } 2531 }
2547 if (def_display) { 2532 if (def_display) {
2548 ret = def_display->enable(def_display); 2533 struct omap_dss_driver *dssdrv = def_display->driver;
2534
2535 ret = dssdrv->enable(def_display);
2549 if (ret) { 2536 if (ret) {
2550 /* Here we are not considering a error 2537 /* Here we are not considering a error
2551 * as display may be enabled by frame 2538 * as display may be enabled by frame
@@ -2559,21 +2546,21 @@ static int __init omap_vout_probe(struct platform_device *pdev)
2559 if (def_display->caps & 2546 if (def_display->caps &
2560 OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE) { 2547 OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE) {
2561#ifdef CONFIG_FB_OMAP2_FORCE_AUTO_UPDATE 2548#ifdef CONFIG_FB_OMAP2_FORCE_AUTO_UPDATE
2562 if (def_display->enable_te) 2549 if (dssdrv->enable_te)
2563 def_display->enable_te(def_display, 1); 2550 dssdrv->enable_te(def_display, 1);
2564 if (def_display->set_update_mode) 2551 if (dssdrv->set_update_mode)
2565 def_display->set_update_mode(def_display, 2552 dssdrv->set_update_mode(def_display,
2566 OMAP_DSS_UPDATE_AUTO); 2553 OMAP_DSS_UPDATE_AUTO);
2567#else /* MANUAL_UPDATE */ 2554#else /* MANUAL_UPDATE */
2568 if (def_display->enable_te) 2555 if (dssdrv->enable_te)
2569 def_display->enable_te(def_display, 0); 2556 dssdrv->enable_te(def_display, 0);
2570 if (def_display->set_update_mode) 2557 if (dssdrv->set_update_mode)
2571 def_display->set_update_mode(def_display, 2558 dssdrv->set_update_mode(def_display,
2572 OMAP_DSS_UPDATE_MANUAL); 2559 OMAP_DSS_UPDATE_MANUAL);
2573#endif 2560#endif
2574 } else { 2561 } else {
2575 if (def_display->set_update_mode) 2562 if (dssdrv->set_update_mode)
2576 def_display->set_update_mode(def_display, 2563 dssdrv->set_update_mode(def_display,
2577 OMAP_DSS_UPDATE_AUTO); 2564 OMAP_DSS_UPDATE_AUTO);
2578 } 2565 }
2579 } 2566 }
@@ -2592,8 +2579,8 @@ static int __init omap_vout_probe(struct platform_device *pdev)
2592 for (i = 0; i < vid_dev->num_displays; i++) { 2579 for (i = 0; i < vid_dev->num_displays; i++) {
2593 struct omap_dss_device *display = vid_dev->displays[i]; 2580 struct omap_dss_device *display = vid_dev->displays[i];
2594 2581
2595 if (display->update) 2582 if (display->driver->update)
2596 display->update(display, 0, 0, 2583 display->driver->update(display, 0, 0,
2597 display->panel.timings.x_res, 2584 display->panel.timings.x_res,
2598 display->panel.timings.y_res); 2585 display->panel.timings.y_res);
2599 } 2586 }
@@ -2608,8 +2595,8 @@ probe_err1:
2608 if (ovl->manager && ovl->manager->device) 2595 if (ovl->manager && ovl->manager->device)
2609 def_display = ovl->manager->device; 2596 def_display = ovl->manager->device;
2610 2597
2611 if (def_display) 2598 if (def_display && def_display->driver)
2612 def_display->disable(def_display); 2599 def_display->driver->disable(def_display);
2613 } 2600 }
2614probe_err0: 2601probe_err0:
2615 kfree(vid_dev); 2602 kfree(vid_dev);