| .. | .. |
|---|
| 35 | 35 | #ifndef _RKISP_PATH_VIDEO_H |
|---|
| 36 | 36 | #define _RKISP_PATH_VIDEO_H |
|---|
| 37 | 37 | |
|---|
| 38 | +#include <linux/interrupt.h> |
|---|
| 39 | + |
|---|
| 38 | 40 | #include "common.h" |
|---|
| 39 | 41 | #include "capture_v1x.h" |
|---|
| 40 | 42 | #include "capture_v2x.h" |
|---|
| 43 | +#include "capture_v3x.h" |
|---|
| 41 | 44 | #include "isp_ispp.h" |
|---|
| 42 | 45 | |
|---|
| 43 | | -#define RDBK_MAX 3 |
|---|
| 44 | | -#define RDBK_L 0 |
|---|
| 45 | | -#define RDBK_M 1 |
|---|
| 46 | | -#define RDBK_S 2 |
|---|
| 46 | +#define SP_VDEV_NAME DRIVER_NAME "_selfpath" |
|---|
| 47 | +#define MP_VDEV_NAME DRIVER_NAME "_mainpath" |
|---|
| 48 | +#define FBC_VDEV_NAME DRIVER_NAME "_fbcpath" |
|---|
| 49 | +#define BP_VDEV_NAME DRIVER_NAME "_bypasspath" |
|---|
| 50 | +#define MPDS_VDEV_NAME DRIVER_NAME "_mainpath_4x4sampling" |
|---|
| 51 | +#define BPDS_VDEV_NAME DRIVER_NAME "_bypasspath_4x4sampling" |
|---|
| 52 | +#define LUMA_VDEV_NAME DRIVER_NAME "_lumapath" |
|---|
| 53 | +#define VIR_VDEV_NAME DRIVER_NAME "_iqtool" |
|---|
| 54 | + |
|---|
| 55 | +#define DMATX0_VDEV_NAME DRIVER_NAME "_rawwr0" |
|---|
| 56 | +#define DMATX1_VDEV_NAME DRIVER_NAME "_rawwr1" |
|---|
| 57 | +#define DMATX2_VDEV_NAME DRIVER_NAME "_rawwr2" |
|---|
| 58 | +#define DMATX3_VDEV_NAME DRIVER_NAME "_rawwr3" |
|---|
| 47 | 59 | |
|---|
| 48 | 60 | struct rkisp_stream; |
|---|
| 61 | + |
|---|
| 62 | +enum { |
|---|
| 63 | + ROCKIT_DVBM_END, |
|---|
| 64 | + ROCKIT_DVBM_START, |
|---|
| 65 | +}; |
|---|
| 66 | + |
|---|
| 67 | +enum { |
|---|
| 68 | + RDBK_L, |
|---|
| 69 | + RDBK_M, |
|---|
| 70 | + RDBK_S, |
|---|
| 71 | + RDBK_MAX, |
|---|
| 72 | +}; |
|---|
| 73 | + |
|---|
| 74 | +enum { |
|---|
| 75 | + RKISP_STREAM_MP, |
|---|
| 76 | + RKISP_STREAM_SP, |
|---|
| 77 | + RKISP_STREAM_DMATX0, |
|---|
| 78 | + RKISP_STREAM_DMATX1, |
|---|
| 79 | + RKISP_STREAM_DMATX2, |
|---|
| 80 | + RKISP_STREAM_DMATX3, |
|---|
| 81 | + RKISP_STREAM_FBC, |
|---|
| 82 | + RKISP_STREAM_BP, |
|---|
| 83 | + RKISP_STREAM_MPDS, |
|---|
| 84 | + RKISP_STREAM_BPDS, |
|---|
| 85 | + RKISP_STREAM_LUMA, |
|---|
| 86 | + RKISP_STREAM_VIR, |
|---|
| 87 | + RKISP_MAX_STREAM, |
|---|
| 88 | +}; |
|---|
| 49 | 89 | |
|---|
| 50 | 90 | /* |
|---|
| 51 | 91 | * @fourcc: pixel format |
|---|
| .. | .. |
|---|
| 109 | 149 | struct stream_config { |
|---|
| 110 | 150 | const struct capture_fmt *fmts; |
|---|
| 111 | 151 | int fmt_size; |
|---|
| 112 | | - /* constrains */ |
|---|
| 113 | | - const int max_rsz_width; |
|---|
| 114 | | - const int max_rsz_height; |
|---|
| 115 | | - const int min_rsz_width; |
|---|
| 116 | | - const int min_rsz_height; |
|---|
| 152 | + int max_rsz_width; |
|---|
| 153 | + int max_rsz_height; |
|---|
| 154 | + int min_rsz_width; |
|---|
| 155 | + int min_rsz_height; |
|---|
| 117 | 156 | const int frame_end_id; |
|---|
| 118 | 157 | /* registers */ |
|---|
| 119 | 158 | struct { |
|---|
| .. | .. |
|---|
| 161 | 200 | u32 cr_offs_cnt_init; |
|---|
| 162 | 201 | u32 y_base_ad_shd; |
|---|
| 163 | 202 | u32 length; |
|---|
| 203 | + u32 ctrl; |
|---|
| 204 | + u32 y_pic_size; |
|---|
| 164 | 205 | } mi; |
|---|
| 165 | 206 | struct { |
|---|
| 166 | 207 | u32 ctrl; |
|---|
| .. | .. |
|---|
| 175 | 216 | void (*stop_mi)(struct rkisp_stream *stream); |
|---|
| 176 | 217 | void (*enable_mi)(struct rkisp_stream *stream); |
|---|
| 177 | 218 | void (*disable_mi)(struct rkisp_stream *stream); |
|---|
| 178 | | - void (*set_data_path)(void __iomem *base); |
|---|
| 179 | | - bool (*is_stream_stopped)(void __iomem *base); |
|---|
| 219 | + void (*set_data_path)(struct rkisp_stream *stream); |
|---|
| 220 | + bool (*is_stream_stopped)(struct rkisp_stream *stream); |
|---|
| 180 | 221 | void (*update_mi)(struct rkisp_stream *stream); |
|---|
| 181 | | - int (*frame_end)(struct rkisp_stream *stream); |
|---|
| 222 | + int (*frame_end)(struct rkisp_stream *stream, u32 state); |
|---|
| 223 | + int (*frame_start)(struct rkisp_stream *stream, u32 mis); |
|---|
| 224 | + int (*set_wrap)(struct rkisp_stream *stream, int line); |
|---|
| 225 | +}; |
|---|
| 226 | + |
|---|
| 227 | +struct rockit_isp_ops { |
|---|
| 228 | + int (*rkisp_stream_start)(struct rkisp_stream *stream); |
|---|
| 229 | + void (*rkisp_stream_stop)(struct rkisp_stream *stream); |
|---|
| 230 | + int (*rkisp_set_fmt)(struct rkisp_stream *stream, |
|---|
| 231 | + struct v4l2_pix_format_mplane *pixm, |
|---|
| 232 | + bool try); |
|---|
| 182 | 233 | }; |
|---|
| 183 | 234 | |
|---|
| 184 | 235 | /* |
|---|
| .. | .. |
|---|
| 215 | 266 | struct list_head buf_queue; |
|---|
| 216 | 267 | struct rkisp_buffer *curr_buf; |
|---|
| 217 | 268 | struct rkisp_buffer *next_buf; |
|---|
| 269 | + struct rkisp_dummy_buffer dummy_buf; |
|---|
| 218 | 270 | struct mutex apilock; |
|---|
| 271 | + struct tasklet_struct buf_done_tasklet; |
|---|
| 272 | + struct list_head buf_done_list; |
|---|
| 219 | 273 | bool streaming; |
|---|
| 220 | 274 | bool stopping; |
|---|
| 221 | 275 | bool frame_end; |
|---|
| 222 | 276 | bool linked; |
|---|
| 223 | 277 | bool start_stream; |
|---|
| 278 | + bool is_mf_upd; |
|---|
| 279 | + bool is_flip; |
|---|
| 280 | + bool is_pause; |
|---|
| 281 | + bool is_crop_upd; |
|---|
| 282 | + bool is_using_resmem; |
|---|
| 283 | + bool frame_early; |
|---|
| 224 | 284 | wait_queue_head_t done; |
|---|
| 225 | 285 | unsigned int burst; |
|---|
| 226 | 286 | atomic_t sequence; |
|---|
| 227 | 287 | struct frame_debug_info dbg; |
|---|
| 288 | + int conn_id; |
|---|
| 228 | 289 | u32 memory; |
|---|
| 290 | + u32 skip_frame; |
|---|
| 229 | 291 | union { |
|---|
| 230 | 292 | struct rkisp_stream_sp sp; |
|---|
| 231 | 293 | struct rkisp_stream_mp mp; |
|---|
| .. | .. |
|---|
| 234 | 296 | } u; |
|---|
| 235 | 297 | }; |
|---|
| 236 | 298 | |
|---|
| 299 | +struct rkisp_vir_cpy { |
|---|
| 300 | + struct work_struct work; |
|---|
| 301 | + struct completion cmpl; |
|---|
| 302 | + struct list_head queue; |
|---|
| 303 | + struct rkisp_stream *stream; |
|---|
| 304 | +}; |
|---|
| 305 | + |
|---|
| 237 | 306 | struct rkisp_capture_device { |
|---|
| 238 | 307 | struct rkisp_device *ispdev; |
|---|
| 239 | 308 | struct rkisp_stream stream[RKISP_MAX_STREAM]; |
|---|
| 240 | 309 | struct rkisp_buffer *rdbk_buf[RDBK_MAX]; |
|---|
| 310 | + struct rkisp_vir_cpy vir_cpy; |
|---|
| 311 | + struct tasklet_struct rd_tasklet; |
|---|
| 241 | 312 | atomic_t refcnt; |
|---|
| 242 | 313 | u32 wait_line; |
|---|
| 314 | + u32 wrap_width; |
|---|
| 315 | + u32 wrap_line; |
|---|
| 243 | 316 | bool is_done_early; |
|---|
| 317 | + bool is_mirror; |
|---|
| 318 | + |
|---|
| 319 | + struct work_struct fast_work; |
|---|
| 244 | 320 | }; |
|---|
| 245 | 321 | |
|---|
| 246 | 322 | extern struct stream_config rkisp_mp_stream_config; |
|---|
| 247 | 323 | extern struct stream_config rkisp_sp_stream_config; |
|---|
| 324 | +extern struct rockit_isp_ops rockit_isp_ops; |
|---|
| 248 | 325 | |
|---|
| 326 | +void rkisp_stream_buf_done_early(struct rkisp_device *dev); |
|---|
| 327 | +void rkisp_stream_buf_done(struct rkisp_stream *stream, |
|---|
| 328 | + struct rkisp_buffer *buf); |
|---|
| 249 | 329 | void rkisp_unregister_stream_vdev(struct rkisp_stream *stream); |
|---|
| 250 | 330 | int rkisp_register_stream_vdev(struct rkisp_stream *stream); |
|---|
| 251 | 331 | void rkisp_unregister_stream_vdevs(struct rkisp_device *dev); |
|---|
| .. | .. |
|---|
| 253 | 333 | void rkisp_mi_isr(u32 mis_val, struct rkisp_device *dev); |
|---|
| 254 | 334 | void rkisp_set_stream_def_fmt(struct rkisp_device *dev, u32 id, |
|---|
| 255 | 335 | u32 width, u32 height, u32 pixelformat); |
|---|
| 336 | +int rkisp_stream_frame_start(struct rkisp_device *dev, u32 isp_mis); |
|---|
| 256 | 337 | int rkisp_fcc_xysubs(u32 fcc, u32 *xsubs, u32 *ysubs); |
|---|
| 257 | 338 | int rkisp_mbus_code_xysubs(u32 code, u32 *xsubs, u32 *ysubs); |
|---|
| 258 | 339 | int rkisp_fh_open(struct file *filp); |
|---|
| 259 | 340 | int rkisp_fop_release(struct file *file); |
|---|
| 341 | + |
|---|
| 342 | +int rkisp_get_tb_stream_info(struct rkisp_stream *stream, |
|---|
| 343 | + struct rkisp_tb_stream_info *info); |
|---|
| 344 | +int rkisp_free_tb_stream_buf(struct rkisp_stream *stream); |
|---|
| 260 | 345 | #endif /* _RKISP_PATH_VIDEO_H */ |
|---|