xref: /linux/drivers/media/platform/qcom/camss/camss-video.h (revision 249ebf3f65f8530beb2cbfb91bff1d83ba88d23c)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * camss-video.h
4  *
5  * Qualcomm MSM Camera Subsystem - V4L2 device node
6  *
7  * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
8  * Copyright (C) 2015-2018 Linaro Ltd.
9  */
10 #ifndef QC_MSM_CAMSS_VIDEO_H
11 #define QC_MSM_CAMSS_VIDEO_H
12 
13 #include <linux/mutex.h>
14 #include <linux/videodev2.h>
15 #include <media/media-entity.h>
16 #include <media/v4l2-dev.h>
17 #include <media/v4l2-device.h>
18 #include <media/v4l2-fh.h>
19 #include <media/v4l2-mediabus.h>
20 #include <media/videobuf2-v4l2.h>
21 
22 struct camss_buffer {
23 	struct vb2_v4l2_buffer vb;
24 	dma_addr_t addr[3];
25 	struct list_head queue;
26 };
27 
28 struct camss_video;
29 
30 struct camss_video_ops {
31 	int (*queue_buffer)(struct camss_video *vid, struct camss_buffer *buf);
32 	int (*flush_buffers)(struct camss_video *vid,
33 			     enum vb2_buffer_state state);
34 };
35 
36 struct camss_format_info;
37 
38 struct camss_video {
39 	struct camss *camss;
40 	struct vb2_queue vb2_q;
41 	struct video_device vdev;
42 	struct media_pad pad;
43 	struct v4l2_format active_fmt;
44 	enum v4l2_buf_type type;
45 	struct media_pipeline pipe;
46 	const struct camss_video_ops *ops;
47 	struct mutex lock;
48 	struct mutex q_lock;
49 	unsigned int bpl_alignment;
50 	unsigned int line_based;
51 	const struct camss_format_info *formats;
52 	unsigned int nformats;
53 };
54 
55 int msm_video_register(struct camss_video *video, struct v4l2_device *v4l2_dev,
56 		       const char *name, int is_pix);
57 
58 void msm_video_unregister(struct camss_video *video);
59 
60 #endif /* QC_MSM_CAMSS_VIDEO_H */
61