Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: renesas: vsp1: rwpf: Support operations with IIF

When the RPF/WPF units are used for ISP interfacing through
the IIF, the set of accessible registers is limited compared to
the regular VSPD operations.

Support ISP interfacing in the rpf and wpf entities by checking if
the pipe features an IIF instance and writing only the relevant
registers.

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Tested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>
Link: https://lore.kernel.org/r/20250401-v4h-iif-v7-4-cc547c0bddd5@ideasonboard.com
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>

authored by

Jacopo Mondi and committed by
Hans Verkuil
8ebd5f70 f4fea514

+21 -5
+3
drivers/media/platform/renesas/vsp1/vsp1_iif.h
··· 12 12 13 13 #include "vsp1_entity.h" 14 14 15 + #define VSPX_IIF_SINK_PAD_IMG 0 16 + #define VSPX_IIF_SINK_PAD_CONFIG 2 17 + 15 18 struct vsp1_iif { 16 19 struct vsp1_entity entity; 17 20 };
+8 -1
drivers/media/platform/renesas/vsp1/vsp1_rpf.c
··· 84 84 sink_format = v4l2_subdev_state_get_format(state, RWPF_PAD_SINK); 85 85 source_format = v4l2_subdev_state_get_format(state, RWPF_PAD_SOURCE); 86 86 87 - infmt = VI6_RPF_INFMT_CIPM 87 + infmt = (pipe->iif ? 0 : VI6_RPF_INFMT_CIPM) 88 88 | (fmtinfo->hwfmt << VI6_RPF_INFMT_RDFMT_SHIFT); 89 89 90 90 if (fmtinfo->swap_yc) ··· 97 97 98 98 vsp1_rpf_write(rpf, dlb, VI6_RPF_INFMT, infmt); 99 99 vsp1_rpf_write(rpf, dlb, VI6_RPF_DSWAP, fmtinfo->swap); 100 + 101 + /* No further configuration for VSPX. */ 102 + if (pipe->iif) { 103 + /* VSPX wants alpha_sel to be set to 0. */ 104 + vsp1_rpf_write(rpf, dlb, VI6_RPF_ALPH_SEL, 0); 105 + return; 106 + } 100 107 101 108 if (entity->vsp1->info->gen == 4) { 102 109 u32 ext_infmt0;
+10 -4
drivers/media/platform/renesas/vsp1/vsp1_wpf.c
··· 247 247 sink_format = v4l2_subdev_state_get_format(state, RWPF_PAD_SINK); 248 248 source_format = v4l2_subdev_state_get_format(state, RWPF_PAD_SOURCE); 249 249 250 - /* Format */ 251 - if (!pipe->lif || wpf->writeback) { 250 + /* 251 + * Format configuration. Skip for IIF (VSPX) or if the pipe doesn't 252 + * write to memory. 253 + */ 254 + if (!pipe->iif && (!pipe->lif || wpf->writeback)) { 252 255 const struct v4l2_pix_format_mplane *format = &wpf->format; 253 256 const struct vsp1_format_info *fmtinfo = wpf->fmtinfo; 254 257 ··· 294 291 * Sources. If the pipeline has a single input and BRx is not used, 295 292 * configure it as the master layer. Otherwise configure all 296 293 * inputs as sub-layers and select the virtual RPF as the master 297 - * layer. 294 + * layer. For VSPX configure the enabled sources as masters. 298 295 */ 299 296 for (i = 0; i < vsp1->info->rpf_count; ++i) { 300 297 struct vsp1_rwpf *input = pipe->inputs[i]; ··· 302 299 if (!input) 303 300 continue; 304 301 305 - srcrpf |= (!pipe->brx && pipe->num_inputs == 1) 302 + srcrpf |= (pipe->iif || (!pipe->brx && pipe->num_inputs == 1)) 306 303 ? VI6_WPF_SRCRPF_RPF_ACT_MST(input->entity.index) 307 304 : VI6_WPF_SRCRPF_RPF_ACT_SUB(input->entity.index); 308 305 } ··· 318 315 vsp1_dl_body_write(dlb, VI6_WPF_IRQ_STA(index), 0); 319 316 vsp1_dl_body_write(dlb, VI6_WPF_IRQ_ENB(index), 320 317 VI6_WPF_IRQ_ENB_DFEE); 318 + 319 + if (pipe->iif) 320 + return; 321 321 322 322 /* 323 323 * Configure writeback for display pipelines (the wpf writeback flag is