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 = v4l2_subdev_state_get_format(wpf->entity.state, in vsp1_wpf_set_rotation()
70 source_format = v4l2_subdev_state_get_format(wpf->entity.state, in vsp1_wpf_set_rotation()
73 mutex_lock(&wpf->entity.lock); in vsp1_wpf_set_rotation()
83 wpf->flip.rotate = rotate; in vsp1_wpf_set_rotation()
85 mutex_unlock(&wpf->entity.lock); in vsp1_wpf_set_rotation()
94 struct vsp1_rwpf *wpf = in vsp1_wpf_s_ctrl() local
101 rotation = wpf->flip.ctrls.rotate ? wpf->flip.ctrls.rotate->val : 0; in vsp1_wpf_s_ctrl()
102 ret = vsp1_wpf_set_rotation(wpf, rotation); in vsp1_wpf_s_ctrl()
112 if (wpf->flip.ctrls.vflip->val) in vsp1_wpf_s_ctrl()
115 if (wpf->flip.ctrls.hflip && wpf->flip.ctrls.hflip->val) in vsp1_wpf_s_ctrl()
121 spin_lock_irq(&wpf->flip.lock); in vsp1_wpf_s_ctrl()
122 wpf->flip.pending = flip; in vsp1_wpf_s_ctrl()
123 spin_unlock_irq(&wpf->flip.lock); in vsp1_wpf_s_ctrl()
132 static int wpf_init_controls(struct vsp1_rwpf *wpf) in wpf_init_controls() argument
134 struct vsp1_device *vsp1 = wpf->entity.vsp1; in wpf_init_controls()
137 spin_lock_init(&wpf->flip.lock); in wpf_init_controls()
139 if (wpf->entity.index != 0) { in wpf_init_controls()
159 vsp1_rwpf_init_ctrls(wpf, num_flip_ctrls); in wpf_init_controls()
162 wpf->flip.ctrls.vflip = in wpf_init_controls()
163 v4l2_ctrl_new_std(&wpf->ctrls, &vsp1_wpf_ctrl_ops, in wpf_init_controls()
168 wpf->flip.ctrls.hflip = in wpf_init_controls()
169 v4l2_ctrl_new_std(&wpf->ctrls, &vsp1_wpf_ctrl_ops, in wpf_init_controls()
171 wpf->flip.ctrls.rotate = in wpf_init_controls()
172 v4l2_ctrl_new_std(&wpf->ctrls, &vsp1_wpf_ctrl_ops, in wpf_init_controls()
174 v4l2_ctrl_cluster(3, &wpf->flip.ctrls.vflip); in wpf_init_controls()
177 if (wpf->ctrls.error) { in wpf_init_controls()
179 wpf->entity.index); in wpf_init_controls()
180 return wpf->ctrls.error; in wpf_init_controls()
190 void vsp1_wpf_stop(struct vsp1_rwpf *wpf) in vsp1_wpf_stop() argument
192 struct vsp1_device *vsp1 = wpf->entity.vsp1; in vsp1_wpf_stop()
198 vsp1_write(vsp1, VI6_WPF_IRQ_ENB(wpf->entity.index), 0); in vsp1_wpf_stop()
199 vsp1_write(vsp1, wpf->entity.index * VI6_WPF_OFFSET + in vsp1_wpf_stop()
205 struct vsp1_rwpf *wpf = entity_to_rwpf(entity); in vsp1_wpf_destroy() local
207 vsp1_dlm_destroy(wpf->dlm); in vsp1_wpf_destroy()
210 static int wpf_configure_writeback_chain(struct vsp1_rwpf *wpf, in wpf_configure_writeback_chain() argument
213 unsigned int index = wpf->entity.index; in wpf_configure_writeback_chain()
217 dl_next = vsp1_dl_list_get(wpf->dlm); in wpf_configure_writeback_chain()
219 dev_err(wpf->entity.vsp1->dev, in wpf_configure_writeback_chain()
237 struct vsp1_rwpf *wpf = to_rwpf(&entity->subdev); in wpf_configure_stream() local
238 struct vsp1_device *vsp1 = wpf->entity.vsp1; in wpf_configure_stream()
241 unsigned int index = wpf->entity.index; in wpf_configure_stream()
251 if (!pipe->lif || wpf->writeback) { in wpf_configure_stream()
252 const struct v4l2_pix_format_mplane *format = &wpf->format; in wpf_configure_stream()
253 const struct vsp1_format_info *fmtinfo = wpf->fmtinfo; in wpf_configure_stream()
257 if (wpf->flip.rotate) in wpf_configure_stream()
268 vsp1_wpf_write(wpf, dlb, VI6_WPF_DSTM_STRIDE_Y, in wpf_configure_stream()
271 vsp1_wpf_write(wpf, dlb, VI6_WPF_DSTM_STRIDE_C, in wpf_configure_stream()
274 vsp1_wpf_write(wpf, dlb, VI6_WPF_DSWAP, fmtinfo->swap); in wpf_configure_stream()
277 vsp1_wpf_write(wpf, dlb, VI6_WPF_ROT_CTRL, in wpf_configure_stream()
285 wpf->outfmt = outfmt; in wpf_configure_stream()
312 vsp1_wpf_write(wpf, dlb, VI6_WPF_SRCRPF, srcrpf); in wpf_configure_stream()
327 if (wpf->writeback) { in wpf_configure_stream()
328 ret = wpf_configure_writeback_chain(wpf, dl); in wpf_configure_stream()
330 wpf->writeback = false; in wpf_configure_stream()
334 wpf->writeback ? VI6_WPF_WRBCK_CTRL_WBMD : 0); in wpf_configure_stream()
344 struct vsp1_rwpf *wpf = to_rwpf(&entity->subdev); in wpf_configure_frame() local
348 spin_lock_irqsave(&wpf->flip.lock, flags); in wpf_configure_frame()
349 wpf->flip.active = (wpf->flip.active & ~mask) in wpf_configure_frame()
350 | (wpf->flip.pending & mask); in wpf_configure_frame()
351 spin_unlock_irqrestore(&wpf->flip.lock, flags); in wpf_configure_frame()
353 outfmt = (wpf->alpha << VI6_WPF_OUTFMT_PDV_SHIFT) | wpf->outfmt; in wpf_configure_frame()
355 if (wpf->flip.active & BIT(WPF_CTRL_VFLIP)) in wpf_configure_frame()
357 if (wpf->flip.active & BIT(WPF_CTRL_HFLIP)) in wpf_configure_frame()
360 vsp1_wpf_write(wpf, dlb, VI6_WPF_OUTFMT, outfmt); in wpf_configure_frame()
369 struct vsp1_rwpf *wpf = to_rwpf(&entity->subdev); in wpf_configure_partition() local
370 struct vsp1_device *vsp1 = wpf->entity.vsp1; in wpf_configure_partition()
371 struct vsp1_rwpf_memory mem = wpf->mem; in wpf_configure_partition()
372 const struct v4l2_pix_format_mplane *format = &wpf->format; in wpf_configure_partition()
373 const struct vsp1_format_info *fmtinfo = wpf->fmtinfo; in wpf_configure_partition()
385 width = partition->wpf.width; in wpf_configure_partition()
386 left = partition->wpf.left; in wpf_configure_partition()
387 height = partition->wpf.height; in wpf_configure_partition()
389 vsp1_wpf_write(wpf, dlb, VI6_WPF_HSZCLIP, VI6_WPF_SZCLIP_EN | in wpf_configure_partition()
392 vsp1_wpf_write(wpf, dlb, VI6_WPF_VSZCLIP, VI6_WPF_SZCLIP_EN | in wpf_configure_partition()
400 if (pipe->lif && !wpf->writeback) in wpf_configure_partition()
419 flip = wpf->flip.active; in wpf_configure_partition()
421 if (flip & BIT(WPF_CTRL_HFLIP) && !wpf->flip.rotate) in wpf_configure_partition()
423 else if (flip & BIT(WPF_CTRL_VFLIP) && wpf->flip.rotate) in wpf_configure_partition()
432 if (wpf->flip.rotate) in wpf_configure_partition()
447 if (wpf->flip.rotate) in wpf_configure_partition()
463 if (wpf->flip.rotate && !(flip & BIT(WPF_CTRL_HFLIP))) { in wpf_configure_partition()
486 vsp1_wpf_write(wpf, dlb, VI6_WPF_DSTM_ADDR_Y, mem.addr[0]); in wpf_configure_partition()
487 vsp1_wpf_write(wpf, dlb, VI6_WPF_DSTM_ADDR_C0, mem.addr[1]); in wpf_configure_partition()
488 vsp1_wpf_write(wpf, dlb, VI6_WPF_DSTM_ADDR_C1, mem.addr[2]); in wpf_configure_partition()
494 wpf->writeback = false; in wpf_configure_partition()
501 struct vsp1_rwpf *wpf = to_rwpf(&entity->subdev); in wpf_max_width() local
503 return wpf->flip.rotate ? 256 : wpf->max_width; in wpf_max_width()
513 partition->wpf = *window; in wpf_partition()
531 struct vsp1_rwpf *wpf; in vsp1_wpf_create() local
535 wpf = devm_kzalloc(vsp1->dev, sizeof(*wpf), GFP_KERNEL); in vsp1_wpf_create()
536 if (wpf == NULL) in vsp1_wpf_create()
540 wpf->max_width = WPF_GEN2_MAX_WIDTH; in vsp1_wpf_create()
541 wpf->max_height = WPF_GEN2_MAX_HEIGHT; in vsp1_wpf_create()
543 wpf->max_width = WPF_GEN3_MAX_WIDTH; in vsp1_wpf_create()
544 wpf->max_height = WPF_GEN3_MAX_HEIGHT; in vsp1_wpf_create()
547 wpf->entity.ops = &wpf_entity_ops; in vsp1_wpf_create()
548 wpf->entity.type = VSP1_ENTITY_WPF; in vsp1_wpf_create()
549 wpf->entity.index = index; in vsp1_wpf_create()
552 ret = vsp1_entity_init(vsp1, &wpf->entity, name, 2, &vsp1_rwpf_subdev_ops, in vsp1_wpf_create()
558 wpf->dlm = vsp1_dlm_create(vsp1, index, 64); in vsp1_wpf_create()
559 if (!wpf->dlm) { in vsp1_wpf_create()
565 ret = wpf_init_controls(wpf); in vsp1_wpf_create()
572 v4l2_ctrl_handler_setup(&wpf->ctrls); in vsp1_wpf_create()
574 return wpf; in vsp1_wpf_create()
577 vsp1_entity_destroy(&wpf->entity); in vsp1_wpf_create()