Lines Matching refs:wpf

29 static inline void vsp1_wpf_write(struct vsp1_rwpf *wpf,  in vsp1_wpf_write()  argument
32 vsp1_dl_body_write(dlb, reg + wpf->entity.index * VI6_WPF_OFFSET, data); in vsp1_wpf_write()
44 static int vsp1_wpf_set_rotation(struct vsp1_rwpf *wpf, unsigned int rotation) in vsp1_wpf_set_rotation() argument
46 struct vsp1_video *video = wpf->video; in vsp1_wpf_set_rotation()
57 if (rotate == wpf->flip.rotate) in vsp1_wpf_set_rotation()
68 sink_format = vsp1_entity_get_pad_format(&wpf->entity, in vsp1_wpf_set_rotation()
69 wpf->entity.config, in vsp1_wpf_set_rotation()
71 source_format = vsp1_entity_get_pad_format(&wpf->entity, in vsp1_wpf_set_rotation()
72 wpf->entity.config, in vsp1_wpf_set_rotation()
75 mutex_lock(&wpf->entity.lock); in vsp1_wpf_set_rotation()
85 wpf->flip.rotate = rotate; in vsp1_wpf_set_rotation()
87 mutex_unlock(&wpf->entity.lock); in vsp1_wpf_set_rotation()
96 struct vsp1_rwpf *wpf = in vsp1_wpf_s_ctrl() local
103 rotation = wpf->flip.ctrls.rotate ? wpf->flip.ctrls.rotate->val : 0; in vsp1_wpf_s_ctrl()
104 ret = vsp1_wpf_set_rotation(wpf, rotation); in vsp1_wpf_s_ctrl()
114 if (wpf->flip.ctrls.vflip->val) in vsp1_wpf_s_ctrl()
117 if (wpf->flip.ctrls.hflip && wpf->flip.ctrls.hflip->val) in vsp1_wpf_s_ctrl()
123 spin_lock_irq(&wpf->flip.lock); in vsp1_wpf_s_ctrl()
124 wpf->flip.pending = flip; in vsp1_wpf_s_ctrl()
125 spin_unlock_irq(&wpf->flip.lock); in vsp1_wpf_s_ctrl()
134 static int wpf_init_controls(struct vsp1_rwpf *wpf) in wpf_init_controls() argument
136 struct vsp1_device *vsp1 = wpf->entity.vsp1; in wpf_init_controls()
139 spin_lock_init(&wpf->flip.lock); in wpf_init_controls()
141 if (wpf->entity.index != 0) { in wpf_init_controls()
161 vsp1_rwpf_init_ctrls(wpf, num_flip_ctrls); in wpf_init_controls()
164 wpf->flip.ctrls.vflip = in wpf_init_controls()
165 v4l2_ctrl_new_std(&wpf->ctrls, &vsp1_wpf_ctrl_ops, in wpf_init_controls()
170 wpf->flip.ctrls.hflip = in wpf_init_controls()
171 v4l2_ctrl_new_std(&wpf->ctrls, &vsp1_wpf_ctrl_ops, in wpf_init_controls()
173 wpf->flip.ctrls.rotate = in wpf_init_controls()
174 v4l2_ctrl_new_std(&wpf->ctrls, &vsp1_wpf_ctrl_ops, in wpf_init_controls()
176 v4l2_ctrl_cluster(3, &wpf->flip.ctrls.vflip); in wpf_init_controls()
179 if (wpf->ctrls.error) { in wpf_init_controls()
181 wpf->entity.index); in wpf_init_controls()
182 return wpf->ctrls.error; in wpf_init_controls()
194 struct vsp1_rwpf *wpf = to_rwpf(subdev); in wpf_s_stream() local
195 struct vsp1_device *vsp1 = wpf->entity.vsp1; in wpf_s_stream()
204 vsp1_write(vsp1, VI6_WPF_IRQ_ENB(wpf->entity.index), 0); in wpf_s_stream()
205 vsp1_write(vsp1, wpf->entity.index * VI6_WPF_OFFSET + in wpf_s_stream()
230 struct vsp1_rwpf *wpf = entity_to_rwpf(entity); in vsp1_wpf_destroy() local
232 vsp1_dlm_destroy(wpf->dlm); in vsp1_wpf_destroy()
235 static int wpf_configure_writeback_chain(struct vsp1_rwpf *wpf, in wpf_configure_writeback_chain() argument
238 unsigned int index = wpf->entity.index; in wpf_configure_writeback_chain()
242 dl_next = vsp1_dl_list_get(wpf->dlm); in wpf_configure_writeback_chain()
244 dev_err(wpf->entity.vsp1->dev, in wpf_configure_writeback_chain()
261 struct vsp1_rwpf *wpf = to_rwpf(&entity->subdev); in wpf_configure_stream() local
262 struct vsp1_device *vsp1 = wpf->entity.vsp1; in wpf_configure_stream()
265 unsigned int index = wpf->entity.index; in wpf_configure_stream()
271 sink_format = vsp1_entity_get_pad_format(&wpf->entity, in wpf_configure_stream()
272 wpf->entity.config, in wpf_configure_stream()
274 source_format = vsp1_entity_get_pad_format(&wpf->entity, in wpf_configure_stream()
275 wpf->entity.config, in wpf_configure_stream()
279 if (!pipe->lif || wpf->writeback) { in wpf_configure_stream()
280 const struct v4l2_pix_format_mplane *format = &wpf->format; in wpf_configure_stream()
281 const struct vsp1_format_info *fmtinfo = wpf->fmtinfo; in wpf_configure_stream()
285 if (wpf->flip.rotate) in wpf_configure_stream()
296 vsp1_wpf_write(wpf, dlb, VI6_WPF_DSTM_STRIDE_Y, in wpf_configure_stream()
299 vsp1_wpf_write(wpf, dlb, VI6_WPF_DSTM_STRIDE_C, in wpf_configure_stream()
302 vsp1_wpf_write(wpf, dlb, VI6_WPF_DSWAP, fmtinfo->swap); in wpf_configure_stream()
305 vsp1_wpf_write(wpf, dlb, VI6_WPF_ROT_CTRL, in wpf_configure_stream()
313 wpf->outfmt = outfmt; in wpf_configure_stream()
340 vsp1_wpf_write(wpf, dlb, VI6_WPF_SRCRPF, srcrpf); in wpf_configure_stream()
355 if (wpf->writeback) { in wpf_configure_stream()
356 ret = wpf_configure_writeback_chain(wpf, dl); in wpf_configure_stream()
358 wpf->writeback = false; in wpf_configure_stream()
362 wpf->writeback ? VI6_WPF_WRBCK_CTRL_WBMD : 0); in wpf_configure_stream()
372 struct vsp1_rwpf *wpf = to_rwpf(&entity->subdev); in wpf_configure_frame() local
376 spin_lock_irqsave(&wpf->flip.lock, flags); in wpf_configure_frame()
377 wpf->flip.active = (wpf->flip.active & ~mask) in wpf_configure_frame()
378 | (wpf->flip.pending & mask); in wpf_configure_frame()
379 spin_unlock_irqrestore(&wpf->flip.lock, flags); in wpf_configure_frame()
381 outfmt = (wpf->alpha << VI6_WPF_OUTFMT_PDV_SHIFT) | wpf->outfmt; in wpf_configure_frame()
383 if (wpf->flip.active & BIT(WPF_CTRL_VFLIP)) in wpf_configure_frame()
385 if (wpf->flip.active & BIT(WPF_CTRL_HFLIP)) in wpf_configure_frame()
388 vsp1_wpf_write(wpf, dlb, VI6_WPF_OUTFMT, outfmt); in wpf_configure_frame()
396 struct vsp1_rwpf *wpf = to_rwpf(&entity->subdev); in wpf_configure_partition() local
397 struct vsp1_device *vsp1 = wpf->entity.vsp1; in wpf_configure_partition()
398 struct vsp1_rwpf_memory mem = wpf->mem; in wpf_configure_partition()
400 const struct v4l2_pix_format_mplane *format = &wpf->format; in wpf_configure_partition()
401 const struct vsp1_format_info *fmtinfo = wpf->fmtinfo; in wpf_configure_partition()
409 sink_format = vsp1_entity_get_pad_format(&wpf->entity, in wpf_configure_partition()
410 wpf->entity.config, in wpf_configure_partition()
421 width = pipe->partition->wpf.width; in wpf_configure_partition()
422 left = pipe->partition->wpf.left; in wpf_configure_partition()
425 vsp1_wpf_write(wpf, dlb, VI6_WPF_HSZCLIP, VI6_WPF_SZCLIP_EN | in wpf_configure_partition()
428 vsp1_wpf_write(wpf, dlb, VI6_WPF_VSZCLIP, VI6_WPF_SZCLIP_EN | in wpf_configure_partition()
436 if (pipe->lif && !wpf->writeback) in wpf_configure_partition()
455 flip = wpf->flip.active; in wpf_configure_partition()
457 if (flip & BIT(WPF_CTRL_HFLIP) && !wpf->flip.rotate) in wpf_configure_partition()
459 else if (flip & BIT(WPF_CTRL_VFLIP) && wpf->flip.rotate) in wpf_configure_partition()
468 if (wpf->flip.rotate) in wpf_configure_partition()
483 if (wpf->flip.rotate) in wpf_configure_partition()
499 if (wpf->flip.rotate && !(flip & BIT(WPF_CTRL_HFLIP))) { in wpf_configure_partition()
522 vsp1_wpf_write(wpf, dlb, VI6_WPF_DSTM_ADDR_Y, mem.addr[0]); in wpf_configure_partition()
523 vsp1_wpf_write(wpf, dlb, VI6_WPF_DSTM_ADDR_C0, mem.addr[1]); in wpf_configure_partition()
524 vsp1_wpf_write(wpf, dlb, VI6_WPF_DSTM_ADDR_C1, mem.addr[2]); in wpf_configure_partition()
530 wpf->writeback = false; in wpf_configure_partition()
536 struct vsp1_rwpf *wpf = to_rwpf(&entity->subdev); in wpf_max_width() local
538 return wpf->flip.rotate ? 256 : wpf->max_width; in wpf_max_width()
547 partition->wpf = *window; in wpf_partition()
565 struct vsp1_rwpf *wpf; in vsp1_wpf_create() local
569 wpf = devm_kzalloc(vsp1->dev, sizeof(*wpf), GFP_KERNEL); in vsp1_wpf_create()
570 if (wpf == NULL) in vsp1_wpf_create()
574 wpf->max_width = WPF_GEN2_MAX_WIDTH; in vsp1_wpf_create()
575 wpf->max_height = WPF_GEN2_MAX_HEIGHT; in vsp1_wpf_create()
577 wpf->max_width = WPF_GEN3_MAX_WIDTH; in vsp1_wpf_create()
578 wpf->max_height = WPF_GEN3_MAX_HEIGHT; in vsp1_wpf_create()
581 wpf->entity.ops = &wpf_entity_ops; in vsp1_wpf_create()
582 wpf->entity.type = VSP1_ENTITY_WPF; in vsp1_wpf_create()
583 wpf->entity.index = index; in vsp1_wpf_create()
586 ret = vsp1_entity_init(vsp1, &wpf->entity, name, 2, &wpf_ops, in vsp1_wpf_create()
592 wpf->dlm = vsp1_dlm_create(vsp1, index, 64); in vsp1_wpf_create()
593 if (!wpf->dlm) { in vsp1_wpf_create()
599 ret = wpf_init_controls(wpf); in vsp1_wpf_create()
606 v4l2_ctrl_handler_setup(&wpf->ctrls); in vsp1_wpf_create()
608 return wpf; in vsp1_wpf_create()
611 vsp1_entity_destroy(&wpf->entity); in vsp1_wpf_create()