These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / media / usb / go7007 / go7007-v4l2.c
index d6bf982..f3d187d 100644 (file)
@@ -52,7 +52,7 @@ static bool valid_pixelformat(u32 pixelformat)
 
 static u32 get_frame_type_flag(struct go7007_buffer *vb, int format)
 {
-       u8 *ptr = vb2_plane_vaddr(&vb->vb, 0);
+       u8 *ptr = vb2_plane_vaddr(&vb->vb.vb2_buf, 0);
 
        switch (format) {
        case V4L2_PIX_FMT_MJPEG:
@@ -250,15 +250,17 @@ static int set_capture_size(struct go7007 *go, struct v4l2_format *fmt, int try)
        go->encoder_v_offset = go->board_info->sensor_v_offset;
 
        if (go->board_info->sensor_flags & GO7007_SENSOR_SCALING) {
-               struct v4l2_mbus_framefmt mbus_fmt;
+               struct v4l2_subdev_format format = {
+                       .which = V4L2_SUBDEV_FORMAT_ACTIVE,
+               };
 
-               mbus_fmt.code = MEDIA_BUS_FMT_FIXED;
-               mbus_fmt.width = fmt ? fmt->fmt.pix.width : width;
-               mbus_fmt.height = height;
+               format.format.code = MEDIA_BUS_FMT_FIXED;
+               format.format.width = fmt ? fmt->fmt.pix.width : width;
+               format.format.height = height;
                go->encoder_h_halve = 0;
                go->encoder_v_halve = 0;
                go->encoder_subsample = 0;
-               call_all(&go->v4l2_dev, video, s_mbus_fmt, &mbus_fmt);
+               call_all(&go->v4l2_dev, pad, set_fmt, NULL, &format);
        } else {
                if (width <= sensor_width / 4) {
                        go->encoder_h_halve = 1;
@@ -367,7 +369,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
 }
 
 static int go7007_queue_setup(struct vb2_queue *q,
-               const struct v4l2_format *fmt,
+               const void *parg,
                unsigned int *num_buffers, unsigned int *num_planes,
                unsigned int sizes[], void *alloc_ctxs[])
 {
@@ -384,8 +386,9 @@ static void go7007_buf_queue(struct vb2_buffer *vb)
 {
        struct vb2_queue *vq = vb->vb2_queue;
        struct go7007 *go = vb2_get_drv_priv(vq);
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct go7007_buffer *go7007_vb =
-               container_of(vb, struct go7007_buffer, vb);
+               container_of(vbuf, struct go7007_buffer, vb);
        unsigned long flags;
 
        spin_lock_irqsave(&go->spinlock, flags);
@@ -395,12 +398,13 @@ static void go7007_buf_queue(struct vb2_buffer *vb)
 
 static int go7007_buf_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct go7007_buffer *go7007_vb =
-               container_of(vb, struct go7007_buffer, vb);
+               container_of(vbuf, struct go7007_buffer, vb);
 
        go7007_vb->modet_active = 0;
        go7007_vb->frame_offset = 0;
-       vb->v4l2_planes[0].bytesused = 0;
+       vb->planes[0].bytesused = 0;
        return 0;
 }
 
@@ -408,15 +412,15 @@ static void go7007_buf_finish(struct vb2_buffer *vb)
 {
        struct vb2_queue *vq = vb->vb2_queue;
        struct go7007 *go = vb2_get_drv_priv(vq);
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct go7007_buffer *go7007_vb =
-               container_of(vb, struct go7007_buffer, vb);
+               container_of(vbuf, struct go7007_buffer, vb);
        u32 frame_type_flag = get_frame_type_flag(go7007_vb, go->format);
-       struct v4l2_buffer *buf = &vb->v4l2_buf;
 
-       buf->flags &= ~(V4L2_BUF_FLAG_KEYFRAME | V4L2_BUF_FLAG_BFRAME |
+       vbuf->flags &= ~(V4L2_BUF_FLAG_KEYFRAME | V4L2_BUF_FLAG_BFRAME |
                        V4L2_BUF_FLAG_PFRAME);
-       buf->flags |= frame_type_flag;
-       buf->field = V4L2_FIELD_NONE;
+       vbuf->flags |= frame_type_flag;
+       vbuf->field = V4L2_FIELD_NONE;
 }
 
 static int go7007_start_streaming(struct vb2_queue *q, unsigned int count)