1/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * vsp1_video.h  --  R-Car VSP1 Video Node
4 *
5 * Copyright (C) 2013-2015 Renesas Electronics Corporation
6 *
7 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
8 */
9#ifndef __VSP1_VIDEO_H__
10#define __VSP1_VIDEO_H__
11
12#include <linux/list.h>
13#include <linux/spinlock.h>
14
15#include <media/videobuf2-v4l2.h>
16
17#include "vsp1_rwpf.h"
18
19struct vsp1_vb2_buffer {
20	struct vb2_v4l2_buffer buf;
21	struct list_head queue;
22	struct vsp1_rwpf_memory mem;
23};
24
25static inline struct vsp1_vb2_buffer *
26to_vsp1_vb2_buffer(struct vb2_v4l2_buffer *vbuf)
27{
28	return container_of(vbuf, struct vsp1_vb2_buffer, buf);
29}
30
31struct vsp1_video {
32	struct list_head list;
33	struct vsp1_device *vsp1;
34	struct vsp1_rwpf *rwpf;
35
36	struct video_device video;
37	enum v4l2_buf_type type;
38	struct media_pad pad;
39
40	struct mutex lock;
41
42	unsigned int pipe_index;
43
44	struct vb2_queue queue;
45	spinlock_t irqlock;
46	struct list_head irqqueue;
47};
48
49static inline struct vsp1_video *to_vsp1_video(struct video_device *vdev)
50{
51	return container_of(vdev, struct vsp1_video, video);
52}
53
54void vsp1_video_suspend(struct vsp1_device *vsp1);
55void vsp1_video_resume(struct vsp1_device *vsp1);
56
57struct vsp1_video *vsp1_video_create(struct vsp1_device *vsp1,
58				     struct vsp1_rwpf *rwpf);
59void vsp1_video_cleanup(struct vsp1_video *video);
60
61#endif /* __VSP1_VIDEO_H__ */
62