GNU Linux-libre 4.14.266-gnu1
[releases.git] / drivers / media / platform / qcom / camss-8x16 / camss-video.h
1 /*
2  * camss-video.h
3  *
4  * Qualcomm MSM Camera Subsystem - V4L2 device node
5  *
6  * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
7  * Copyright (C) 2015-2017 Linaro Ltd.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License version 2 and
11  * only version 2 as published by the Free Software Foundation.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  */
18 #ifndef QC_MSM_CAMSS_VIDEO_H
19 #define QC_MSM_CAMSS_VIDEO_H
20
21 #include <linux/mutex.h>
22 #include <linux/videodev2.h>
23 #include <media/media-entity.h>
24 #include <media/v4l2-dev.h>
25 #include <media/v4l2-device.h>
26 #include <media/v4l2-fh.h>
27 #include <media/v4l2-mediabus.h>
28 #include <media/videobuf2-v4l2.h>
29
30 struct camss_buffer {
31         struct vb2_v4l2_buffer vb;
32         dma_addr_t addr[3];
33         struct list_head queue;
34 };
35
36 struct camss_video;
37
38 struct camss_video_ops {
39         int (*queue_buffer)(struct camss_video *vid, struct camss_buffer *buf);
40         int (*flush_buffers)(struct camss_video *vid,
41                              enum vb2_buffer_state state);
42 };
43
44 struct camss_format_info;
45
46 struct camss_video {
47         struct camss *camss;
48         struct vb2_queue vb2_q;
49         struct video_device vdev;
50         struct media_pad pad;
51         struct v4l2_format active_fmt;
52         enum v4l2_buf_type type;
53         struct media_pipeline pipe;
54         const struct camss_video_ops *ops;
55         struct mutex lock;
56         struct mutex q_lock;
57         unsigned int bpl_alignment;
58         unsigned int line_based;
59         const struct camss_format_info *formats;
60         unsigned int nformats;
61 };
62
63 void msm_video_stop_streaming(struct camss_video *video);
64
65 int msm_video_register(struct camss_video *video, struct v4l2_device *v4l2_dev,
66                        const char *name, int is_pix);
67
68 void msm_video_unregister(struct camss_video *video);
69
70 #endif /* QC_MSM_CAMSS_VIDEO_H */