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