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 {
46 VFE_OUTPUT_CONTINUOUS,
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;
74 struct completion sof;
75 struct completion reg_update;
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;
94 struct camss_clock *clock;
96 struct completion reset_complete;
97 struct completion halt_complete;
98 struct mutex power_lock;
100 struct mutex stream_lock;
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];
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 */