]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
media: atomisp: sh_css_sp: Remove #ifdef ISP2401 to make driver generic
authorKate Hsuan <hpa@redhat.com>
Wed, 2 Aug 2023 09:56:01 +0000 (11:56 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Wed, 27 Sep 2023 07:40:04 +0000 (09:40 +0200)
Removed #ifdef ISP2401 to make the driver generic. The uncessary codes
were removed and the types of the ISP is determines in runtime.

Link: https://lore.kernel.org/r/20230802095606.1298152-8-hpa@redhat.com
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/staging/media/atomisp/pci/sh_css_sp.c
drivers/staging/media/atomisp/pci/sh_css_sp.h

index eba70d4800a1ebec9cd2d36c683c15aebb3d3471..cd7f5a3fecaa684b2c1076a7142d3bf373beab03 100644 (file)
@@ -17,9 +17,7 @@
 
 #include "sh_css_sp.h"
 
-#if !defined(ISP2401)
 #include "input_formatter.h"
-#endif
 
 #include "dma.h"       /* N_DMA_CHANNEL_ID */
 
@@ -228,11 +226,8 @@ sh_css_sp_start_binary_copy(unsigned int pipe_num,
        IA_CSS_LOG("pipe_id %d port_config %08x",
                   pipe->pipe_id, pipe->inout_port_config);
 
-#if !defined(ISP2401)
-       sh_css_sp_group.config.input_formatter.isp_2ppc = (uint8_t)two_ppc;
-#else
-       (void)two_ppc;
-#endif
+       if (!IS_ISP2401)
+               sh_css_sp_group.config.input_formatter.isp_2ppc = (uint8_t)two_ppc;
 
        sh_css_sp_stage.num = stage_num;
        sh_css_sp_stage.stage_type = SH_CSS_SP_STAGE_TYPE;
@@ -306,11 +301,8 @@ sh_css_sp_start_raw_copy(struct ia_css_frame *out_frame,
        IA_CSS_LOG("pipe_id %d port_config %08x",
                   pipe->pipe_id, pipe->inout_port_config);
 
-#if !defined(ISP2401)
-       sh_css_sp_group.config.input_formatter.isp_2ppc = (uint8_t)two_ppc;
-#else
-       (void)two_ppc;
-#endif
+       if (!IS_ISP2401)
+               sh_css_sp_group.config.input_formatter.isp_2ppc = (uint8_t)two_ppc;
 
        sh_css_sp_stage.num = stage_num;
        sh_css_sp_stage.xmem_bin_addr = 0x0;
@@ -655,7 +647,6 @@ void sh_css_sp_set_if_configs(
        return;
 }
 
-#if !defined(ISP2401)
 void
 sh_css_sp_program_input_circuit(int fmt_type,
                                int ch_id,
@@ -672,9 +663,7 @@ sh_css_sp_program_input_circuit(int fmt_type,
        sh_css_sp_group.config.input_circuit_cfg_changed = true;
        sh_css_sp_stage.program_input_circuit = true;
 }
-#endif
 
-#if !defined(ISP2401)
 void
 sh_css_sp_configure_sync_gen(int width, int height,
                             int hblank_cycles,
@@ -705,7 +694,6 @@ sh_css_sp_configure_prbs(int seed)
 {
        sh_css_sp_group.config.prbs.seed = seed;
 }
-#endif
 
 void
 sh_css_sp_configure_enable_raw_pool_locking(bool lock_all)
@@ -755,22 +743,18 @@ sh_css_sp_init_group(bool two_ppc,
                     bool no_isp_sync,
                     uint8_t if_config_index)
 {
-#if !defined(ISP2401)
-       sh_css_sp_group.config.input_formatter.isp_2ppc = two_ppc;
-#else
-       (void)two_ppc;
-#endif
+       if (!IS_ISP2401)
+               sh_css_sp_group.config.input_formatter.isp_2ppc = two_ppc;
 
        sh_css_sp_group.config.no_isp_sync = (uint8_t)no_isp_sync;
        /* decide whether the frame is processed online or offline */
        if (if_config_index == SH_CSS_IF_CONFIG_NOT_NEEDED) return;
-#if !defined(ISP2401)
-       assert(if_config_index < SH_CSS_MAX_IF_CONFIGS);
-       sh_css_sp_group.config.input_formatter.set[if_config_index].stream_format =
-           input_format;
-#else
-       (void)input_format;
-#endif
+
+       if (!IS_ISP2401) {
+               assert(if_config_index < SH_CSS_MAX_IF_CONFIGS);
+               sh_css_sp_group.config.input_formatter.set[if_config_index].stream_format =
+                   input_format;
+       }
 }
 
 void
@@ -1029,18 +1013,16 @@ sh_css_sp_init_stage(struct ia_css_binary *binary,
        if (err)
                return err;
 
-#ifdef ISP2401
-       pipe = find_pipe_by_num(sh_css_sp_group.pipe[thread_id].pipe_num);
-       if (!pipe)
-               return -EINVAL;
+       if (IS_ISP2401) {
+               pipe = find_pipe_by_num(sh_css_sp_group.pipe[thread_id].pipe_num);
+               if (!pipe)
+                       return -EINVAL;
 
-       if (args->in_frame)
-               ia_css_get_crop_offsets(pipe, &args->in_frame->frame_info);
-       else
-               ia_css_get_crop_offsets(pipe, &binary->in_frame_info);
-#else
-       (void)pipe; /*avoid build warning*/
-#endif
+               if (args->in_frame)
+                       ia_css_get_crop_offsets(pipe, &args->in_frame->frame_info);
+               else
+                       ia_css_get_crop_offsets(pipe, &binary->in_frame_info);
+       }
 
        err = configure_isp_from_args(&sh_css_sp_group.pipe[thread_id],
                                      binary, args, two_ppc, sh_css_sp_stage.deinterleaved);
index b052c40e69bc01828e563207d7e8eb9a66d8776e..36b693bd916a5046a1d0025cdfd70dbcb1454aad 100644 (file)
@@ -18,9 +18,7 @@
 
 #include <system_global.h>
 #include <type_support.h>
-#if !defined(ISP2401)
 #include "input_formatter.h"
-#endif
 
 #include "ia_css_binary.h"
 #include "ia_css_types.h"