]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/media/platform/marvell-ccic/mcam-core.c
Merge remote-tracking branch 'v4l-dvb/master'
[karo-tx-linux.git] / drivers / media / platform / marvell-ccic / mcam-core.c
index 5e2b4df48b3c93ee7ce89c4bcb08cc2000660358..aa2b44041d3fac40f6d2242c566032ec074d7338 100644 (file)
@@ -201,18 +201,18 @@ struct mcam_dma_desc {
 
 /*
  * Our buffer type for working with videobuf2.  Note that the vb2
- * developers have decreed that struct vb2_buffer must be at the
+ * developers have decreed that struct vb2_v4l2_buffer must be at the
  * beginning of this structure.
  */
 struct mcam_vb_buffer {
-       struct vb2_buffer vb_buf;
+       struct vb2_v4l2_buffer vb_buf;
        struct list_head queue;
        struct mcam_dma_desc *dma_desc; /* Descriptor virtual address */
        dma_addr_t dma_desc_pa;         /* Descriptor physical address */
        int dma_desc_nent;              /* Number of mapped descriptors */
 };
 
-static inline struct mcam_vb_buffer *vb_to_mvb(struct vb2_buffer *vb)
+static inline struct mcam_vb_buffer *vb_to_mvb(struct vb2_v4l2_buffer *vb)
 {
        return container_of(vb, struct mcam_vb_buffer, vb_buf);
 }
@@ -221,14 +221,14 @@ static inline struct mcam_vb_buffer *vb_to_mvb(struct vb2_buffer *vb)
  * Hand a completed buffer back to user space.
  */
 static void mcam_buffer_done(struct mcam_camera *cam, int frame,
-               struct vb2_buffer *vbuf)
+               struct vb2_v4l2_buffer *vbuf)
 {
-       vbuf->v4l2_buf.bytesused = cam->pix_format.sizeimage;
-       vbuf->v4l2_buf.sequence = cam->buf_seq[frame];
-       vbuf->v4l2_buf.field = V4L2_FIELD_NONE;
-       v4l2_get_timestamp(&vbuf->v4l2_buf.timestamp);
-       vb2_set_plane_payload(vbuf, 0, cam->pix_format.sizeimage);
-       vb2_buffer_done(vbuf, VB2_BUF_STATE_DONE);
+       vbuf->vb2_buf.planes[0].bytesused = cam->pix_format.sizeimage;
+       vbuf->sequence = cam->buf_seq[frame];
+       vbuf->field = V4L2_FIELD_NONE;
+       v4l2_get_timestamp(&vbuf->timestamp);
+       vb2_set_plane_payload(&vbuf->vb2_buf, 0, cam->pix_format.sizeimage);
+       vb2_buffer_done(&vbuf->vb2_buf, VB2_BUF_STATE_DONE);
 }
 
 
@@ -482,7 +482,8 @@ static void mcam_frame_tasklet(unsigned long data)
                 * Drop the lock during the big copy.  This *should* be safe...
                 */
                spin_unlock_irqrestore(&cam->dev_lock, flags);
-               memcpy(vb2_plane_vaddr(&buf->vb_buf, 0), cam->dma_bufs[bufno],
+               memcpy(vb2_plane_vaddr(&buf->vb_buf.vb2_buf, 0),
+                               cam->dma_bufs[bufno],
                                cam->pix_format.sizeimage);
                mcam_buffer_done(cam, bufno, &buf->vb_buf);
                spin_lock_irqsave(&cam->dev_lock, flags);
@@ -548,7 +549,7 @@ static void mcam_set_contig_buffer(struct mcam_camera *cam, int frame)
 {
        struct mcam_vb_buffer *buf;
        dma_addr_t dma_handle;
-       struct vb2_buffer *vb;
+       struct vb2_v4l2_buffer *vb;
 
        /*
         * If there are no available buffers, go into single mode
@@ -570,7 +571,7 @@ static void mcam_set_contig_buffer(struct mcam_camera *cam, int frame)
        cam->vb_bufs[frame] = buf;
        vb = &buf->vb_buf;
 
-       dma_handle = vb2_dma_contig_plane_dma_addr(vb, 0);
+       dma_handle = vb2_dma_contig_plane_dma_addr(&vb->vb2_buf, 0);
        mcam_write_yuv_bases(cam, frame, dma_handle);
 }
 
@@ -1048,10 +1049,11 @@ static int mcam_read_setup(struct mcam_camera *cam)
  */
 
 static int mcam_vb_queue_setup(struct vb2_queue *vq,
-               const struct v4l2_format *fmt, unsigned int *nbufs,
+               const void *parg, unsigned int *nbufs,
                unsigned int *num_planes, unsigned int sizes[],
                void *alloc_ctxs[])
 {
+       const struct v4l2_format *fmt = parg;
        struct mcam_camera *cam = vb2_get_drv_priv(vq);
        int minbufs = (cam->buffer_mode == B_DMA_contig) ? 3 : 2;
 
@@ -1071,7 +1073,8 @@ static int mcam_vb_queue_setup(struct vb2_queue *vq,
 
 static void mcam_vb_buf_queue(struct vb2_buffer *vb)
 {
-       struct mcam_vb_buffer *mvb = vb_to_mvb(vb);
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+       struct mcam_vb_buffer *mvb = vb_to_mvb(vbuf);
        struct mcam_camera *cam = vb2_get_drv_priv(vb->vb2_queue);
        unsigned long flags;
        int start;
@@ -1096,14 +1099,14 @@ static void mcam_vb_requeue_bufs(struct vb2_queue *vq,
 
        spin_lock_irqsave(&cam->dev_lock, flags);
        list_for_each_entry_safe(buf, node, &cam->buffers, queue) {
-               vb2_buffer_done(&buf->vb_buf, state);
+               vb2_buffer_done(&buf->vb_buf.vb2_buf, state);
                list_del(&buf->queue);
        }
        for (i = 0; i < MAX_DMA_BUFS; i++) {
                buf = cam->vb_bufs[i];
 
                if (buf) {
-                       vb2_buffer_done(&buf->vb_buf, state);
+                       vb2_buffer_done(&buf->vb_buf.vb2_buf, state);
                        cam->vb_bufs[i] = NULL;
                }
        }
@@ -1198,7 +1201,8 @@ static const struct vb2_ops mcam_vb2_ops = {
  */
 static int mcam_vb_sg_buf_init(struct vb2_buffer *vb)
 {
-       struct mcam_vb_buffer *mvb = vb_to_mvb(vb);
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+       struct mcam_vb_buffer *mvb = vb_to_mvb(vbuf);
        struct mcam_camera *cam = vb2_get_drv_priv(vb->vb2_queue);
        int ndesc = cam->pix_format.sizeimage/PAGE_SIZE + 1;
 
@@ -1214,7 +1218,8 @@ static int mcam_vb_sg_buf_init(struct vb2_buffer *vb)
 
 static int mcam_vb_sg_buf_prepare(struct vb2_buffer *vb)
 {
-       struct mcam_vb_buffer *mvb = vb_to_mvb(vb);
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+       struct mcam_vb_buffer *mvb = vb_to_mvb(vbuf);
        struct sg_table *sg_table = vb2_dma_sg_plane_desc(vb, 0);
        struct mcam_dma_desc *desc = mvb->dma_desc;
        struct scatterlist *sg;
@@ -1230,8 +1235,9 @@ static int mcam_vb_sg_buf_prepare(struct vb2_buffer *vb)
 
 static void mcam_vb_sg_buf_cleanup(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct mcam_camera *cam = vb2_get_drv_priv(vb->vb2_queue);
-       struct mcam_vb_buffer *mvb = vb_to_mvb(vb);
+       struct mcam_vb_buffer *mvb = vb_to_mvb(vbuf);
        int ndesc = cam->pix_format.sizeimage/PAGE_SIZE + 1;
 
        dma_free_coherent(cam->dev, ndesc * sizeof(struct mcam_dma_desc),