This source file includes following definitions.
- isp_reg_readl
- isp_reg_writel
- isp_reg_clr
- isp_reg_set
- isp_reg_clr_set
- isp_pad_buffer_type
1
2
3
4
5
6
7
8
9
10
11
12
13
14 #ifndef OMAP3_ISP_CORE_H
15 #define OMAP3_ISP_CORE_H
16
17 #include <media/media-entity.h>
18 #include <media/v4l2-async.h>
19 #include <media/v4l2-device.h>
20 #include <linux/clk-provider.h>
21 #include <linux/device.h>
22 #include <linux/io.h>
23 #include <linux/platform_device.h>
24 #include <linux/wait.h>
25
26 #include "omap3isp.h"
27 #include "ispstat.h"
28 #include "ispccdc.h"
29 #include "ispreg.h"
30 #include "ispresizer.h"
31 #include "isppreview.h"
32 #include "ispcsiphy.h"
33 #include "ispcsi2.h"
34 #include "ispccp2.h"
35
36 #define ISP_TOK_TERM 0xFFFFFFFF
37
38
39
40 #define to_isp_device(ptr_module) \
41 container_of(ptr_module, struct isp_device, isp_##ptr_module)
42 #define to_device(ptr_module) \
43 (to_isp_device(ptr_module)->dev)
44
45 enum isp_mem_resources {
46 OMAP3_ISP_IOMEM_MAIN,
47 OMAP3_ISP_IOMEM_CCP2,
48 OMAP3_ISP_IOMEM_CCDC,
49 OMAP3_ISP_IOMEM_HIST,
50 OMAP3_ISP_IOMEM_H3A,
51 OMAP3_ISP_IOMEM_PREV,
52 OMAP3_ISP_IOMEM_RESZ,
53 OMAP3_ISP_IOMEM_SBL,
54 OMAP3_ISP_IOMEM_CSI2A_REGS1,
55 OMAP3_ISP_IOMEM_CSIPHY2,
56 OMAP3_ISP_IOMEM_CSI2A_REGS2,
57 OMAP3_ISP_IOMEM_CSI2C_REGS1,
58 OMAP3_ISP_IOMEM_CSIPHY1,
59 OMAP3_ISP_IOMEM_CSI2C_REGS2,
60 OMAP3_ISP_IOMEM_LAST
61 };
62
63 enum isp_sbl_resource {
64 OMAP3_ISP_SBL_CSI1_READ = 0x1,
65 OMAP3_ISP_SBL_CSI1_WRITE = 0x2,
66 OMAP3_ISP_SBL_CSI2A_WRITE = 0x4,
67 OMAP3_ISP_SBL_CSI2C_WRITE = 0x8,
68 OMAP3_ISP_SBL_CCDC_LSC_READ = 0x10,
69 OMAP3_ISP_SBL_CCDC_WRITE = 0x20,
70 OMAP3_ISP_SBL_PREVIEW_READ = 0x40,
71 OMAP3_ISP_SBL_PREVIEW_WRITE = 0x80,
72 OMAP3_ISP_SBL_RESIZER_READ = 0x100,
73 OMAP3_ISP_SBL_RESIZER_WRITE = 0x200,
74 };
75
76 enum isp_subclk_resource {
77 OMAP3_ISP_SUBCLK_CCDC = (1 << 0),
78 OMAP3_ISP_SUBCLK_AEWB = (1 << 1),
79 OMAP3_ISP_SUBCLK_AF = (1 << 2),
80 OMAP3_ISP_SUBCLK_HIST = (1 << 3),
81 OMAP3_ISP_SUBCLK_PREVIEW = (1 << 4),
82 OMAP3_ISP_SUBCLK_RESIZER = (1 << 5),
83 };
84
85
86 #define ISP_REVISION_1_0 0x10
87
88 #define ISP_REVISION_2_0 0x20
89
90 #define ISP_REVISION_15_0 0xF0
91
92 #define ISP_PHY_TYPE_3430 0
93 #define ISP_PHY_TYPE_3630 1
94
95 struct regmap;
96
97
98
99
100
101
102
103 struct isp_res_mapping {
104 u32 isp_rev;
105 u32 offset[OMAP3_ISP_IOMEM_LAST];
106 u32 phy_type;
107 };
108
109
110
111
112
113
114 struct isp_reg {
115 enum isp_mem_resources mmio_range;
116 u32 reg;
117 u32 val;
118 };
119
120 enum isp_xclk_id {
121 ISP_XCLK_A,
122 ISP_XCLK_B,
123 };
124
125 struct isp_xclk {
126 struct isp_device *isp;
127 struct clk_hw hw;
128 struct clk *clk;
129 enum isp_xclk_id id;
130
131 spinlock_t lock;
132 bool enabled;
133 unsigned int divider;
134 };
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172 struct isp_device {
173 struct v4l2_device v4l2_dev;
174 struct v4l2_async_notifier notifier;
175 struct media_device media_dev;
176 struct device *dev;
177 u32 revision;
178
179
180 unsigned int irq_num;
181
182 void __iomem *mmio_base[OMAP3_ISP_IOMEM_LAST];
183 unsigned long mmio_hist_base_phys;
184 struct regmap *syscon;
185 u32 syscon_offset;
186 u32 phy_type;
187
188 struct dma_iommu_mapping *mapping;
189
190
191 spinlock_t stat_lock;
192 struct mutex isp_mutex;
193 bool stop_failure;
194 struct media_entity_enum crashed;
195 int has_context;
196 int ref_count;
197 unsigned int autoidle;
198 #define ISP_CLK_CAM_ICK 0
199 #define ISP_CLK_CAM_MCLK 1
200 #define ISP_CLK_CSI2_FCK 2
201 #define ISP_CLK_L3_ICK 3
202 struct clk *clock[4];
203 struct isp_xclk xclks[2];
204
205
206 struct ispstat isp_af;
207 struct ispstat isp_aewb;
208 struct ispstat isp_hist;
209 struct isp_res_device isp_res;
210 struct isp_prev_device isp_prev;
211 struct isp_ccdc_device isp_ccdc;
212 struct isp_csi2_device isp_csi2a;
213 struct isp_csi2_device isp_csi2c;
214 struct isp_ccp2_device isp_ccp2;
215 struct isp_csiphy isp_csiphy1;
216 struct isp_csiphy isp_csiphy2;
217
218 unsigned int sbl_resources;
219 unsigned int subclk_resources;
220 };
221
222 struct isp_async_subdev {
223 struct v4l2_async_subdev asd;
224 struct isp_bus_cfg bus;
225 };
226
227 #define v4l2_subdev_to_bus_cfg(sd) \
228 (&container_of((sd)->asd, struct isp_async_subdev, asd)->bus)
229
230 #define v4l2_dev_to_isp_device(dev) \
231 container_of(dev, struct isp_device, v4l2_dev)
232
233 void omap3isp_hist_dma_done(struct isp_device *isp);
234
235 void omap3isp_flush(struct isp_device *isp);
236
237 int omap3isp_module_sync_idle(struct media_entity *me, wait_queue_head_t *wait,
238 atomic_t *stopping);
239
240 int omap3isp_module_sync_is_stopping(wait_queue_head_t *wait,
241 atomic_t *stopping);
242
243 int omap3isp_pipeline_set_stream(struct isp_pipeline *pipe,
244 enum isp_pipeline_stream_state state);
245 void omap3isp_pipeline_cancel_stream(struct isp_pipeline *pipe);
246 void omap3isp_configure_bridge(struct isp_device *isp,
247 enum ccdc_input_entity input,
248 const struct isp_parallel_cfg *buscfg,
249 unsigned int shift, unsigned int bridge);
250
251 struct isp_device *omap3isp_get(struct isp_device *isp);
252 void omap3isp_put(struct isp_device *isp);
253
254 void omap3isp_print_status(struct isp_device *isp);
255
256 void omap3isp_sbl_enable(struct isp_device *isp, enum isp_sbl_resource res);
257 void omap3isp_sbl_disable(struct isp_device *isp, enum isp_sbl_resource res);
258
259 void omap3isp_subclk_enable(struct isp_device *isp,
260 enum isp_subclk_resource res);
261 void omap3isp_subclk_disable(struct isp_device *isp,
262 enum isp_subclk_resource res);
263
264 int omap3isp_register_entities(struct platform_device *pdev,
265 struct v4l2_device *v4l2_dev);
266 void omap3isp_unregister_entities(struct platform_device *pdev);
267
268
269
270
271
272
273
274
275
276 static inline
277 u32 isp_reg_readl(struct isp_device *isp, enum isp_mem_resources isp_mmio_range,
278 u32 reg_offset)
279 {
280 return __raw_readl(isp->mmio_base[isp_mmio_range] + reg_offset);
281 }
282
283
284
285
286
287
288
289
290 static inline
291 void isp_reg_writel(struct isp_device *isp, u32 reg_value,
292 enum isp_mem_resources isp_mmio_range, u32 reg_offset)
293 {
294 __raw_writel(reg_value, isp->mmio_base[isp_mmio_range] + reg_offset);
295 }
296
297
298
299
300
301
302
303
304 static inline
305 void isp_reg_clr(struct isp_device *isp, enum isp_mem_resources mmio_range,
306 u32 reg, u32 clr_bits)
307 {
308 u32 v = isp_reg_readl(isp, mmio_range, reg);
309
310 isp_reg_writel(isp, v & ~clr_bits, mmio_range, reg);
311 }
312
313
314
315
316
317
318
319
320 static inline
321 void isp_reg_set(struct isp_device *isp, enum isp_mem_resources mmio_range,
322 u32 reg, u32 set_bits)
323 {
324 u32 v = isp_reg_readl(isp, mmio_range, reg);
325
326 isp_reg_writel(isp, v | set_bits, mmio_range, reg);
327 }
328
329
330
331
332
333
334
335
336
337
338
339 static inline
340 void isp_reg_clr_set(struct isp_device *isp, enum isp_mem_resources mmio_range,
341 u32 reg, u32 clr_bits, u32 set_bits)
342 {
343 u32 v = isp_reg_readl(isp, mmio_range, reg);
344
345 isp_reg_writel(isp, (v & ~clr_bits) | set_bits, mmio_range, reg);
346 }
347
348 static inline enum v4l2_buf_type
349 isp_pad_buffer_type(const struct v4l2_subdev *subdev, int pad)
350 {
351 if (pad >= subdev->entity.num_pads)
352 return 0;
353
354 if (subdev->entity.pads[pad].flags & MEDIA_PAD_FL_SINK)
355 return V4L2_BUF_TYPE_VIDEO_OUTPUT;
356 else
357 return V4L2_BUF_TYPE_VIDEO_CAPTURE;
358 }
359
360 #endif