This source file includes following definitions.
- fimc_lite_active
- fimc_lite_active_queue_add
- fimc_lite_active_queue_pop
- fimc_lite_pending_queue_add
- fimc_lite_pending_queue_pop
1
2
3
4
5
6 #ifndef FIMC_LITE_H_
7 #define FIMC_LITE_H_
8
9 #include <linux/sizes.h>
10 #include <linux/io.h>
11 #include <linux/irqreturn.h>
12 #include <linux/platform_device.h>
13 #include <linux/sched.h>
14 #include <linux/spinlock.h>
15 #include <linux/types.h>
16 #include <linux/videodev2.h>
17
18 #include <media/media-entity.h>
19 #include <media/videobuf2-v4l2.h>
20 #include <media/v4l2-ctrls.h>
21 #include <media/v4l2-device.h>
22 #include <media/v4l2-mediabus.h>
23 #include <media/drv-intf/exynos-fimc.h>
24
25 #define FIMC_LITE_DRV_NAME "exynos-fimc-lite"
26 #define FLITE_CLK_NAME "flite"
27 #define FIMC_LITE_MAX_DEVS 3
28 #define FLITE_REQ_BUFS_MIN 2
29 #define FLITE_DEFAULT_WIDTH 640
30 #define FLITE_DEFAULT_HEIGHT 480
31
32
33 enum {
34 ST_FLITE_LPM,
35 ST_FLITE_PENDING,
36 ST_FLITE_RUN,
37 ST_FLITE_STREAM,
38 ST_FLITE_SUSPENDED,
39 ST_FLITE_OFF,
40 ST_FLITE_IN_USE,
41 ST_FLITE_CONFIG,
42 ST_SENSOR_STREAM,
43 };
44
45 #define FLITE_SD_PAD_SINK 0
46 #define FLITE_SD_PAD_SOURCE_DMA 1
47 #define FLITE_SD_PAD_SOURCE_ISP 2
48 #define FLITE_SD_PADS_NUM 3
49
50
51
52
53
54
55
56
57
58
59
60
61
62 struct flite_drvdata {
63 unsigned short max_width;
64 unsigned short max_height;
65 unsigned short out_width_align;
66 unsigned short win_hor_offs_align;
67 unsigned short out_hor_offs_align;
68 unsigned short max_dma_bufs;
69 unsigned short num_instances;
70 };
71
72 struct fimc_lite_events {
73 unsigned int data_overflow;
74 };
75
76 #define FLITE_MAX_PLANES 1
77
78
79
80
81
82
83
84
85 struct flite_frame {
86 u16 f_width;
87 u16 f_height;
88 struct v4l2_rect rect;
89 const struct fimc_fmt *fmt;
90 };
91
92
93
94
95
96
97
98
99 struct flite_buffer {
100 struct vb2_v4l2_buffer vb;
101 struct list_head list;
102 dma_addr_t paddr;
103 unsigned short index;
104 };
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141 struct fimc_lite {
142 struct platform_device *pdev;
143 struct flite_drvdata *dd;
144 struct exynos_video_entity ve;
145 struct v4l2_device *v4l2_dev;
146 struct v4l2_fh fh;
147 struct v4l2_subdev subdev;
148 struct media_pad vd_pad;
149 struct media_pad subdev_pads[FLITE_SD_PADS_NUM];
150 struct v4l2_subdev *sensor;
151 struct v4l2_ctrl_handler ctrl_handler;
152 struct v4l2_ctrl *test_pattern;
153 int index;
154
155 struct mutex lock;
156 spinlock_t slock;
157
158 struct clk *clock;
159 void __iomem *regs;
160 wait_queue_head_t irq_queue;
161
162 unsigned long payload[FLITE_MAX_PLANES];
163 struct flite_frame inp_frame;
164 struct flite_frame out_frame;
165 atomic_t out_path;
166 unsigned int source_subdev_grp_id;
167
168 unsigned long state;
169 struct list_head pending_buf_q;
170 struct list_head active_buf_q;
171 struct vb2_queue vb_queue;
172 unsigned short buf_index;
173 unsigned int frame_count;
174 unsigned int reqbufs_count;
175
176 struct fimc_lite_events events;
177 bool streaming;
178 };
179
180 static inline bool fimc_lite_active(struct fimc_lite *fimc)
181 {
182 unsigned long flags;
183 bool ret;
184
185 spin_lock_irqsave(&fimc->slock, flags);
186 ret = fimc->state & (1 << ST_FLITE_RUN) ||
187 fimc->state & (1 << ST_FLITE_PENDING);
188 spin_unlock_irqrestore(&fimc->slock, flags);
189 return ret;
190 }
191
192 static inline void fimc_lite_active_queue_add(struct fimc_lite *dev,
193 struct flite_buffer *buf)
194 {
195 list_add_tail(&buf->list, &dev->active_buf_q);
196 }
197
198 static inline struct flite_buffer *fimc_lite_active_queue_pop(
199 struct fimc_lite *dev)
200 {
201 struct flite_buffer *buf = list_entry(dev->active_buf_q.next,
202 struct flite_buffer, list);
203 list_del(&buf->list);
204 return buf;
205 }
206
207 static inline void fimc_lite_pending_queue_add(struct fimc_lite *dev,
208 struct flite_buffer *buf)
209 {
210 list_add_tail(&buf->list, &dev->pending_buf_q);
211 }
212
213 static inline struct flite_buffer *fimc_lite_pending_queue_pop(
214 struct fimc_lite *dev)
215 {
216 struct flite_buffer *buf = list_entry(dev->pending_buf_q.next,
217 struct flite_buffer, list);
218 list_del(&buf->list);
219 return buf;
220 }
221
222 #endif