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()
192 void vsp1_wpf_stop(struct vsp1_rwpf *wpf) in vsp1_wpf_stop() argument
194 struct vsp1_device *vsp1 = wpf->entity.vsp1; in vsp1_wpf_stop()
200 vsp1_write(vsp1, VI6_WPF_IRQ_ENB(wpf->entity.index), 0); in vsp1_wpf_stop()
201 vsp1_write(vsp1, wpf->entity.index * VI6_WPF_OFFSET + in vsp1_wpf_stop()
207 struct vsp1_rwpf *wpf = entity_to_rwpf(entity); in vsp1_wpf_destroy() local
209 vsp1_dlm_destroy(wpf->dlm); in vsp1_wpf_destroy()
212 static int wpf_configure_writeback_chain(struct vsp1_rwpf *wpf, in wpf_configure_writeback_chain() argument
215 unsigned int index = wpf->entity.index; in wpf_configure_writeback_chain()
219 dl_next = vsp1_dl_list_get(wpf->dlm); in wpf_configure_writeback_chain()
221 dev_err(wpf->entity.vsp1->dev, in wpf_configure_writeback_chain()
238 struct vsp1_rwpf *wpf = to_rwpf(&entity->subdev); in wpf_configure_stream() local
239 struct vsp1_device *vsp1 = wpf->entity.vsp1; in wpf_configure_stream()
242 unsigned int index = wpf->entity.index; in wpf_configure_stream()
248 sink_format = vsp1_entity_get_pad_format(&wpf->entity, in wpf_configure_stream()
249 wpf->entity.config, in wpf_configure_stream()
251 source_format = vsp1_entity_get_pad_format(&wpf->entity, in wpf_configure_stream()
252 wpf->entity.config, in wpf_configure_stream()
256 if (!pipe->lif || wpf->writeback) { in wpf_configure_stream()
257 const struct v4l2_pix_format_mplane *format = &wpf->format; in wpf_configure_stream()
258 const struct vsp1_format_info *fmtinfo = wpf->fmtinfo; in wpf_configure_stream()
262 if (wpf->flip.rotate) in wpf_configure_stream()
273 vsp1_wpf_write(wpf, dlb, VI6_WPF_DSTM_STRIDE_Y, in wpf_configure_stream()
276 vsp1_wpf_write(wpf, dlb, VI6_WPF_DSTM_STRIDE_C, in wpf_configure_stream()
279 vsp1_wpf_write(wpf, dlb, VI6_WPF_DSWAP, fmtinfo->swap); in wpf_configure_stream()
282 vsp1_wpf_write(wpf, dlb, VI6_WPF_ROT_CTRL, in wpf_configure_stream()
290 wpf->outfmt = outfmt; in wpf_configure_stream()
317 vsp1_wpf_write(wpf, dlb, VI6_WPF_SRCRPF, srcrpf); in wpf_configure_stream()
332 if (wpf->writeback) { in wpf_configure_stream()
333 ret = wpf_configure_writeback_chain(wpf, dl); in wpf_configure_stream()
335 wpf->writeback = false; in wpf_configure_stream()
339 wpf->writeback ? VI6_WPF_WRBCK_CTRL_WBMD : 0); in wpf_configure_stream()
349 struct vsp1_rwpf *wpf = to_rwpf(&entity->subdev); in wpf_configure_frame() local
353 spin_lock_irqsave(&wpf->flip.lock, flags); in wpf_configure_frame()
354 wpf->flip.active = (wpf->flip.active & ~mask) in wpf_configure_frame()
355 | (wpf->flip.pending & mask); in wpf_configure_frame()
356 spin_unlock_irqrestore(&wpf->flip.lock, flags); in wpf_configure_frame()
358 outfmt = (wpf->alpha << VI6_WPF_OUTFMT_PDV_SHIFT) | wpf->outfmt; in wpf_configure_frame()
360 if (wpf->flip.active & BIT(WPF_CTRL_VFLIP)) in wpf_configure_frame()
362 if (wpf->flip.active & BIT(WPF_CTRL_HFLIP)) in wpf_configure_frame()
365 vsp1_wpf_write(wpf, dlb, VI6_WPF_OUTFMT, outfmt); in wpf_configure_frame()
373 struct vsp1_rwpf *wpf = to_rwpf(&entity->subdev); in wpf_configure_partition() local
374 struct vsp1_device *vsp1 = wpf->entity.vsp1; in wpf_configure_partition()
375 struct vsp1_rwpf_memory mem = wpf->mem; in wpf_configure_partition()
377 const struct v4l2_pix_format_mplane *format = &wpf->format; in wpf_configure_partition()
378 const struct vsp1_format_info *fmtinfo = wpf->fmtinfo; in wpf_configure_partition()
386 sink_format = vsp1_entity_get_pad_format(&wpf->entity, in wpf_configure_partition()
387 wpf->entity.config, in wpf_configure_partition()
398 width = pipe->partition->wpf.width; in wpf_configure_partition()
399 left = pipe->partition->wpf.left; in wpf_configure_partition()
402 vsp1_wpf_write(wpf, dlb, VI6_WPF_HSZCLIP, VI6_WPF_SZCLIP_EN | in wpf_configure_partition()
405 vsp1_wpf_write(wpf, dlb, VI6_WPF_VSZCLIP, VI6_WPF_SZCLIP_EN | in wpf_configure_partition()
413 if (pipe->lif && !wpf->writeback) in wpf_configure_partition()
432 flip = wpf->flip.active; in wpf_configure_partition()
434 if (flip & BIT(WPF_CTRL_HFLIP) && !wpf->flip.rotate) in wpf_configure_partition()
436 else if (flip & BIT(WPF_CTRL_VFLIP) && wpf->flip.rotate) in wpf_configure_partition()
445 if (wpf->flip.rotate) in wpf_configure_partition()
460 if (wpf->flip.rotate) in wpf_configure_partition()
476 if (wpf->flip.rotate && !(flip & BIT(WPF_CTRL_HFLIP))) { in wpf_configure_partition()
499 vsp1_wpf_write(wpf, dlb, VI6_WPF_DSTM_ADDR_Y, mem.addr[0]); in wpf_configure_partition()
500 vsp1_wpf_write(wpf, dlb, VI6_WPF_DSTM_ADDR_C0, mem.addr[1]); in wpf_configure_partition()
501 vsp1_wpf_write(wpf, dlb, VI6_WPF_DSTM_ADDR_C1, mem.addr[2]); in wpf_configure_partition()
507 wpf->writeback = false; in wpf_configure_partition()
513 struct vsp1_rwpf *wpf = to_rwpf(&entity->subdev); in wpf_max_width() local
515 return wpf->flip.rotate ? 256 : wpf->max_width; in wpf_max_width()
524 partition->wpf = *window; in wpf_partition()
542 struct vsp1_rwpf *wpf; in vsp1_wpf_create() local
546 wpf = devm_kzalloc(vsp1->dev, sizeof(*wpf), GFP_KERNEL); in vsp1_wpf_create()
547 if (wpf == NULL) in vsp1_wpf_create()
551 wpf->max_width = WPF_GEN2_MAX_WIDTH; in vsp1_wpf_create()
552 wpf->max_height = WPF_GEN2_MAX_HEIGHT; in vsp1_wpf_create()
554 wpf->max_width = WPF_GEN3_MAX_WIDTH; in vsp1_wpf_create()
555 wpf->max_height = WPF_GEN3_MAX_HEIGHT; in vsp1_wpf_create()
558 wpf->entity.ops = &wpf_entity_ops; in vsp1_wpf_create()
559 wpf->entity.type = VSP1_ENTITY_WPF; in vsp1_wpf_create()
560 wpf->entity.index = index; in vsp1_wpf_create()
563 ret = vsp1_entity_init(vsp1, &wpf->entity, name, 2, &vsp1_rwpf_subdev_ops, in vsp1_wpf_create()
569 wpf->dlm = vsp1_dlm_create(vsp1, index, 64); in vsp1_wpf_create()
570 if (!wpf->dlm) { in vsp1_wpf_create()
576 ret = wpf_init_controls(wpf); in vsp1_wpf_create()
583 v4l2_ctrl_handler_setup(&wpf->ctrls); in vsp1_wpf_create()
585 return wpf; in vsp1_wpf_create()
588 vsp1_entity_destroy(&wpf->entity); in vsp1_wpf_create()