aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2013-01-03 13:35:57 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-02-13 14:29:41 -0500
commitd899eddde548b9a6d3a59d0600feaab377efcd3f (patch)
treef383cbe45e0b149c14b8714628d684f3012d8044 /drivers/media
parentfd51625d6331c80cd249bd201b012ed5fe4f0476 (diff)
[media] sh_vou: Use vou_dev instead of vou_file wherever possible
This prepares for the removal of vou_file. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/sh_vou.c57
1 files changed, 31 insertions, 26 deletions
diff --git a/drivers/media/platform/sh_vou.c b/drivers/media/platform/sh_vou.c
index e969fea3c122..66c8da18df84 100644
--- a/drivers/media/platform/sh_vou.c
+++ b/drivers/media/platform/sh_vou.c
@@ -254,7 +254,8 @@ static int sh_vou_buf_setup(struct videobuf_queue *vq, unsigned int *count,
254 if (PAGE_ALIGN(*size) * *count > 4 * 1024 * 1024) 254 if (PAGE_ALIGN(*size) * *count > 4 * 1024 * 1024)
255 *count = 4 * 1024 * 1024 / PAGE_ALIGN(*size); 255 *count = 4 * 1024 * 1024 / PAGE_ALIGN(*size);
256 256
257 dev_dbg(vq->dev, "%s(): count=%d, size=%d\n", __func__, *count, *size); 257 dev_dbg(vou_dev->v4l2_dev.dev, "%s(): count=%d, size=%d\n", __func__,
258 *count, *size);
258 259
259 return 0; 260 return 0;
260} 261}
@@ -270,7 +271,7 @@ static int sh_vou_buf_prepare(struct videobuf_queue *vq,
270 int bytes_per_line = vou_fmt[vou_dev->pix_idx].bpp * pix->width / 8; 271 int bytes_per_line = vou_fmt[vou_dev->pix_idx].bpp * pix->width / 8;
271 int ret; 272 int ret;
272 273
273 dev_dbg(vq->dev, "%s()\n", __func__); 274 dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__);
274 275
275 if (vb->width != pix->width || 276 if (vb->width != pix->width ||
276 vb->height != pix->height || 277 vb->height != pix->height ||
@@ -300,7 +301,7 @@ static int sh_vou_buf_prepare(struct videobuf_queue *vq,
300 vb->state = VIDEOBUF_PREPARED; 301 vb->state = VIDEOBUF_PREPARED;
301 } 302 }
302 303
303 dev_dbg(vq->dev, 304 dev_dbg(vou_dev->v4l2_dev.dev,
304 "%s(): fmt #%d, %u bytes per line, phys 0x%x, type %d, state %d\n", 305 "%s(): fmt #%d, %u bytes per line, phys 0x%x, type %d, state %d\n",
305 __func__, vou_dev->pix_idx, bytes_per_line, 306 __func__, vou_dev->pix_idx, bytes_per_line,
306 videobuf_to_dma_contig(vb), vb->memory, vb->state); 307 videobuf_to_dma_contig(vb), vb->memory, vb->state);
@@ -315,7 +316,7 @@ static void sh_vou_buf_queue(struct videobuf_queue *vq,
315 struct video_device *vdev = vq->priv_data; 316 struct video_device *vdev = vq->priv_data;
316 struct sh_vou_device *vou_dev = video_get_drvdata(vdev); 317 struct sh_vou_device *vou_dev = video_get_drvdata(vdev);
317 318
318 dev_dbg(vq->dev, "%s()\n", __func__); 319 dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__);
319 320
320 vb->state = VIDEOBUF_QUEUED; 321 vb->state = VIDEOBUF_QUEUED;
321 list_add_tail(&vb->queue, &vou_dev->queue); 322 list_add_tail(&vb->queue, &vou_dev->queue);
@@ -326,8 +327,8 @@ static void sh_vou_buf_queue(struct videobuf_queue *vq,
326 vou_dev->active = vb; 327 vou_dev->active = vb;
327 /* Start from side A: we use mirror addresses, so, set B */ 328 /* Start from side A: we use mirror addresses, so, set B */
328 sh_vou_reg_a_write(vou_dev, VOURPR, 1); 329 sh_vou_reg_a_write(vou_dev, VOURPR, 1);
329 dev_dbg(vq->dev, "%s: first buffer status 0x%x\n", __func__, 330 dev_dbg(vou_dev->v4l2_dev.dev, "%s: first buffer status 0x%x\n",
330 sh_vou_reg_a_read(vou_dev, VOUSTR)); 331 __func__, sh_vou_reg_a_read(vou_dev, VOUSTR));
331 sh_vou_schedule_next(vou_dev, vb); 332 sh_vou_schedule_next(vou_dev, vb);
332 /* Only activate VOU after the second buffer */ 333 /* Only activate VOU after the second buffer */
333 } else if (vou_dev->active->queue.next == &vb->queue) { 334 } else if (vou_dev->active->queue.next == &vb->queue) {
@@ -337,8 +338,8 @@ static void sh_vou_buf_queue(struct videobuf_queue *vq,
337 338
338 /* Register side switching with frame VSYNC */ 339 /* Register side switching with frame VSYNC */
339 sh_vou_reg_a_write(vou_dev, VOURCR, 5); 340 sh_vou_reg_a_write(vou_dev, VOURCR, 5);
340 dev_dbg(vq->dev, "%s: second buffer status 0x%x\n", __func__, 341 dev_dbg(vou_dev->v4l2_dev.dev, "%s: second buffer status 0x%x\n",
341 sh_vou_reg_a_read(vou_dev, VOUSTR)); 342 __func__, sh_vou_reg_a_read(vou_dev, VOUSTR));
342 343
343 /* Enable End-of-Frame (VSYNC) interrupts */ 344 /* Enable End-of-Frame (VSYNC) interrupts */
344 sh_vou_reg_a_write(vou_dev, VOUIR, 0x10004); 345 sh_vou_reg_a_write(vou_dev, VOUIR, 0x10004);
@@ -356,7 +357,7 @@ static void sh_vou_buf_release(struct videobuf_queue *vq,
356 struct sh_vou_device *vou_dev = video_get_drvdata(vdev); 357 struct sh_vou_device *vou_dev = video_get_drvdata(vdev);
357 unsigned long flags; 358 unsigned long flags;
358 359
359 dev_dbg(vq->dev, "%s()\n", __func__); 360 dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__);
360 361
361 spin_lock_irqsave(&vou_dev->lock, flags); 362 spin_lock_irqsave(&vou_dev->lock, flags);
362 363
@@ -389,9 +390,9 @@ static struct videobuf_queue_ops sh_vou_video_qops = {
389static int sh_vou_querycap(struct file *file, void *priv, 390static int sh_vou_querycap(struct file *file, void *priv,
390 struct v4l2_capability *cap) 391 struct v4l2_capability *cap)
391{ 392{
392 struct sh_vou_file *vou_file = priv; 393 struct sh_vou_device *vou_dev = video_drvdata(file);
393 394
394 dev_dbg(vou_file->vbq.dev, "%s()\n", __func__); 395 dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__);
395 396
396 strlcpy(cap->card, "SuperH VOU", sizeof(cap->card)); 397 strlcpy(cap->card, "SuperH VOU", sizeof(cap->card));
397 cap->capabilities = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING; 398 cap->capabilities = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
@@ -402,12 +403,12 @@ static int sh_vou_querycap(struct file *file, void *priv,
402static int sh_vou_enum_fmt_vid_out(struct file *file, void *priv, 403static int sh_vou_enum_fmt_vid_out(struct file *file, void *priv,
403 struct v4l2_fmtdesc *fmt) 404 struct v4l2_fmtdesc *fmt)
404{ 405{
405 struct sh_vou_file *vou_file = priv; 406 struct sh_vou_device *vou_dev = video_drvdata(file);
406 407
407 if (fmt->index >= ARRAY_SIZE(vou_fmt)) 408 if (fmt->index >= ARRAY_SIZE(vou_fmt))
408 return -EINVAL; 409 return -EINVAL;
409 410
410 dev_dbg(vou_file->vbq.dev, "%s()\n", __func__); 411 dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__);
411 412
412 fmt->type = V4L2_BUF_TYPE_VIDEO_OUTPUT; 413 fmt->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
413 strlcpy(fmt->description, vou_fmt[fmt->index].desc, 414 strlcpy(fmt->description, vou_fmt[fmt->index].desc,
@@ -763,11 +764,11 @@ static int sh_vou_s_fmt_vid_out(struct file *file, void *priv,
763static int sh_vou_try_fmt_vid_out(struct file *file, void *priv, 764static int sh_vou_try_fmt_vid_out(struct file *file, void *priv,
764 struct v4l2_format *fmt) 765 struct v4l2_format *fmt)
765{ 766{
766 struct sh_vou_file *vou_file = priv; 767 struct sh_vou_device *vou_dev = video_drvdata(file);
767 struct v4l2_pix_format *pix = &fmt->fmt.pix; 768 struct v4l2_pix_format *pix = &fmt->fmt.pix;
768 int i; 769 int i;
769 770
770 dev_dbg(vou_file->vbq.dev, "%s()\n", __func__); 771 dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__);
771 772
772 fmt->type = V4L2_BUF_TYPE_VIDEO_OUTPUT; 773 fmt->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
773 pix->field = V4L2_FIELD_NONE; 774 pix->field = V4L2_FIELD_NONE;
@@ -787,9 +788,10 @@ static int sh_vou_try_fmt_vid_out(struct file *file, void *priv,
787static int sh_vou_reqbufs(struct file *file, void *priv, 788static int sh_vou_reqbufs(struct file *file, void *priv,
788 struct v4l2_requestbuffers *req) 789 struct v4l2_requestbuffers *req)
789{ 790{
791 struct sh_vou_device *vou_dev = video_drvdata(file);
790 struct sh_vou_file *vou_file = priv; 792 struct sh_vou_file *vou_file = priv;
791 793
792 dev_dbg(vou_file->vbq.dev, "%s()\n", __func__); 794 dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__);
793 795
794 if (req->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) 796 if (req->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
795 return -EINVAL; 797 return -EINVAL;
@@ -800,27 +802,30 @@ static int sh_vou_reqbufs(struct file *file, void *priv,
800static int sh_vou_querybuf(struct file *file, void *priv, 802static int sh_vou_querybuf(struct file *file, void *priv,
801 struct v4l2_buffer *b) 803 struct v4l2_buffer *b)
802{ 804{
805 struct sh_vou_device *vou_dev = video_drvdata(file);
803 struct sh_vou_file *vou_file = priv; 806 struct sh_vou_file *vou_file = priv;
804 807
805 dev_dbg(vou_file->vbq.dev, "%s()\n", __func__); 808 dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__);
806 809
807 return videobuf_querybuf(&vou_file->vbq, b); 810 return videobuf_querybuf(&vou_file->vbq, b);
808} 811}
809 812
810static int sh_vou_qbuf(struct file *file, void *priv, struct v4l2_buffer *b) 813static int sh_vou_qbuf(struct file *file, void *priv, struct v4l2_buffer *b)
811{ 814{
815 struct sh_vou_device *vou_dev = video_drvdata(file);
812 struct sh_vou_file *vou_file = priv; 816 struct sh_vou_file *vou_file = priv;
813 817
814 dev_dbg(vou_file->vbq.dev, "%s()\n", __func__); 818 dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__);
815 819
816 return videobuf_qbuf(&vou_file->vbq, b); 820 return videobuf_qbuf(&vou_file->vbq, b);
817} 821}
818 822
819static int sh_vou_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) 823static int sh_vou_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b)
820{ 824{
825 struct sh_vou_device *vou_dev = video_drvdata(file);
821 struct sh_vou_file *vou_file = priv; 826 struct sh_vou_file *vou_file = priv;
822 827
823 dev_dbg(vou_file->vbq.dev, "%s()\n", __func__); 828 dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__);
824 829
825 return videobuf_dqbuf(&vou_file->vbq, b, file->f_flags & O_NONBLOCK); 830 return videobuf_dqbuf(&vou_file->vbq, b, file->f_flags & O_NONBLOCK);
826} 831}
@@ -832,7 +837,7 @@ static int sh_vou_streamon(struct file *file, void *priv,
832 struct sh_vou_file *vou_file = priv; 837 struct sh_vou_file *vou_file = priv;
833 int ret; 838 int ret;
834 839
835 dev_dbg(vou_file->vbq.dev, "%s()\n", __func__); 840 dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__);
836 841
837 ret = v4l2_device_call_until_err(&vou_dev->v4l2_dev, 0, 842 ret = v4l2_device_call_until_err(&vou_dev->v4l2_dev, 0,
838 video, s_stream, 1); 843 video, s_stream, 1);
@@ -849,7 +854,7 @@ static int sh_vou_streamoff(struct file *file, void *priv,
849 struct sh_vou_device *vou_dev = video_drvdata(file); 854 struct sh_vou_device *vou_dev = video_drvdata(file);
850 struct sh_vou_file *vou_file = priv; 855 struct sh_vou_file *vou_file = priv;
851 856
852 dev_dbg(vou_file->vbq.dev, "%s()\n", __func__); 857 dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__);
853 858
854 /* 859 /*
855 * This calls buf_release from host driver's videobuf_queue_ops for all 860 * This calls buf_release from host driver's videobuf_queue_ops for all
@@ -1021,9 +1026,9 @@ static int sh_vou_s_crop(struct file *file, void *fh, const struct v4l2_crop *a)
1021static int sh_vou_cropcap(struct file *file, void *priv, 1026static int sh_vou_cropcap(struct file *file, void *priv,
1022 struct v4l2_cropcap *a) 1027 struct v4l2_cropcap *a)
1023{ 1028{
1024 struct sh_vou_file *vou_file = priv; 1029 struct sh_vou_device *vou_dev = video_drvdata(file);
1025 1030
1026 dev_dbg(vou_file->vbq.dev, "%s()\n", __func__); 1031 dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__);
1027 1032
1028 a->type = V4L2_BUF_TYPE_VIDEO_OUTPUT; 1033 a->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
1029 a->bounds.left = 0; 1034 a->bounds.left = 0;
@@ -1197,7 +1202,7 @@ static int sh_vou_release(struct file *file)
1197 struct sh_vou_device *vou_dev = video_drvdata(file); 1202 struct sh_vou_device *vou_dev = video_drvdata(file);
1198 struct sh_vou_file *vou_file = file->private_data; 1203 struct sh_vou_file *vou_file = file->private_data;
1199 1204
1200 dev_dbg(vou_file->vbq.dev, "%s()\n", __func__); 1205 dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__);
1201 1206
1202 if (!atomic_dec_return(&vou_dev->use_count)) { 1207 if (!atomic_dec_return(&vou_dev->use_count)) {
1203 mutex_lock(&vou_dev->fop_lock); 1208 mutex_lock(&vou_dev->fop_lock);
@@ -1220,7 +1225,7 @@ static int sh_vou_mmap(struct file *file, struct vm_area_struct *vma)
1220 struct sh_vou_file *vou_file = file->private_data; 1225 struct sh_vou_file *vou_file = file->private_data;
1221 int ret; 1226 int ret;
1222 1227
1223 dev_dbg(vou_file->vbq.dev, "%s()\n", __func__); 1228 dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__);
1224 1229
1225 if (mutex_lock_interruptible(&vou_dev->fop_lock)) 1230 if (mutex_lock_interruptible(&vou_dev->fop_lock))
1226 return -ERESTARTSYS; 1231 return -ERESTARTSYS;
@@ -1235,7 +1240,7 @@ static unsigned int sh_vou_poll(struct file *file, poll_table *wait)
1235 struct sh_vou_file *vou_file = file->private_data; 1240 struct sh_vou_file *vou_file = file->private_data;
1236 unsigned int res; 1241 unsigned int res;
1237 1242
1238 dev_dbg(vou_file->vbq.dev, "%s()\n", __func__); 1243 dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__);
1239 1244
1240 mutex_lock(&vou_dev->fop_lock); 1245 mutex_lock(&vou_dev->fop_lock);
1241 res = videobuf_poll_stream(file, &vou_file->vbq, wait); 1246 res = videobuf_poll_stream(file, &vou_file->vbq, wait);