]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: renesas: vsp1: rwpf: Support operations with IIF
authorJacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>
Tue, 1 Apr 2025 14:22:04 +0000 (16:22 +0200)
committerHans Verkuil <hverkuil@xs4all.nl>
Fri, 2 May 2025 08:16:43 +0000 (10:16 +0200)
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>
drivers/media/platform/renesas/vsp1/vsp1_iif.h
drivers/media/platform/renesas/vsp1/vsp1_rpf.c
drivers/media/platform/renesas/vsp1/vsp1_wpf.c

index 165996a822c1baab1fc40636884c9e7a67e4db07..46f327851c35966fb67c5afa24bd04e53cd49388 100644 (file)
@@ -12,6 +12,9 @@
 
 #include "vsp1_entity.h"
 
+#define VSPX_IIF_SINK_PAD_IMG          0
+#define VSPX_IIF_SINK_PAD_CONFIG       2
+
 struct vsp1_iif {
        struct vsp1_entity entity;
 };
index 5c8b3ba1bd3c2c7b9289f05c9c2578e9717c23ff..5e84536f0cdd84addba5f685da6c9ae349dca2cd 100644 (file)
@@ -84,7 +84,7 @@ static void rpf_configure_stream(struct vsp1_entity *entity,
        sink_format = v4l2_subdev_state_get_format(state, RWPF_PAD_SINK);
        source_format = v4l2_subdev_state_get_format(state, RWPF_PAD_SOURCE);
 
-       infmt = VI6_RPF_INFMT_CIPM
+       infmt = (pipe->iif ? 0 : VI6_RPF_INFMT_CIPM)
              | (fmtinfo->hwfmt << VI6_RPF_INFMT_RDFMT_SHIFT);
 
        if (fmtinfo->swap_yc)
@@ -98,6 +98,13 @@ static void rpf_configure_stream(struct vsp1_entity *entity,
        vsp1_rpf_write(rpf, dlb, VI6_RPF_INFMT, infmt);
        vsp1_rpf_write(rpf, dlb, VI6_RPF_DSWAP, fmtinfo->swap);
 
+       /* No further configuration for VSPX. */
+       if (pipe->iif) {
+               /* VSPX wants alpha_sel to be set to 0. */
+               vsp1_rpf_write(rpf, dlb, VI6_RPF_ALPH_SEL, 0);
+               return;
+       }
+
        if (entity->vsp1->info->gen == 4) {
                u32 ext_infmt0;
                u32 ext_infmt1;
index da651a882bbb7e4d58f2dfea9dcea60a41f4f79c..f3ea3b17e4cb3126b191a46a2320ed44df0c9e58 100644 (file)
@@ -247,8 +247,11 @@ static void wpf_configure_stream(struct vsp1_entity *entity,
        sink_format = v4l2_subdev_state_get_format(state, RWPF_PAD_SINK);
        source_format = v4l2_subdev_state_get_format(state, RWPF_PAD_SOURCE);
 
-       /* Format */
-       if (!pipe->lif || wpf->writeback) {
+       /*
+        * Format configuration. Skip for IIF (VSPX) or if the pipe doesn't
+        * write to memory.
+        */
+       if (!pipe->iif && (!pipe->lif || wpf->writeback)) {
                const struct v4l2_pix_format_mplane *format = &wpf->format;
                const struct vsp1_format_info *fmtinfo = wpf->fmtinfo;
 
@@ -291,7 +294,7 @@ static void wpf_configure_stream(struct vsp1_entity *entity,
         * Sources. If the pipeline has a single input and BRx is not used,
         * configure it as the master layer. Otherwise configure all
         * inputs as sub-layers and select the virtual RPF as the master
-        * layer.
+        * layer. For VSPX configure the enabled sources as masters.
         */
        for (i = 0; i < vsp1->info->rpf_count; ++i) {
                struct vsp1_rwpf *input = pipe->inputs[i];
@@ -299,7 +302,7 @@ static void wpf_configure_stream(struct vsp1_entity *entity,
                if (!input)
                        continue;
 
-               srcrpf |= (!pipe->brx && pipe->num_inputs == 1)
+               srcrpf |= (pipe->iif || (!pipe->brx && pipe->num_inputs == 1))
                        ? VI6_WPF_SRCRPF_RPF_ACT_MST(input->entity.index)
                        : VI6_WPF_SRCRPF_RPF_ACT_SUB(input->entity.index);
        }
@@ -316,6 +319,9 @@ static void wpf_configure_stream(struct vsp1_entity *entity,
        vsp1_dl_body_write(dlb, VI6_WPF_IRQ_ENB(index),
                           VI6_WPF_IRQ_ENB_DFEE);
 
+       if (pipe->iif)
+               return;
+
        /*
         * Configure writeback for display pipelines (the wpf writeback flag is
         * never set for memory-to-memory pipelines). Start by adding a chained