Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / drivers / media / platform / qcom / camss-8x16 / camss-vfe.h
blob53d5b66a9dfbed78d1f1d233dc4418571791e5f2
1 /*
2 * camss-vfe.h
4 * Qualcomm MSM Camera Subsystem - VFE (Video Front End) Module
6 * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
7 * Copyright (C) 2015-2017 Linaro Ltd.
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.
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.
18 #ifndef QC_MSM_CAMSS_VFE_H
19 #define QC_MSM_CAMSS_VFE_H
21 #include <linux/clk.h>
22 #include <linux/spinlock_types.h>
23 #include <media/media-entity.h>
24 #include <media/v4l2-device.h>
25 #include <media/v4l2-subdev.h>
27 #include "camss-video.h"
29 #define MSM_VFE_PAD_SINK 0
30 #define MSM_VFE_PAD_SRC 1
31 #define MSM_VFE_PADS_NUM 2
33 #define MSM_VFE_LINE_NUM 4
34 #define MSM_VFE_IMAGE_MASTERS_NUM 7
35 #define MSM_VFE_COMPOSITE_IRQ_NUM 4
37 #define MSM_VFE_VFE0_UB_SIZE 1023
38 #define MSM_VFE_VFE0_UB_SIZE_RDI (MSM_VFE_VFE0_UB_SIZE / 3)
39 #define MSM_VFE_VFE1_UB_SIZE 1535
40 #define MSM_VFE_VFE1_UB_SIZE_RDI (MSM_VFE_VFE1_UB_SIZE / 3)
42 enum vfe_output_state {
43 VFE_OUTPUT_OFF,
44 VFE_OUTPUT_RESERVED,
45 VFE_OUTPUT_SINGLE,
46 VFE_OUTPUT_CONTINUOUS,
47 VFE_OUTPUT_IDLE,
48 VFE_OUTPUT_STOPPING
51 enum vfe_line_id {
52 VFE_LINE_NONE = -1,
53 VFE_LINE_RDI0 = 0,
54 VFE_LINE_RDI1 = 1,
55 VFE_LINE_RDI2 = 2,
56 VFE_LINE_PIX = 3
59 struct vfe_output {
60 u8 wm_num;
61 u8 wm_idx[3];
63 int active_buf;
64 struct camss_buffer *buf[2];
65 struct camss_buffer *last_buffer;
66 struct list_head pending_bufs;
68 unsigned int drop_update_idx;
70 enum vfe_output_state state;
71 unsigned int sequence;
72 int wait_sof;
73 int wait_reg_update;
74 struct completion sof;
75 struct completion reg_update;
78 struct vfe_line {
79 enum vfe_line_id id;
80 struct v4l2_subdev subdev;
81 struct media_pad pads[MSM_VFE_PADS_NUM];
82 struct v4l2_mbus_framefmt fmt[MSM_VFE_PADS_NUM];
83 struct v4l2_rect compose;
84 struct v4l2_rect crop;
85 struct camss_video video_out;
86 struct vfe_output output;
89 struct vfe_device {
90 u8 id;
91 void __iomem *base;
92 u32 irq;
93 char irq_name[30];
94 struct camss_clock *clock;
95 int nclocks;
96 struct completion reset_complete;
97 struct completion halt_complete;
98 struct mutex power_lock;
99 int power_count;
100 struct mutex stream_lock;
101 int stream_count;
102 spinlock_t output_lock;
103 enum vfe_line_id wm_output_map[MSM_VFE_IMAGE_MASTERS_NUM];
104 struct vfe_line line[MSM_VFE_LINE_NUM];
105 u32 reg_update;
106 u8 was_streaming;
109 struct resources;
111 int msm_vfe_subdev_init(struct vfe_device *vfe, const struct resources *res);
113 int msm_vfe_register_entities(struct vfe_device *vfe,
114 struct v4l2_device *v4l2_dev);
116 void msm_vfe_unregister_entities(struct vfe_device *vfe);
118 void msm_vfe_get_vfe_id(struct media_entity *entity, u8 *id);
119 void msm_vfe_get_vfe_line_id(struct media_entity *entity, enum vfe_line_id *id);
121 void msm_vfe_stop_streaming(struct vfe_device *vfe);
123 #endif /* QC_MSM_CAMSS_VFE_H */