Merge branch 'msm-next' of git://people.freedesktop.org/~robclark/linux into drm...
[cascardo/linux.git] / drivers / media / platform / vsp1 / vsp1_video.h
1 /*
2  * vsp1_video.h  --  R-Car VSP1 Video Node
3  *
4  * Copyright (C) 2013-2015 Renesas Electronics Corporation
5  *
6  * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  */
13 #ifndef __VSP1_VIDEO_H__
14 #define __VSP1_VIDEO_H__
15
16 #include <linux/list.h>
17 #include <linux/spinlock.h>
18
19 #include <media/videobuf2-v4l2.h>
20
21 #include "vsp1_pipe.h"
22 #include "vsp1_rwpf.h"
23
24 struct vsp1_vb2_buffer {
25         struct vb2_v4l2_buffer buf;
26         struct list_head queue;
27         struct vsp1_rwpf_memory mem;
28 };
29
30 static inline struct vsp1_vb2_buffer *
31 to_vsp1_vb2_buffer(struct vb2_v4l2_buffer *vbuf)
32 {
33         return container_of(vbuf, struct vsp1_vb2_buffer, buf);
34 }
35
36 struct vsp1_video {
37         struct list_head list;
38         struct vsp1_device *vsp1;
39         struct vsp1_rwpf *rwpf;
40
41         struct video_device video;
42         enum v4l2_buf_type type;
43         struct media_pad pad;
44
45         struct mutex lock;
46
47         struct vsp1_pipeline pipe;
48         unsigned int pipe_index;
49
50         struct vb2_queue queue;
51         void *alloc_ctx;
52         spinlock_t irqlock;
53         struct list_head irqqueue;
54         unsigned int sequence;
55 };
56
57 static inline struct vsp1_video *to_vsp1_video(struct video_device *vdev)
58 {
59         return container_of(vdev, struct vsp1_video, video);
60 }
61
62 struct vsp1_video *vsp1_video_create(struct vsp1_device *vsp1,
63                                      struct vsp1_rwpf *rwpf);
64 void vsp1_video_cleanup(struct vsp1_video *video);
65
66 #endif /* __VSP1_VIDEO_H__ */