media: atomisp: get rid of most checks for ISP2401 version
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 30 Apr 2020 11:56:47 +0000 (13:56 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Wed, 20 May 2020 10:32:20 +0000 (12:32 +0200)
There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
35 files changed:
drivers/staging/media/atomisp/pci/atomisp_cmd.c
drivers/staging/media/atomisp/pci/base/refcount/src/refcount.c
drivers/staging/media/atomisp/pci/camera/pipe/src/pipe_binarydesc.c
drivers/staging/media/atomisp/pci/camera/util/src/util.c
drivers/staging/media/atomisp/pci/isp/kernels/dp/dp_1.0/ia_css_dp.host.c
drivers/staging/media/atomisp/pci/isp/kernels/dvs/dvs_1.0/ia_css_dvs.host.c
drivers/staging/media/atomisp/pci/isp/kernels/ipu2_io_ls/yuv444_io_ls/ia_css_yuv444_io.host.c
drivers/staging/media/atomisp/pci/isp/kernels/sc/sc_1.0/ia_css_sc.host.c
drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_3.0/ia_css_xnr3.host.c
drivers/staging/media/atomisp/pci/isp2400_system_global.h
drivers/staging/media/atomisp/pci/isp2401_system_global.h
drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c
drivers/staging/media/atomisp/pci/runtime/bufq/src/bufq.c
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c
drivers/staging/media/atomisp/pci/runtime/event/src/event.c
drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c
drivers/staging/media/atomisp/pci/runtime/ifmtr/src/ifmtr.c
drivers/staging/media/atomisp/pci/runtime/inputfifo/src/inputfifo.c
drivers/staging/media/atomisp/pci/runtime/isp_param/src/isp_param.c
drivers/staging/media/atomisp/pci/runtime/isys/src/csi_rx_rmgr.c
drivers/staging/media/atomisp/pci/runtime/isys/src/ibuf_ctrl_rmgr.c
drivers/staging/media/atomisp/pci/runtime/isys/src/isys_dma_rmgr.c
drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c
drivers/staging/media/atomisp/pci/runtime/isys/src/isys_stream2mmio_rmgr.c
drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c
drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c
drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c
drivers/staging/media/atomisp/pci/runtime/queue/src/queue_access.c
drivers/staging/media/atomisp/pci/runtime/rmgr/src/rmgr.c
drivers/staging/media/atomisp/pci/runtime/spctrl/src/spctrl.c
drivers/staging/media/atomisp/pci/runtime/timer/src/timer.c
drivers/staging/media/atomisp/pci/sh_css.c
drivers/staging/media/atomisp/pci/sh_css_firmware.c
drivers/staging/media/atomisp/pci/sh_css_mipi.c
drivers/staging/media/atomisp/pci/sh_css_params.c

index 9807460..5be690f 100644 (file)
@@ -4797,10 +4797,8 @@ static void __atomisp_update_stream_env(struct atomisp_sub_device *asd,
 {
        int i;
 
-#if defined(ISP2401_NEW_INPUT_SYSTEM)
        /* assign virtual channel id return from sensor driver query */
        asd->stream_env[stream_index].ch_id = stream_info->ch_id;
-#endif
        asd->stream_env[stream_index].isys_configs = stream_info->isys_configs;
        for (i = 0; i < stream_info->isys_configs; i++) {
                asd->stream_env[stream_index].isys_info[i].input_format =
index 97670fd..e39cc21 100644 (file)
@@ -196,9 +196,7 @@ bool ia_css_refcount_decrement(s32 id, hrt_vaddress ptr)
                             id, ptr, entry, entry->id, entry->count);
        else
                IA_CSS_ERROR("entry NULL\n");
-#ifdef ISP2401
        assert(false);
-#endif
 
        return false;
 }
@@ -246,14 +244,13 @@ void ia_css_refcount_clear(s32 id, clear_func clear_func_ptr)
                                                    "ia_css_refcount_clear: using hmm_free: no clear_func\n");
                                hmm_free(entry->data);
                        }
-#ifndef ISP2401
 
-#else
-                       assert(entry->count == 0);
-#endif
                        if (entry->count != 0) {
                                IA_CSS_WARNING("Ref count for entry %x is not zero!", entry->id);
                        }
+
+                       assert(entry->count == 0);
+
                        entry->data = mmgr_NULL;
                        entry->count = 0;
                        entry->id = 0;
index e4f42cb..c6b07d6 100644 (file)
@@ -57,10 +57,8 @@ static void pipe_binarydesc_get_offline(
        descr->enable_dz = true;
        descr->enable_xnr = false;
        descr->enable_dpc = false;
-#ifdef ISP2401
        descr->enable_luma_only = false;
        descr->enable_tnr = false;
-#endif
        descr->enable_capture_pp_bli = false;
        descr->enable_fractional_ds = false;
        descr->dvs_env.width = 0;
@@ -391,12 +389,10 @@ enum ia_css_err ia_css_pipe_get_video_binarydesc(
                    pipe->extra_config.enable_fractional_ds;
                video_descr->enable_dpc =
                    pipe->config.enable_dpc;
-#ifdef ISP2401
                video_descr->enable_luma_only =
                    pipe->config.enable_luma_only;
                video_descr->enable_tnr =
                    pipe->config.enable_tnr;
-#endif
 
                if (pipe->extra_config.enable_raw_binning) {
                        if (pipe->config.bayer_ds_out_res.width != 0 &&
@@ -603,27 +599,24 @@ void ia_css_pipe_get_primary_binarydesc(
                prim_descr->isp_pipe_version = pipe->config.isp_pipe_version;
                prim_descr->enable_fractional_ds =
                    pipe->extra_config.enable_fractional_ds;
-#ifdef ISP2401
                prim_descr->enable_luma_only =
                    pipe->config.enable_luma_only;
-#endif
                /* We have both striped and non-striped primary binaries,
                 * if continuous viewfinder is required, then we must select
                 * a striped one. Otherwise we prefer to use a non-striped
                 * since it has better performance. */
                if (pipe_version == IA_CSS_PIPE_VERSION_2_6_1)
                        prim_descr->striped = false;
-               else
-#ifndef ISP2401
+               else if (!atomisp_hw_is_isp2401) {
                        prim_descr->striped = prim_descr->continuous &&
                                              (!pipe->stream->stop_copy_preview || !pipe->stream->disable_cont_vf);
-#else
+               } else {
                        prim_descr->striped = prim_descr->continuous && !pipe->stream->disable_cont_vf;
 
-               if ((pipe->config.default_capture_config.enable_xnr != 0) &&
-                   (pipe->extra_config.enable_dvs_6axis == true))
-                       prim_descr->enable_xnr = true;
-#endif
+                       if ((pipe->config.default_capture_config.enable_xnr != 0) &&
+                           (pipe->extra_config.enable_dvs_6axis == true))
+                               prim_descr->enable_xnr = true;
+               }
        }
        IA_CSS_LEAVE_PRIVATE("");
 }
@@ -855,14 +848,15 @@ void ia_css_pipe_get_ldc_binarydesc(
        assert(out_info);
        IA_CSS_ENTER_PRIVATE("");
 
-#ifndef ISP2401
-       *in_info = *out_info;
-#else
-       if (pipe->out_yuv_ds_input_info.res.width)
-               *in_info = pipe->out_yuv_ds_input_info;
-       else
+       if (!atomisp_hw_is_isp2401) {
                *in_info = *out_info;
-#endif
+       } else {
+               if (pipe->out_yuv_ds_input_info.res.width)
+                       *in_info = pipe->out_yuv_ds_input_info;
+               else
+                       *in_info = *out_info;
+       }
+
        in_info->format = IA_CSS_FRAME_FORMAT_YUV420;
        in_info->raw_bit_depth = 0;
        ia_css_frame_info_set_width(in_info, in_info->res.width, 0);
index f14776f..217fe9c 100644 (file)
@@ -210,11 +210,9 @@ enum ia_css_err ia_css_util_check_input(
        if (!stream_config)
                return IA_CSS_ERR_INVALID_ARGUMENTS;
 
-#ifdef IS_ISP_2400_SYSTEM
        if (stream_config->input_config.effective_res.width == 0 ||
            stream_config->input_config.effective_res.height == 0)
                return IA_CSS_ERR_INVALID_ARGUMENTS;
-#endif
        if (must_be_raw &&
            !ia_css_util_is_input_format_raw(stream_config->input_config.format))
                return IA_CSS_ERR_INVALID_ARGUMENTS;
index 461ff18..9fb3744 100644 (file)
@@ -19,7 +19,6 @@
 
 #include "ia_css_dp.host.h"
 
-#ifdef ISP2401
 /* We use a different set of DPC configuration parameters when
  * DPC is used before OBC and NORM. Currently these parameters
  * are used in usecases which selects both BDS and DPC.
@@ -32,7 +31,7 @@ const struct ia_css_dp_config default_dp_10bpp_config = {
        32768,
        32768
 };
-#endif
+
 const struct ia_css_dp_config default_dp_config = {
        8192,
        2048,
index 2e438a4..d2c3e8e 100644 (file)
@@ -66,9 +66,6 @@ convert_coords_to_ispparams(
     unsigned int uv_flag)
 {
        unsigned int i, j;
-#ifndef ISP2401
-       /* Coverity CID 298073 - initialize */
-#endif
        gdc_warp_param_mem_t s = { 0 };
        unsigned int x00, x01, x10, x11,
                 y00, y01, y10, y11;
index cfec188..000cbe6 100644 (file)
 #include "sh_css_defs.h"
 #include "ia_css_debug.h"
 #include "assert_support.h"
-#ifdef ISP2401
-#include "math_support.h"      /* min() */
 
 #define IA_CSS_INCLUDE_CONFIGURATIONS
 #include "ia_css_isp_configs.h"
-#endif
 
 #include "ia_css_sc.host.h"
 
@@ -46,7 +43,7 @@ ia_css_sc_dump(
                            "sc_gain_shift", sc->gain_shift);
 }
 
-#ifdef ISP2401
+/* ISP2401 */
 void
 ia_css_sc_config(
     struct sh_css_isp_sc_isp_config *to,
@@ -70,6 +67,7 @@ ia_css_sc_config(
        to->internal_frame_origin_y_bqs_on_sctbl = internal_org_y_bqs;
 }
 
+/* ISP2401 */
 void
 ia_css_sc_configure(
     const struct ia_css_binary *binary,
@@ -84,7 +82,6 @@ ia_css_sc_configure(
        ia_css_configure_sc(binary, &config);
 }
 
-#endif
 /* ------ deprecated(bz675) : from ------ */
 /* It looks like @parameter{} (in *.pipe) is used to generate the process/get/set functions,
    for parameters which should be used in the isp kernels.
index e6c4e0f..4630cbd 100644 (file)
@@ -16,9 +16,7 @@
 #include "math_support.h"
 #include "sh_css_defs.h"
 #include "ia_css_types.h"
-#ifdef ISP2401
 #include "assert_support.h"
-#endif
 #include "ia_css_xnr3.host.h"
 
 /* Maximum value for alpha on ISP interface */
@@ -30,7 +28,6 @@
 #define XNR_MIN_SIGMA  (IA_CSS_XNR3_SIGMA_SCALE / 100)
 
 /*
-#ifdef ISP2401
  * division look-up table
  * Refers to XNR3.0.5
  */
@@ -79,27 +76,12 @@ static int32_t
 compute_alpha(int sigma)
 {
        s32 alpha;
-#if defined(XNR_ATE_ROUNDING_BUG)
-       s32 alpha_unscaled;
-#else
        int offset = sigma / 2;
-#endif
+
        if (sigma < XNR_MIN_SIGMA) {
                alpha = XNR_MAX_ALPHA;
        } else {
-#if defined(XNR_ATE_ROUNDING_BUG)
-               /* The scale factor for alpha must be the same as on the ISP,
-                * For sigma, it must match the public interface. The code
-                * below mimics the rounding and unintended loss of precision
-                * of the ATE reference code. It computes an unscaled alpha,
-                * rounds down, and then scales it to get the required fixed
-                * point representation. It would have been more precise to
-                * round after scaling. */
-               alpha_unscaled = IA_CSS_XNR3_SIGMA_SCALE / sigma;
-               alpha = alpha_unscaled * XNR_ALPHA_SCALE_FACTOR;
-#else
                alpha = ((IA_CSS_XNR3_SIGMA_SCALE * XNR_ALPHA_SCALE_FACTOR) + offset) / sigma;
-#endif
 
                if (alpha > XNR_MAX_ALPHA)
                        alpha = XNR_MAX_ALPHA;
@@ -200,7 +182,7 @@ ia_css_xnr3_encode(
        to->blending.strength = blending;
 }
 
-#ifdef ISP2401
+/* ISP2401 */
 /* (void) = ia_css_xnr3_vmem_encode(*to, *from)
  * -----------------------------------------------
  * VMEM Encode Function to translate UV parameters from userspace into ISP space
@@ -256,7 +238,6 @@ ia_css_xnr3_vmem_encode(
        }
 }
 
-#endif
 /* Dummy Function added as the tool expects it*/
 void
 ia_css_xnr3_debug_dtrace(
index 21938de..06fce25 100644 (file)
@@ -46,7 +46,6 @@
  * N.B. the 3 input formatters are of 2 different classess
  */
 
-#define IS_ISP_2400_SYSTEM
 /*
  * Since this file is visible everywhere and the system definition
  * macros are not, detect the separate definitions for {host, SP, ISP}
index 9c948cc..213b6ee 100644 (file)
@@ -52,7 +52,6 @@
 
 #define USE_INPUT_SYSTEM_VERSION_2401
 
-#define IS_ISP_2400_SYSTEM
 /*
  * Since this file is visible everywhere and the system definition
  * macros are not, detect the separate definitions for {host, SP, ISP}
index f510381..2a23b7c 100644 (file)
 #include "sh_css_legacy.h"
 
 #include "vf/vf_1.0/ia_css_vf.host.h"
-#ifdef ISP2401
 #include "sc/sc_1.0/ia_css_sc.host.h"
-#endif
 #include "sdis/sdis_1.0/ia_css_sdis.host.h"
-#ifdef ISP2401
 #include "fixedbds/fixedbds_1.0/ia_css_fixedbds_param.h"       /* FRAC_ACC */
-#endif
 
 #include "camera/pipe/interface/ia_css_pipe_binarydesc.h"
 
@@ -108,7 +104,7 @@ ia_css_binary_internal_res(const struct ia_css_frame_info *in_info,
                               binary_dvs_env.height);
 }
 
-#ifndef ISP2401
+/* ISP2400 */
 /* Computation results of the origin coordinate of bayer on the shading table. */
 struct sh_css_shading_table_bayer_origin_compute_results {
        u32 bayer_scale_hor_ratio_in;   /* Horizontal ratio (in) of bayer scaling. */
@@ -117,7 +113,9 @@ struct sh_css_shading_table_bayer_origin_compute_results {
        u32 bayer_scale_ver_ratio_out;  /* Vertical ratio (out) of bayer scaling. */
        u32 sc_bayer_origin_x_bqs_on_shading_table; /* X coordinate (in bqs) of bayer origin on shading table. */
        u32 sc_bayer_origin_y_bqs_on_shading_table; /* Y coordinate (in bqs) of bayer origin on shading table. */
-#else
+};
+
+/* ISP2401 */
 /* Requirements for the shading correction. */
 struct sh_css_binary_sc_requirements {
        /* Bayer scaling factor, for the scaling which is applied before shading correction. */
@@ -131,7 +129,6 @@ struct sh_css_binary_sc_requirements {
                                                                at shading correction. */
        u32 sensor_data_origin_y_bqs_on_internal; /* Y origin (in bqs) of sensor data on internal frame
                                                                at shading correction. */
-#endif
 };
 
 /* Get the requirements for the shading correction. */
index 87ce18f..7e01df2 100644 (file)
@@ -33,8 +33,6 @@ static char prefix[BUFQ_DUMP_FILE_NAME_PREFIX_SIZE] = {0};
 /* Global Queue objects used by CSS                      */
 /*********************************************************/
 
-#ifndef ISP2401
-
 struct sh_css_queues {
        /* Host2SP buffer queue */
        ia_css_queue_t host2sp_buffer_queue_handles
@@ -60,36 +58,6 @@ struct sh_css_queues {
        ia_css_queue_t host2sp_tag_cmd_queue_handle;
 };
 
-#else
-
-struct sh_css_queues {
-       /* Host2SP buffer queue */
-       ia_css_queue_t host2sp_buffer_queue_handles
-       [SH_CSS_MAX_SP_THREADS][SH_CSS_MAX_NUM_QUEUES];
-       /* SP2Host buffer queue */
-       ia_css_queue_t sp2host_buffer_queue_handles
-       [SH_CSS_MAX_NUM_QUEUES];
-
-       /* Host2SP event queue */
-       ia_css_queue_t host2sp_psys_event_queue_handle;
-
-       /* SP2Host event queue */
-       ia_css_queue_t sp2host_psys_event_queue_handle;
-
-#if !defined(HAS_NO_INPUT_SYSTEM)
-       /* Host2SP ISYS event queue */
-       ia_css_queue_t host2sp_isys_event_queue_handle;
-
-       /* SP2Host ISYS event queue */
-       ia_css_queue_t sp2host_isys_event_queue_handle;
-
-       /* Tagger command queue */
-       ia_css_queue_t host2sp_tag_cmd_queue_handle;
-#endif
-};
-
-#endif
-
 /*******************************************************
 *** Static variables
 ********************************************************/
index da0df52..3d7b024 100644 (file)
@@ -39,9 +39,8 @@
 #include "ia_css_isp_param.h"
 #include "sh_css_params.h"
 #include "ia_css_bufq.h"
-#ifdef ISP2401
+/* ISP2401 */
 #include "ia_css_queue.h"
-#endif
 
 #include "ia_css_isp_params.h"
 
@@ -3100,10 +3099,11 @@ ia_css_debug_dump_pipe_config(
        ia_css_debug_dump_resolution(&config->capt_pp_in_res,
                                     "capt_pp_in_res");
        ia_css_debug_dump_resolution(&config->vf_pp_in_res, "vf_pp_in_res");
-#ifdef ISP2401
-       ia_css_debug_dump_resolution(&config->output_system_in_res,
-                                    "output_system_in_res");
-#endif
+
+       if (atomisp_hw_is_isp2401) {
+               ia_css_debug_dump_resolution(&config->output_system_in_res,
+                                           "output_system_in_res");
+       }
        ia_css_debug_dump_resolution(&config->dvs_crop_out_res,
                                     "dvs_crop_out_res");
        for (i = 0; i < IA_CSS_PIPE_MAX_OUTPUT_STAGE; i++) {
@@ -3295,10 +3295,8 @@ static void debug_dump_one_trace(enum TRACE_CORE_ID proc_id)
        int i, j, max_trace_points, point_num, limit = -1;
        /* using a static buffer here as the driver has issues allocating memory */
        static u32 trace_read_buf[TRACE_BUFF_SIZE] = {0};
-#ifdef ISP2401
        static struct trace_header_t header;
        u8 *header_arr;
-#endif
 
        /* read the header and parse it */
        ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "~~~ Tracer ");
@@ -3329,27 +3327,27 @@ static void debug_dump_one_trace(enum TRACE_CORE_ID proc_id)
                                    "\t\ttraces are not supported for this processor ID - exiting\n");
                return;
        }
-#ifndef ISP2401
-       tmp = ia_css_device_load_uint32(start_addr);
-       point_num = (tmp >> 16) & 0xFFFF;
-#endif
 
-#ifndef ISP2401
-       ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, " ver %d %d points\n", tmp & 0xFF,
-                           point_num);
-       if ((tmp & 0xFF) != TRACER_VER) {
-#else
-       /* Loading byte-by-byte as using the master routine had issues */
-       header_arr = (uint8_t *)&header;
-       for (i = 0; i < (int)sizeof(struct trace_header_t); i++)
-               header_arr[i] = ia_css_device_load_uint8(start_addr + (i));
+       if (!atomisp_hw_is_isp2401) {
+               tmp = ia_css_device_load_uint32(start_addr);
+               point_num = (tmp >> 16) & 0xFFFF;
+
+               ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, " ver %d %d points\n", tmp & 0xFF,
+                                   point_num);
+       } else {
+               /* Loading byte-by-byte as using the master routine had issues */
+               header_arr = (uint8_t *)&header;
+               for (i = 0; i < (int)sizeof(struct trace_header_t); i++)
+                       header_arr[i] = ia_css_device_load_uint8(start_addr + (i));
 
-       point_num = header.max_tracer_points;
+               point_num = header.max_tracer_points;
 
-       ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, " ver %d %d points\n", header.version,
-                           point_num);
-       if ((header.version & 0xFF) != TRACER_VER) {
-#endif
+               ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, " ver %d %d points\n", header.version,
+                                   point_num);
+
+               tmp = header.version;
+       }
+       if ((tmp & 0xFF) != TRACER_VER) {
                ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "\t\tUnknown version - exiting\n");
                return;
        }
@@ -3364,21 +3362,20 @@ static void debug_dump_one_trace(enum TRACE_CORE_ID proc_id)
                if ((limit == (-1)) && (trace_read_buf[i] == 0))
                        limit = i;
        }
-#ifdef ISP2401
-       ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "Status:\n");
-       for (i = 0; i < SH_CSS_MAX_SP_THREADS; i++)
-               ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
-                                   "\tT%d: %3d (%02x)  %6d (%04x)  %10d (%08x)\n", i,
-                                   header.thr_status_byte[i], header.thr_status_byte[i],
-                                   header.thr_status_word[i], header.thr_status_word[i],
-                                   header.thr_status_dword[i], header.thr_status_dword[i]);
-       ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "Scratch:\n");
-       for (i = 0; i < MAX_SCRATCH_DATA; i++)
-               ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "%10d (%08x)  ",
-                                   header.scratch_debug[i], header.scratch_debug[i]);
-       ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "\n");
-
-#endif
+       if (atomisp_hw_is_isp2401) {
+               ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "Status:\n");
+               for (i = 0; i < SH_CSS_MAX_SP_THREADS; i++)
+                       ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
+                                           "\tT%d: %3d (%02x)  %6d (%04x)  %10d (%08x)\n", i,
+                                           header.thr_status_byte[i], header.thr_status_byte[i],
+                                           header.thr_status_word[i], header.thr_status_word[i],
+                                           header.thr_status_dword[i], header.thr_status_dword[i]);
+               ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "Scratch:\n");
+               for (i = 0; i < MAX_SCRATCH_DATA; i++)
+                       ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "%10d (%08x)  ",
+                                           header.scratch_debug[i], header.scratch_debug[i]);
+               ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "\n");
+       }
        /* two 0s in the beginning: empty buffer */
        if ((trace_read_buf[0] == 0) && (trace_read_buf[1] == 0)) {
                ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "\t\tEmpty tracer - exiting\n");
@@ -3398,114 +3395,83 @@ static void debug_dump_one_trace(enum TRACE_CORE_ID proc_id)
        for (i = 0; i < point_num; i++) {
                j = (limit + i) % point_num;
                if (trace_read_buf[j]) {
-#ifndef ISP2401
-                       TRACE_DUMP_FORMAT dump_format = FIELD_FORMAT_UNPACK(trace_read_buf[j]);
-#else
-
-                       tid_val = FIELD_TID_UNPACK(trace_read_buf[j]);
-                       dump_format = TRACE_DUMP_FORMAT_POINT;
-
-                       /*
-                        * When tid value is 111b, the data will be interpreted differently:
-                        * tid val is ignored, major field contains 2 bits (msb) for format type
-                        */
-                       if (tid_val == FIELD_TID_SEL_FORMAT_PAT) {
-                               dump_format = FIELD_FORMAT_UNPACK(trace_read_buf[j]);
+                       if (!atomisp_hw_is_isp2401) {
+                               TRACE_DUMP_FORMAT dump_format = FIELD_FORMAT_UNPACK(trace_read_buf[j]);
+                       } else {
+                               tid_val = FIELD_TID_UNPACK(trace_read_buf[j]);
+                               dump_format = TRACE_DUMP_FORMAT_POINT;
+
+                               /*
+                               * When tid value is 111b, the data will be interpreted differently:
+                               * tid val is ignored, major field contains 2 bits (msb) for format type
+                               */
+                               if (tid_val == FIELD_TID_SEL_FORMAT_PAT) {
+                                       dump_format = FIELD_FORMAT_UNPACK(trace_read_buf[j]);
+                               }
                        }
-#endif
                        switch (dump_format) {
                        case TRACE_DUMP_FORMAT_POINT:
                                ia_css_debug_dtrace(
-#ifndef ISP2401
                                    IA_CSS_DEBUG_TRACE, "\t\t%d %d:%d value - %d\n",
                                    j, FIELD_MAJOR_UNPACK(trace_read_buf[j]),
-#else
-                                   IA_CSS_DEBUG_TRACE, "\t\t%d T%d %d:%d value - %x (%d)\n",
-                                   j,
-                                   tid_val,
-                                   FIELD_MAJOR_UNPACK(trace_read_buf[j]),
-#endif
                                    FIELD_MINOR_UNPACK(trace_read_buf[j]),
-#ifdef ISP2401
-                                   FIELD_VALUE_UNPACK(trace_read_buf[j]),
-#endif
                                    FIELD_VALUE_UNPACK(trace_read_buf[j]));
                                break;
-#ifndef ISP2401
+                       /* ISP2400 */
                        case TRACE_DUMP_FORMAT_VALUE24_HEX:
-#else
-                       case TRACE_DUMP_FORMAT_POINT_NO_TID:
-#endif
                                ia_css_debug_dtrace(
-#ifndef ISP2401
                                    IA_CSS_DEBUG_TRACE, "\t\t%d, %d, 24bit value %x H\n",
-#else
-                                   IA_CSS_DEBUG_TRACE, "\t\t%d %d:%d value - %x (%d)\n",
-#endif
                                    j,
-#ifndef ISP2401
                                    FIELD_MAJOR_UNPACK(trace_read_buf[j]),
                                    FIELD_VALUE_24_UNPACK(trace_read_buf[j]));
-#else
+                               break;
+                       /* ISP2400 */
+                       case TRACE_DUMP_FORMAT_VALUE24_DEC:
+                               ia_css_debug_dtrace(
+                                   IA_CSS_DEBUG_TRACE, "\t\t%d, %d, 24bit value %d D\n",
+                                   j,
+                                   FIELD_MAJOR_UNPACK(trace_read_buf[j]),
+                                   FIELD_VALUE_24_UNPACK(trace_read_buf[j]));
+                               break;
+                       /* ISP2401 */
+                       case TRACE_DUMP_FORMAT_POINT_NO_TID:
+                               ia_css_debug_dtrace(
+                                   IA_CSS_DEBUG_TRACE, "\t\t%d %d:%d value - %x (%d)\n",
+                                   j,
                                    FIELD_MAJOR_W_FMT_UNPACK(trace_read_buf[j]),
                                    FIELD_MINOR_UNPACK(trace_read_buf[j]),
                                    FIELD_VALUE_UNPACK(trace_read_buf[j]),
                                    FIELD_VALUE_UNPACK(trace_read_buf[j]));
-#endif
                                break;
-#ifndef ISP2401
-                       case TRACE_DUMP_FORMAT_VALUE24_DEC:
-#else
+                       /* ISP2401 */
                        case TRACE_DUMP_FORMAT_VALUE24:
-#endif
                                ia_css_debug_dtrace(
-#ifndef ISP2401
-                                   IA_CSS_DEBUG_TRACE, "\t\t%d, %d, 24bit value %d D\n",
-#else
                                    IA_CSS_DEBUG_TRACE, "\t\t%d, %d, 24bit value %x (%d)\n",
-#endif
                                    j,
                                    FIELD_MAJOR_UNPACK(trace_read_buf[j]),
-#ifdef ISP2401
                                    FIELD_MAJOR_W_FMT_UNPACK(trace_read_buf[j]),
                                    FIELD_VALUE_24_UNPACK(trace_read_buf[j]),
-#endif
                                    FIELD_VALUE_24_UNPACK(trace_read_buf[j]));
                                break;
-#ifdef ISP2401
-
-#endif
                        case TRACE_DUMP_FORMAT_VALUE24_TIMING:
                                ia_css_debug_dtrace(
                                    IA_CSS_DEBUG_TRACE, "\t\t%d, %d, timing %x\n",
                                    j,
-#ifndef ISP2401
                                    FIELD_MAJOR_UNPACK(trace_read_buf[j]),
-#else
-                                   FIELD_MAJOR_W_FMT_UNPACK(trace_read_buf[j]),
-#endif
                                    FIELD_VALUE_24_UNPACK(trace_read_buf[j]));
                                break;
                        case TRACE_DUMP_FORMAT_VALUE24_TIMING_DELTA:
                                ia_css_debug_dtrace(
                                    IA_CSS_DEBUG_TRACE, "\t\t%d, %d, timing delta %x\n",
                                    j,
-#ifndef ISP2401
                                    FIELD_MAJOR_UNPACK(trace_read_buf[j]),
-#else
-                                   FIELD_MAJOR_W_FMT_UNPACK(trace_read_buf[j]),
-#endif
                                    FIELD_VALUE_24_UNPACK(trace_read_buf[j]));
                                break;
                        default:
                                ia_css_debug_dtrace(
                                    IA_CSS_DEBUG_TRACE,
                                    "no such trace dump format %d",
-#ifndef ISP2401
-                                   FIELD_FORMAT_UNPACK(trace_read_buf[j]));
-#else
                                    dump_format);
-#endif
                                break;
                        }
                }
@@ -3557,7 +3523,7 @@ void ia_css_debug_tagger_state(void)
 }
 #endif /* defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) */
 
-#ifdef ISP2401
+/* ISP2401 */
 void ia_css_debug_pc_dump(sp_ID_t id, unsigned int num_of_dumps)
 {
        unsigned int pc;
@@ -3572,7 +3538,6 @@ void ia_css_debug_pc_dump(sp_ID_t id, unsigned int num_of_dumps)
                ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "SP%-1d PC: 0x%X\n", id, pc);
        }
 }
-#endif
 
 #if defined(HRT_SCHED) || defined(SH_CSS_DEBUG_SPMEM_DUMP_SUPPORT)
 #include "spmem_dump.c"
index 74ad5f3..c457847 100644 (file)
@@ -1,7 +1,6 @@
-#ifndef ISP2401
 /*
  * Support for Intel Camera Imaging ISP subsystem.
- * Copyright (c) 2015, Intel Corporation.
+ * Copyright (c) 2010 - 2015, Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
  */
-#else
-/*
-Support for Intel Camera Imaging ISP subsystem.
-Copyright (c) 2010 - 2015, Intel Corporation.
-
-This program is free software; you can redistribute it and/or modify it
-under the terms and conditions of the GNU General Public License,
-version 2, as published by the Free Software Foundation.
-
-This program is distributed in the hope it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-more details.
-*/
-#endif
 
 #include "sh_css_sp.h"
 
index ab4ca17..fcd8b06 100644 (file)
@@ -1,4 +1,3 @@
-#ifndef ISP2401
 /*
  * Support for Intel Camera Imaging ISP subsystem.
  * Copyright (c) 2015, Intel Corporation.
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
  */
-#else
-/*
-Support for Intel Camera Imaging ISP subsystem.
-Copyright (c) 2010 - 2015, Intel Corporation.
-
-This program is free software; you can redistribute it and/or modify it
-under the terms and conditions of the GNU General Public License,
-version 2, as published by the Free Software Foundation.
-
-This program is distributed in the hope it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-more details.
-*/
-#endif
 
 #include "ia_css_frame.h"
 #include <math_support.h>
@@ -146,21 +130,12 @@ enum ia_css_err ia_css_frame_allocate(struct ia_css_frame **frame,
                return IA_CSS_ERR_INVALID_ARGUMENTS;
 
        ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
-#ifndef ISP2401
-                           "ia_css_frame_allocate() enter: width=%d, height=%d, format=%d\n",
-                           width, height, format);
-#else
                            "ia_css_frame_allocate() enter: width=%d, height=%d, format=%d, padded_width=%d, raw_bit_depth=%d\n",
                            width, height, format, padded_width, raw_bit_depth);
-#endif
 
        err = frame_allocate_with_data(frame, width, height, format,
                                       padded_width, raw_bit_depth, false);
 
-#ifndef ISP2401
-       ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
-                           "ia_css_frame_allocate() leave: frame=%p\n", *frame);
-#else
        if ((*frame) && err == IA_CSS_SUCCESS)
                ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
                                    "ia_css_frame_allocate() leave: frame=%p, data(DDR address)=0x%x\n", *frame,
@@ -169,7 +144,6 @@ enum ia_css_err ia_css_frame_allocate(struct ia_css_frame **frame,
                ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
                                    "ia_css_frame_allocate() leave: frame=%p, data(DDR address)=0x%x\n",
                                    (void *)-1, (unsigned int)-1);
-#endif
 
        return err;
 }
@@ -202,11 +176,7 @@ enum ia_css_err ia_css_frame_map(struct ia_css_frame **frame,
 
        if (err != IA_CSS_SUCCESS) {
                sh_css_free(me);
-#ifndef ISP2401
-               return err;
-#else
                me = NULL;
-#endif
        }
 
        *frame = me;
@@ -243,25 +213,17 @@ enum ia_css_err ia_css_frame_create_from_info(struct ia_css_frame **frame,
 
        err = ia_css_frame_init_planes(me);
 
-#ifndef ISP2401
-       if (err == IA_CSS_SUCCESS)
-               *frame = me;
-       else
-#else
        if (err != IA_CSS_SUCCESS) {
-#endif
                sh_css_free(me);
-#ifdef ISP2401
-       me = NULL;
-}
+               me = NULL;
+       }
 
-*frame = me;
-#endif
+       *frame = me;
 
-ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
-                   "ia_css_frame_create_from_info() leave:\n");
+       ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
+                           "ia_css_frame_create_from_info() leave:\n");
 
-return err;
+       return err;
 }
 
 enum ia_css_err ia_css_frame_set_data(struct ia_css_frame *frame,
@@ -306,13 +268,8 @@ enum ia_css_err ia_css_frame_allocate_contiguous(struct ia_css_frame **frame,
 
        ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
                            "ia_css_frame_allocate_contiguous() "
-#ifndef ISP2401
-                           "enter: width=%d, height=%d, format=%d\n",
-                           width, height, format);
-#else
                            "enter: width=%d, height=%d, format=%d, padded_width=%d, raw_bit_depth=%d\n",
                            width, height, format, padded_width, raw_bit_depth);
-#endif
 
        err = frame_allocate_with_data(frame, width, height, format,
                                       padded_width, raw_bit_depth, true);
@@ -581,11 +538,7 @@ enum ia_css_err ia_css_frame_allocate_with_buffer_size(
 
        if (err != IA_CSS_SUCCESS) {
                sh_css_free(me);
-#ifndef ISP2401
-               return err;
-#else
                me = NULL;
-#endif
        }
 
        *frame = me;
@@ -965,8 +918,7 @@ void ia_css_resolution_to_sp_resolution(
        to->height = (uint16_t)from->height;
 }
 
-#ifdef ISP2401
-
+/* ISP2401 */
 enum ia_css_err
 ia_css_frame_find_crop_resolution(const struct ia_css_resolution *in_res,
                                  const struct ia_css_resolution *out_res,
@@ -1035,4 +987,3 @@ ia_css_frame_find_crop_resolution(const struct ia_css_resolution *in_res,
                             crop_res->height, out_res->width, out_res->height);
        return IA_CSS_SUCCESS;
 }
-#endif
index cf55a01..7a18eae 100644 (file)
@@ -1,7 +1,6 @@
-#ifndef ISP2401
 /*
  * Support for Intel Camera Imaging ISP subsystem.
- * Copyright (c) 2015, Intel Corporation.
+ * Copyright (c) 2010 - 2015, Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
  */
-#else
-/*
-Support for Intel Camera Imaging ISP subsystem.
-Copyright (c) 2010 - 2015, Intel Corporation.
-
-This program is free software; you can redistribute it and/or modify it
-under the terms and conditions of the GNU General Public License,
-version 2, as published by the Free Software Foundation.
-
-This program is distributed in the hope it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-more details.
-*/
-#endif
 
 #include "system_global.h"
 #include <linux/kernel.h>
@@ -492,10 +476,6 @@ static void ifmtr_set_if_blocking_mode(
 
        assert(N_INPUT_FORMATTER_ID <= (ARRAY_SIZE(block)));
 
-#if !defined(IS_ISP_2400_SYSTEM)
-#error "ifmtr_set_if_blocking_mode: ISP_SYSTEM must be one of {IS_ISP_2400_SYSTEM}"
-#endif
-
        block[INPUT_FORMATTER0_ID] = (bool)config_a->block_no_reqs;
        if (config_b)
                block[INPUT_FORMATTER1_ID] = (bool)config_b->block_no_reqs;
index 57efa40..e5a339f 100644 (file)
@@ -1,7 +1,6 @@
-#ifndef ISP2401
 /*
  * Support for Intel Camera Imaging ISP subsystem.
- * Copyright (c) 2015, Intel Corporation.
+ * Copyright (c) 2010 - 2015, Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
  */
-#else
-/*
-Support for Intel Camera Imaging ISP subsystem.
-Copyright (c) 2010 - 2015, Intel Corporation.
-
-This program is free software; you can redistribute it and/or modify it
-under the terms and conditions of the GNU General Public License,
-version 2, as published by the Free Software Foundation.
-
-This program is distributed in the hope it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-more details.
-*/
-#endif
 
 #include "platform_support.h"
 
@@ -195,38 +179,6 @@ static void inputfifo_send_eof(void)
        return;
 }
 
-#ifdef __ON__
-static void inputfifo_send_ch_id(
-    /* static inline void inputfifo_send_ch_id( */
-    unsigned int ch_id)
-{
-       hrt_data        token;
-
-       inputfifo_curr_ch_id = ch_id & _HIVE_ISP_CH_ID_MASK;
-       /* we send an zero marker, this will wrap the ch_id and
-        * fmt_type automatically.
-        */
-       token = inputfifo_wrap_marker(0);
-       _sh_css_fifo_snd(token);
-       return;
-}
-
-static void inputfifo_send_fmt_type(
-    /* static inline void inputfifo_send_fmt_type( */
-    unsigned int fmt_type)
-{
-       hrt_data        token;
-
-       inputfifo_curr_fmt_type = fmt_type & _HIVE_ISP_FMT_TYPE_MASK;
-       /* we send an zero marker, this will wrap the ch_id and
-        * fmt_type automatically.
-        */
-       token = inputfifo_wrap_marker(0);
-       _sh_css_fifo_snd(token);
-       return;
-}
-#endif /*  __ON__ */
-
 static void inputfifo_send_ch_id_and_fmt_type(
     /* static inline
     void inputfifo_send_ch_id_and_fmt_type( */
index cab82a9..443e412 100644 (file)
@@ -1,7 +1,6 @@
-#ifndef ISP2401
 /*
  * Support for Intel Camera Imaging ISP subsystem.
- * Copyright (c) 2015, Intel Corporation.
+ * Copyright (c) 2010 - 2015, Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
  */
-#else
-/*
-Support for Intel Camera Imaging ISP subsystem.
-Copyright (c) 2010 - 2015, Intel Corporation.
-
-This program is free software; you can redistribute it and/or modify it
-under the terms and conditions of the GNU General Public License,
-version 2, as published by the Free Software Foundation.
-
-This program is distributed in the hope it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-more details.
-*/
-#endif
 
 #include "memory_access.h"
 #include "ia_css_pipeline.h"
index 06557c1..8f2ce2c 100644 (file)
@@ -1,7 +1,6 @@
-#ifndef ISP2401
 /*
  * Support for Intel Camera Imaging ISP subsystem.
- * Copyright (c) 2015, Intel Corporation.
+ * Copyright (c) 2010 - 2015, Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
  */
-#else
-/*
-Support for Intel Camera Imaging ISP subsystem.
-Copyright (c) 2010 - 2015, Intel Corporation.
-
-This program is free software; you can redistribute it and/or modify it
-under the terms and conditions of the GNU General Public License,
-version 2, as published by the Free Software Foundation.
-
-This program is distributed in the hope it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-more details.
-*/
-#endif
 
 #include "system_global.h"
 
index 7280477..9055ed3 100644 (file)
@@ -1,4 +1,3 @@
-#ifndef ISP2401
 /*
  * Support for Intel Camera Imaging ISP subsystem.
  * Copyright (c) 2015, Intel Corporation.
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
  */
-#else
-/*
- * Support for Intel Camera Imaging ISP subsystem.
- * Copyright (c) 2010 - 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- */
-#endif
 
 #include "system_global.h"
 
-#ifdef USE_INPUT_SYSTEM_VERSION_2401
-
 #include "assert_support.h"
 #include "platform_support.h"
 #include "ia_css_isys.h"
@@ -137,4 +119,3 @@ void ia_css_isys_ibuf_rmgr_release(
                }
        }
 }
-#endif
index 8ce2109..930fa7a 100644 (file)
@@ -1,7 +1,6 @@
-#ifndef ISP2401
 /*
  * Support for Intel Camera Imaging ISP subsystem.
- * Copyright (c) 2015, Intel Corporation.
+ * Copyright (c) 2010 - 2015, Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
  */
-#else
-/*
-Support for Intel Camera Imaging ISP subsystem.
-Copyright (c) 2010 - 2015, Intel Corporation.
-
-This program is free software; you can redistribute it and/or modify it
-under the terms and conditions of the GNU General Public License,
-version 2, as published by the Free Software Foundation.
-
-This program is distributed in the hope it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-more details.
-*/
-#endif
 
 #include "system_global.h"
 
index 5e7565c..b923233 100644 (file)
@@ -1,7 +1,6 @@
-#ifndef ISP2401
 /*
  * Support for Intel Camera Imaging ISP subsystem.
- * Copyright (c) 2015, Intel Corporation.
+ * Copyright (c) 2010 - 2015, Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
  */
-#else
-/*
-Support for Intel Camera Imaging ISP subsystem.
-Copyright (c) 2010 - 2015, Intel Corporation.
-
-This program is free software; you can redistribute it and/or modify it
-under the terms and conditions of the GNU General Public License,
-version 2, as published by the Free Software Foundation.
-
-This program is distributed in the hope it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-more details.
-*/
-#endif
 
 #include "input_system.h"
 
index 44b9bb8..53355a5 100644 (file)
@@ -1,7 +1,6 @@
-#ifndef ISP2401
 /*
  * Support for Intel Camera Imaging ISP subsystem.
- * Copyright (c) 2015, Intel Corporation.
+ * Copyright (c) 2010 - 2015, Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
  */
-#else
-/*
-Support for Intel Camera Imaging ISP subsystem.
-Copyright (c) 2010 - 2015, Intel Corporation.
-
-This program is free software; you can redistribute it and/or modify it
-under the terms and conditions of the GNU General Public License,
-version 2, as published by the Free Software Foundation.
-
-This program is distributed in the hope it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-more details.
-*/
-#endif
 
 #include "system_global.h"
 
index cf0a686..43665dd 100644 (file)
@@ -1,7 +1,6 @@
-#ifndef ISP2401
 /*
  * Support for Intel Camera Imaging ISP subsystem.
- * Copyright (c) 2015, Intel Corporation.
+ * Copyright (c) 2010 - 2015, Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
  */
-#else
-/*
-Support for Intel Camera Imaging ISP subsystem.
-Copyright (c) 2010 - 2015, Intel Corporation.
-
-This program is free software; you can redistribute it and/or modify it
-under the terms and conditions of the GNU General Public License,
-version 2, as published by the Free Software Foundation.
-
-This program is distributed in the hope it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-more details.
-*/
-#endif
 
 #define __INLINE_INPUT_SYSTEM__
 #include "input_system.h"
index ceef7d0..9a795a2 100644 (file)
@@ -1,4 +1,3 @@
-#ifndef ISP2401
 /*
  * Support for Intel Camera Imaging ISP subsystem.
  * Copyright (c) 2015, Intel Corporation.
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
  */
-#else
-/*
-Support for Intel Camera Imaging ISP subsystem.
-Copyright (c) 2010 - 2015, Intel Corporation.
-
-This program is free software; you can redistribute it and/or modify it
-under the terms and conditions of the GNU General Public License,
-version 2, as published by the Free Software Foundation.
-
-This program is distributed in the hope it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-more details.
-*/
-#endif
 
 #include "system_global.h"
 
@@ -45,9 +29,7 @@ more details.
  * Forwarded Declaration
  *
  *************************************************/
-#ifndef ISP2401
 
-#endif
 static bool create_input_system_channel(
     input_system_cfg_t *cfg,
     bool                       metadata,
index f6f364e..8b9982d 100644 (file)
@@ -1,7 +1,6 @@
-#ifndef ISP2401
 /*
  * Support for Intel Camera Imaging ISP subsystem.
- * Copyright (c) 2015, Intel Corporation.
+ * Copyright (c) 2010 - 2015, Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
  */
-#else
-/*
-Support for Intel Camera Imaging ISP subsystem.
-Copyright (c) 2010 - 2015, Intel Corporation.
-
-This program is free software; you can redistribute it and/or modify it
-under the terms and conditions of the GNU General Public License,
-version 2, as published by the Free Software Foundation.
-
-This program is distributed in the hope it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-more details.
-*/
-#endif
 
 #include "ia_css_debug.h"
 #include "sw_event_global.h"           /* encode_sw_event */
index 3b2a066..1e8d3eb 100644 (file)
@@ -1,7 +1,6 @@
-#ifndef ISP2401
 /*
  * Support for Intel Camera Imaging ISP subsystem.
- * Copyright (c) 2015, Intel Corporation.
+ * Copyright (c) 2010 - 2015, Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
  */
-#else
-/*
-Support for Intel Camera Imaging ISP subsystem.
-Copyright (c) 2010 - 2015, Intel Corporation.
-
-This program is free software; you can redistribute it and/or modify it
-under the terms and conditions of the GNU General Public License,
-version 2, as published by the Free Software Foundation.
-
-This program is distributed in the hope it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-more details.
-*/
-#endif
 
 #include "type_support.h"
 #include "queue_access.h"
index 370ff38..23ae19e 100644 (file)
@@ -1,7 +1,6 @@
-#ifndef ISP2401
 /*
  * Support for Intel Camera Imaging ISP subsystem.
- * Copyright (c) 2015, Intel Corporation.
+ * Copyright (c) 2010 - 2015, Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
  */
-#else
-/*
-Support for Intel Camera Imaging ISP subsystem.
-Copyright (c) 2010 - 2015, Intel Corporation.
-
-This program is free software; you can redistribute it and/or modify it
-under the terms and conditions of the GNU General Public License,
-version 2, as published by the Free Software Foundation.
-
-This program is distributed in the hope it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-more details.
-*/
-#endif
 
 #include "ia_css_rmgr.h"
 
index c409394..ceaac82 100644 (file)
@@ -1,7 +1,6 @@
-#ifndef ISP2401
 /*
  * Support for Intel Camera Imaging ISP subsystem.
- * Copyright (c) 2015, Intel Corporation.
+ * Copyright (c) 2010 - 2015, Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
  */
-#else
-/*
-Support for Intel Camera Imaging ISP subsystem.
-Copyright (c) 2010 - 2015, Intel Corporation.
-
-This program is free software; you can redistribute it and/or modify it
-under the terms and conditions of the GNU General Public License,
-version 2, as published by the Free Software Foundation.
-
-This program is distributed in the hope it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-more details.
-*/
-#endif
 
 #include "ia_css_types.h"
 #define __INLINE_SP__
@@ -115,7 +99,7 @@ enum ia_css_err ia_css_spctrl_load_fw(sp_ID_t sp_id,
        return IA_CSS_SUCCESS;
 }
 
-#ifdef ISP2401
+/* ISP2401 */
 /* reload pre-loaded FW */
 void sh_css_spctrl_reload_fw(sp_ID_t sp_id)
 {
@@ -127,7 +111,6 @@ void sh_css_spctrl_reload_fw(sp_ID_t sp_id)
        sp_ctrl_setbit(sp_id, SP_ICACHE_INV_REG, SP_ICACHE_INV_BIT);
        spctrl_loaded[sp_id] = true;
 }
-#endif
 
 hrt_vaddress get_sp_code_addr(sp_ID_t  sp_id)
 {
index fe1e530..57dddd7 100644 (file)
@@ -1,4 +1,3 @@
-#ifndef ISP2401
 /*
  * Support for Intel Camera Imaging ISP subsystem.
  * Copyright (c) 2015, Intel Corporation.
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
  */
-#else
-/*
-Support for Intel Camera Imaging ISP subsystem.
-Copyright (c) 2010 - 2015, Intel Corporation.
-
-This program is free software; you can redistribute it and/or modify it
-under the terms and conditions of the GNU General Public License,
-version 2, as published by the Free Software Foundation.
-
-This program is distributed in the hope it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-more details.
-*/
-#endif
 
 #include <type_support.h>              /* for uint32_t */
 #include "ia_css_timer.h" /*struct ia_css_clock_tick */
index 46a5e6e..27cbc57 100644 (file)
@@ -580,13 +580,11 @@ sh_css_config_input_network(struct ia_css_stream *stream) {
                vblank_cycles = vblank_lines * (width + hblank_cycles);
                sh_css_sp_configure_sync_gen(width, height, hblank_cycles,
                                             vblank_cycles);
-#if defined(IS_ISP_2400_SYSTEM)
                if (pipe->stream->config.mode == IA_CSS_INPUT_MODE_TPG) {
                        /* TODO: move define to proper file in tools */
 #define GP_ISEL_TPG_MODE 0x90058
                        ia_css_device_store_uint32(GP_ISEL_TPG_MODE, 0);
                }
-#endif
        }
        ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
                            "sh_css_config_input_network() leave:\n");
index b0b8c2c..fd2cefd 100644 (file)
@@ -52,12 +52,8 @@ static struct firmware_header *firmware_header;
 /* The string STR is a place holder
  * which will be replaced with the actual RELEASE_VERSION
  * during package generation. Please do not modify  */
-#ifndef ISP2401
-static const char *release_version = STR(
-       irci_stable_candrpv_0415_20150521_0458);
-#else
-static const char *release_version = STR(irci_ecr - master_20150911_0724);
-#endif
+static const char *isp2400_release_version = STR(irci_stable_candrpv_0415_20150521_0458);
+static const char *isp2401_release_version = STR(irci_ecr - master_20150911_0724);
 
 #define MAX_FW_REL_VER_NAME    300
 static char FW_rel_ver_name[MAX_FW_REL_VER_NAME] = "---";
@@ -189,6 +185,13 @@ sh_css_check_firmware_version(const char *fw_data)
 {
        struct sh_css_fw_bi_file_h *file_header;
 
+       const char *release_version;
+
+       if (!atomisp_hw_is_isp2401)
+               release_version = isp2400_release_version;
+       else
+               release_version = isp2401_release_version;
+
        firmware_header = (struct firmware_header *)fw_data;
        file_header = &firmware_header->file_header;
 
@@ -207,21 +210,23 @@ sh_css_load_firmware(const char *fw_data,
        struct ia_css_fw_info *binaries;
        struct sh_css_fw_bi_file_h *file_header;
        bool valid_firmware = false;
+       const char *release_version;
+
+       if (!atomisp_hw_is_isp2401)
+               release_version = isp2400_release_version;
+       else
+               release_version = isp2401_release_version;
 
        firmware_header = (struct firmware_header *)fw_data;
        file_header = &firmware_header->file_header;
        binaries = &firmware_header->binary_header;
        strncpy(FW_rel_ver_name, file_header->version, min(sizeof(FW_rel_ver_name), sizeof(file_header->version)) - 1);
        valid_firmware = sh_css_check_firmware_version(fw_data);
-       if (!valid_firmware)
-       {
-#if !defined(HRT_RTL)
+       if (!valid_firmware) {
                IA_CSS_ERROR("CSS code version (%s) and firmware version (%s) mismatch!",
                             file_header->version, release_version);
                return IA_CSS_ERR_VERSION_MISMATCH;
-#endif
-       } else
-       {
+       } else {
                IA_CSS_LOG("successfully load firmware version %s", release_version);
        }
 
@@ -241,8 +246,7 @@ sh_css_load_firmware(const char *fw_data,
                    sizeof(*sh_css_blob_info), GFP_KERNEL);
                if (!sh_css_blob_info)
                        return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
-       } else
-       {
+       } else {
                sh_css_blob_info = NULL;
        }
 
index ef9360d..35cbef5 100644 (file)
@@ -45,8 +45,6 @@ ia_css_mipi_frame_specify(const unsigned int size_mem_words,
        return err;
 }
 
-#ifdef ISP2401
-#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401)
 /*
  * Check if a source port or TPG/PRBS ID is valid
  */
@@ -87,9 +85,7 @@ static bool ia_css_mipi_is_source_port_valid(struct ia_css_pipe *pipe,
 
        return ret;
 }
-#endif
 
-#endif
 /* Assumptions:
  *     - A line is multiple of 4 bytes = 1 word.
  *     - Each frame has SOF and EOF (each 1 word).
@@ -317,10 +313,8 @@ calculate_mipi_buff_size(
        enum ia_css_err err = IA_CSS_SUCCESS;
 
        /**
-#ifndef ISP2401
         * zhengjie.lu@intel.com
         *
-#endif
         * NOTE
         * - In the struct "ia_css_stream_config", there
         *   are two members: "input_config" and "isys_config".
@@ -336,10 +330,8 @@ calculate_mipi_buff_size(
        /* end of NOTE */
 
        /**
-#ifndef ISP2401
         * zhengjie.lu@intel.com
         *
-#endif
         * NOTE
         * - The following code is derived from the
         *   existing code "ia_css_mipi_frame_calculate_size()".
@@ -396,16 +388,29 @@ calculate_mipi_buff_size(
        return err;
 }
 
+static bool buffers_needed(struct ia_css_pipe *pipe)
+{
+       if (!atomisp_hw_is_isp2401) {
+               if (pipe->stream->config.mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR)
+                       return false;
+               else
+                       return true;
+       }
+
+       if (pipe->stream->config.mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR ||
+           pipe->stream->config.mode == IA_CSS_INPUT_MODE_TPG ||
+           pipe->stream->config.mode == IA_CSS_INPUT_MODE_PRBS)
+               return false;
+
+       return true;
+}
+
 enum ia_css_err
 allocate_mipi_frames(struct ia_css_pipe *pipe,
                     struct ia_css_stream_info *info) {
 #if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401)
        enum ia_css_err err = IA_CSS_ERR_INTERNAL_ERROR;
-#ifndef ISP2401
        unsigned int port;
-#else
-       unsigned int port = 0;
-#endif
        struct ia_css_frame_info mipi_intermediate_info;
 
        ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
@@ -431,30 +436,22 @@ allocate_mipi_frames(struct ia_css_pipe *pipe,
        }
 
 #endif
-#ifndef ISP2401
-       if (pipe->stream->config.mode != IA_CSS_INPUT_MODE_BUFFERED_SENSOR)
-       {
-#else
-       if (!(pipe->stream->config.mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR ||
-             pipe->stream->config.mode == IA_CSS_INPUT_MODE_TPG ||
-             pipe->stream->config.mode == IA_CSS_INPUT_MODE_PRBS))
-       {
-#endif
+
+       if (!buffers_needed(pipe)) {
                ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
                                    "allocate_mipi_frames(%p) exit: no buffers needed for pipe mode.\n",
                                    pipe);
                return IA_CSS_SUCCESS; /* AM TODO: Check  */
        }
 
-#ifndef ISP2401
-       port = (unsigned int)pipe->stream->config.source.port.port;
+       if (!atomisp_hw_is_isp2401)
+               port = (unsigned int)pipe->stream->config.source.port.port;
+       else
+               err = ia_css_mipi_is_source_port_valid(pipe, &port);
+
        assert(port < N_CSI_PORTS);
-       if (port >= N_CSI_PORTS)
-       {
-#else
-       if (!ia_css_mipi_is_source_port_valid(pipe, &port))
-       {
-#endif
+
+       if (port >= N_CSI_PORTS || err) {
                ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
                                    "allocate_mipi_frames(%p) exit: error: port is not correct (port=%d).\n",
                                    pipe, port);
@@ -573,11 +570,8 @@ enum ia_css_err
 free_mipi_frames(struct ia_css_pipe *pipe) {
 #if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401)
        enum ia_css_err err = IA_CSS_ERR_INTERNAL_ERROR;
-#ifndef ISP2401
        unsigned int port;
-#else
-       unsigned int port = 0;
-#endif
+
        ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
                            "free_mipi_frames(%p) enter:\n", pipe);
 
@@ -592,38 +586,27 @@ free_mipi_frames(struct ia_css_pipe *pipe) {
                        return IA_CSS_ERR_INVALID_ARGUMENTS;
                }
 
-#ifndef ISP2401
-               if (pipe->stream->config.mode != IA_CSS_INPUT_MODE_BUFFERED_SENSOR) {
-#else
-               if (!(pipe->stream->config.mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR ||
-                     pipe->stream->config.mode == IA_CSS_INPUT_MODE_TPG ||
-                     pipe->stream->config.mode == IA_CSS_INPUT_MODE_PRBS)) {
-#endif
+               if (!buffers_needed(pipe)) {
                        ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
                                            "free_mipi_frames(%p) exit: error: wrong mode.\n",
                                            pipe);
                        return err;
                }
 
-#ifndef ISP2401
-               port = (unsigned int)pipe->stream->config.source.port.port;
+               if (!atomisp_hw_is_isp2401)
+                       port = (unsigned int)pipe->stream->config.source.port.port;
+               else
+                       err = ia_css_mipi_is_source_port_valid(pipe, &port);
+
                assert(port < N_CSI_PORTS);
-               if (port >= N_CSI_PORTS) {
-#else
-               if (!ia_css_mipi_is_source_port_valid(pipe, &port)) {
-#endif
+
+               if (port >= N_CSI_PORTS || err) {
                        ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
-#ifndef ISP2401
                                            "free_mipi_frames(%p, %d) exit: error: pipe port is not correct.\n",
-#else
-                                           "free_mipi_frames(%p) exit: error: pipe port is not correct (port=%d).\n",
-#endif
                                            pipe, port);
                        return err;
                }
-#ifdef ISP2401
 
-#endif
                if (ref_count_mipi_allocation[port] > 0) {
 #if defined(USE_INPUT_SYSTEM_VERSION_2)
                        assert(ref_count_mipi_allocation[port] == 1);
@@ -720,32 +703,22 @@ send_mipi_frames(struct ia_css_pipe *pipe) {
 
        /* multi stream video needs mipi buffers */
        /* nothing to be done in other cases. */
-#ifndef ISP2401
-       if (pipe->stream->config.mode != IA_CSS_INPUT_MODE_BUFFERED_SENSOR)
-       {
-#else
-       if (!(pipe->stream->config.mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR ||
-             pipe->stream->config.mode == IA_CSS_INPUT_MODE_TPG ||
-             pipe->stream->config.mode == IA_CSS_INPUT_MODE_PRBS))
-       {
-#endif
+       if (!buffers_needed(pipe)) {
                IA_CSS_LOG("nothing to be done for this mode");
                return IA_CSS_SUCCESS;
                /* TODO: AM: maybe this should be returning an error. */
        }
 
-#ifndef ISP2401
-       port = (unsigned int)pipe->stream->config.source.port.port;
+       if (!atomisp_hw_is_isp2401)
+               port = (unsigned int)pipe->stream->config.source.port.port;
+       else
+               err = ia_css_mipi_is_source_port_valid(pipe, &port);
+
        assert(port < N_CSI_PORTS);
-       if (port >= N_CSI_PORTS)
-       {
-               IA_CSS_ERROR("invalid port specified (%d)", port);
-#else
-       if (!ia_css_mipi_is_source_port_valid(pipe, &port))
-       {
+
+       if (port >= N_CSI_PORTS || err) {
                IA_CSS_ERROR("send_mipi_frames(%p) exit: invalid port specified (port=%d).\n",
                             pipe, port);
-#endif
                return err;
        }
 
index baa5259..2e719f7 100644 (file)
        (sizeof(char) * (binary)->in_frame_info.res.height * \
         (binary)->in_frame_info.padded_width)
 
-#ifndef ISP2401
-
-#define SCTBL_BYTES(binary) \
+#define ISP2400_SCTBL_BYTES(binary) \
        (sizeof(unsigned short) * (binary)->sctbl_height * \
         (binary)->sctbl_aligned_width_per_color * IA_CSS_SC_NUM_COLORS)
 
-#else
-
-#define SCTBL_BYTES(binary) \
+#define ISP2401_SCTBL_BYTES(binary) \
        (sizeof(unsigned short) * max((binary)->sctbl_height, (binary)->sctbl_legacy_height) * \
                        /* height should be the larger height between new api and legacy api */ \
         (binary)->sctbl_aligned_width_per_color * IA_CSS_SC_NUM_COLORS)
 
-#endif
-
 #define MORPH_PLANE_BYTES(binary) \
        (SH_CSS_MORPH_TABLE_ELEM_BYTES * (binary)->morph_tbl_aligned_width * \
         (binary)->morph_tbl_height)
@@ -2166,20 +2160,21 @@ ia_css_set_param_exceptions(const struct ia_css_pipe *pipe,
        params->dp_config.r  = params->wb_config.r;
        params->dp_config.b  = params->wb_config.b;
        params->dp_config.gb = params->wb_config.gb;
-#ifdef ISP2401
-       assert(pipe);
-       assert(pipe->mode < IA_CSS_PIPE_ID_NUM);
 
-       if (pipe->mode < IA_CSS_PIPE_ID_NUM) {
-               params->pipe_dp_config[pipe->mode].gr = params->wb_config.gr;
-               params->pipe_dp_config[pipe->mode].r  = params->wb_config.r;
-               params->pipe_dp_config[pipe->mode].b  = params->wb_config.b;
-               params->pipe_dp_config[pipe->mode].gb = params->wb_config.gb;
+       if (atomisp_hw_is_isp2401) {
+               assert(pipe);
+               assert(pipe->mode < IA_CSS_PIPE_ID_NUM);
+
+               if (pipe->mode < IA_CSS_PIPE_ID_NUM) {
+                       params->pipe_dp_config[pipe->mode].gr = params->wb_config.gr;
+                       params->pipe_dp_config[pipe->mode].r  = params->wb_config.r;
+                       params->pipe_dp_config[pipe->mode].b  = params->wb_config.b;
+                       params->pipe_dp_config[pipe->mode].gb = params->wb_config.gb;
+               }
        }
-#endif
 }
 
-#ifdef ISP2401
+/* ISP2401 */
 static void
 sh_css_set_dp_config(const struct ia_css_pipe *pipe,
                     struct ia_css_isp_parameters *params,
@@ -2200,7 +2195,6 @@ sh_css_set_dp_config(const struct ia_css_pipe *pipe,
        }
        IA_CSS_LEAVE_PRIVATE("void");
 }
-#endif
 
 static void
 sh_css_get_dp_config(const struct ia_css_pipe *pipe,
@@ -2630,15 +2624,16 @@ sh_css_init_isp_params_from_config(struct ia_css_pipe *pipe,
 
        params->output_frame = config->output_frame;
        params->isp_parameters_id = config->isp_config_id;
-#ifdef ISP2401
+
        /* Currently we do not offer CSS interface to set different
         * configurations for DPC, i.e. depending on DPC being enabled
         * before (NORM+OBC) or after. The folllowing code to set the
         * DPC configuration should be updated when this interface is made
         * available */
-       sh_css_set_dp_config(pipe, params, config->dp_config);
-       ia_css_set_param_exceptions(pipe, params);
-#endif
+       if (atomisp_hw_is_isp2401) {
+               sh_css_set_dp_config(pipe, params, config->dp_config);
+               ia_css_set_param_exceptions(pipe, params);
+       }
 
        if (IA_CSS_SUCCESS ==
            sh_css_select_dp_10bpp_config(pipe, &is_dp_10bpp))
@@ -2656,9 +2651,9 @@ sh_css_init_isp_params_from_config(struct ia_css_pipe *pipe,
                goto exit;
        }
 
-#ifndef ISP2401
-       ia_css_set_param_exceptions(pipe, params);
-#endif
+       if (!atomisp_hw_is_isp2401)
+               ia_css_set_param_exceptions(pipe, params);
+
 exit:
        IA_CSS_LEAVE_ERR_PRIVATE(err);
        return err;
@@ -3072,31 +3067,31 @@ sh_css_init_isp_params_from_global(struct ia_css_stream *stream,
                ia_css_set_tnr_config(params, &default_tnr_config);
                ia_css_set_ob_config(params, &default_ob_config);
                ia_css_set_dp_config(params, &default_dp_config);
-#ifndef ISP2401
-               ia_css_set_param_exceptions(pipe_in, params);
-#else
 
-               for (i = 0; i < stream->num_pipes; i++) {
-                       if (sh_css_select_dp_10bpp_config(stream->pipes[i],
-                                                         &is_dp_10bpp) == IA_CSS_SUCCESS) {
-                               /* set the return value as false if both DPC and
-                                * BDS is enabled by the user. But we do not return
-                                * the value immediately to enable internal firmware
-                                * feature testing. */
-                               if (is_dp_10bpp) {
-                                       sh_css_set_dp_config(stream->pipes[i], params, &default_dp_10bpp_config);
+               if (!atomisp_hw_is_isp2401) {
+                       ia_css_set_param_exceptions(pipe_in, params);
+               } else {
+                       for (i = 0; i < stream->num_pipes; i++) {
+                               if (sh_css_select_dp_10bpp_config(stream->pipes[i],
+                                                               &is_dp_10bpp) == IA_CSS_SUCCESS) {
+                                       /* set the return value as false if both DPC and
+                                       * BDS is enabled by the user. But we do not return
+                                       * the value immediately to enable internal firmware
+                                       * feature testing. */
+                                       if (is_dp_10bpp) {
+                                               sh_css_set_dp_config(stream->pipes[i], params, &default_dp_10bpp_config);
+                                       } else {
+                                               sh_css_set_dp_config(stream->pipes[i], params, &default_dp_config);
+                                       }
                                } else {
-                                       sh_css_set_dp_config(stream->pipes[i], params, &default_dp_config);
+                                       retval = false;
+                                       goto exit;
                                }
-                       } else {
-                               retval = false;
-                               goto exit;
-                       }
 
-                       ia_css_set_param_exceptions(stream->pipes[i], params);
+                               ia_css_set_param_exceptions(stream->pipes[i], params);
+                       }
                }
 
-#endif
                ia_css_set_de_config(params, &default_de_config);
                ia_css_set_gc_config(params, &default_gc_config);
                ia_css_set_anr_config(params, &default_anr_config);
@@ -3191,31 +3186,30 @@ sh_css_init_isp_params_from_global(struct ia_css_stream *stream,
                                 * BDS is enabled by the user. But we do not return
                                 * the value immediately to enable internal firmware
                                 * feature testing. */
-#ifndef ISP2401
-                               retval = !is_dp_10bpp;
-#else
+
                                if (is_dp_10bpp) {
                                        retval = false;
+                                       /* FIXME: should it ignore this error? */
                                }
                        } else {
                                retval = false;
                                goto exit;
                        }
-                       if (stream->pipes[i]->mode < IA_CSS_PIPE_ID_NUM) {
-                               sh_css_set_dp_config(stream->pipes[i], params,
-                                                    &stream_params->pipe_dp_config[stream->pipes[i]->mode]);
-                               ia_css_set_param_exceptions(stream->pipes[i], params);
-#endif
-                       } else {
-                               retval = false;
-                               goto exit;
+                       if (atomisp_hw_is_isp2401) {
+                               if (stream->pipes[i]->mode < IA_CSS_PIPE_ID_NUM) {
+                                       sh_css_set_dp_config(stream->pipes[i], params,
+                                                           &stream_params->pipe_dp_config[stream->pipes[i]->mode]);
+                                       ia_css_set_param_exceptions(stream->pipes[i], params);
+                               } else {
+                                       retval = false;
+                                       goto exit;
+                               }
                        }
                }
 
-#ifndef ISP2401
-               ia_css_set_param_exceptions(pipe_in, params);
+               if (!atomisp_hw_is_isp2401)
+                       ia_css_set_param_exceptions(pipe_in, params);
 
-#endif
                params->fpn_config.data = stream_params->fpn_config.data;
                params->config_changed[IA_CSS_FPN_ID] =
                    stream_params->config_changed[IA_CSS_FPN_ID];
@@ -3335,11 +3329,8 @@ enum ia_css_err ia_css_pipe_set_bci_scaler_lut(struct ia_css_pipe *pipe,
        const void *lut)
 {
        enum ia_css_err err = IA_CSS_SUCCESS;
-#ifndef ISP2401
-       bool store = true;
-#else
        bool stream_started = false;
-#endif
+
        IA_CSS_ENTER("pipe=%p lut=%p", pipe, lut);
 
        if (!lut || !pipe) {
@@ -3355,11 +3346,7 @@ enum ia_css_err ia_css_pipe_set_bci_scaler_lut(struct ia_css_pipe *pipe,
        if (pipe->stream && pipe->stream->started) {
                ia_css_debug_dtrace(IA_CSS_DEBUG_ERROR,
                                    "unable to set scaler lut since stream has started\n");
-#ifndef ISP2401
-               store = false;
-#else
                stream_started = true;
-#endif
                err = IA_CSS_ERR_NOT_SUPPORTED;
        }
 
@@ -3367,18 +3354,13 @@ enum ia_css_err ia_css_pipe_set_bci_scaler_lut(struct ia_css_pipe *pipe,
        sh_css_params_free_gdc_lut(pipe->scaler_pp_lut);
        pipe->scaler_pp_lut = mmgr_NULL;
 
-#ifndef ISP2401
-       if (store) {
-               pipe->scaler_pp_lut = mmgr_malloc(sizeof(zoom_table));
-#else
        if (!stream_started) {
-               pipe->scaler_pp_lut = sh_css_params_alloc_gdc_lut();
-#endif
+               if (!atomisp_hw_is_isp2401)
+                       pipe->scaler_pp_lut = mmgr_malloc(sizeof(zoom_table));
+               else
+                       pipe->scaler_pp_lut = sh_css_params_alloc_gdc_lut();
+
                if (pipe->scaler_pp_lut == mmgr_NULL) {
-#ifndef ISP2401
-                       IA_CSS_LEAVE("lut(%u) err=%d", pipe->scaler_pp_lut, err);
-                       return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
-#else
                        ia_css_debug_dtrace(IA_CSS_DEBUG_ERROR,
                                            "unable to allocate scaler_pp_lut\n");
                        err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
@@ -3388,15 +3370,7 @@ enum ia_css_err ia_css_pipe_set_bci_scaler_lut(struct ia_css_pipe *pipe,
                        mmgr_store(pipe->scaler_pp_lut,
                                   (int *)interleaved_lut_temp,
                                   sizeof(zoom_table));
-#endif
                }
-#ifndef ISP2401
-
-               gdc_lut_convert_to_isp_format((const int(*)[HRT_GDC_N])lut,
-                                             interleaved_lut_temp);
-               mmgr_store(pipe->scaler_pp_lut, (int *)interleaved_lut_temp,
-                          sizeof(zoom_table));
-#endif
        }
 
        IA_CSS_LEAVE("lut(%u) err=%d", pipe->scaler_pp_lut, err);
@@ -3426,11 +3400,11 @@ enum ia_css_err sh_css_params_map_and_store_default_gdc_lut(void)
 
        host_lut_store((void *)zoom_table);
 
-#ifndef ISP2401
-       default_gdc_lut = mmgr_malloc(sizeof(zoom_table));
-#else
-       default_gdc_lut = sh_css_params_alloc_gdc_lut();
-#endif
+       if (!atomisp_hw_is_isp2401)
+               default_gdc_lut = mmgr_malloc(sizeof(zoom_table));
+       else
+               default_gdc_lut = sh_css_params_alloc_gdc_lut();
+
        if (default_gdc_lut == mmgr_NULL)
                return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
 
@@ -4036,12 +4010,19 @@ sh_css_params_write_to_ddr_internal(
 
        if (binary->info->sp.enable.sc)
        {
-               u32 enable_conv = params->
-                                 shading_settings.enable_shading_table_conversion;
+               u32 enable_conv;
+               size_t bytes;
+
+               if (!atomisp_hw_is_isp2401)
+                       bytes = ISP2400_SCTBL_BYTES(binary);
+               else
+                       bytes = ISP2401_SCTBL_BYTES(binary);
+
+               enable_conv = params->shading_settings.enable_shading_table_conversion;
 
                buff_realloced = reallocate_buffer(&ddr_map->sc_tbl,
                                                   &ddr_map_size->sc_tbl,
-                                                  (size_t)(SCTBL_BYTES(binary)),
+                                                  bytes,
                                                   params->sc_table_changed,
                                                   &err);
                if (err != IA_CSS_SUCCESS) {
@@ -4125,11 +4106,12 @@ sh_css_params_write_to_ddr_internal(
                        }
                }
        }
-#ifdef ISP2401
+
        /* DPC configuration is made pipe specific to allow flexibility in positioning of the
         * DPC kernel. The code below sets the pipe specific configuration to
         * individual binaries. */
-       if (params->pipe_dpc_config_changed[pipe_id] && binary->info->sp.enable.dpc)
+       if (atomisp_hw_is_isp2401 &&
+           params->pipe_dpc_config_changed[pipe_id] && binary->info->sp.enable.dpc)
        {
                unsigned int size   =
                    stage->binary->info->mem_offsets.offsets.param->dmem.dp.size;
@@ -4141,15 +4123,13 @@ sh_css_params_write_to_ddr_internal(
                        ia_css_dp_encode((struct sh_css_isp_dp_params *)
                                         &binary->mem_params.params[IA_CSS_PARAM_CLASS_PARAM][IA_CSS_ISP_DMEM].address[offset],
                                         &params->pipe_dp_config[pipe_id], size);
-#endif
 
-#ifdef ISP2401
                        params->isp_params_changed = true;
                        params->isp_mem_params_changed[pipe_id][stage->stage_num][IA_CSS_ISP_DMEM] =
                            true;
                }
        }
-#endif
+
        if (params->config_changed[IA_CSS_MACC_ID] && binary->info->sp.enable.macc)
        {
                unsigned int i, j, idx;
@@ -4231,172 +4211,162 @@ sh_css_params_write_to_ddr_internal(
 
                        /* Generate default DVS unity table on start up*/
                        if (!params->pipe_dvs_6axis_config[pipe_id]) {
-#ifndef ISP2401
-                               struct ia_css_resolution dvs_offset;
+                               struct ia_css_resolution dvs_offset = {0};
 
-                               dvs_offset.width  =
-#else
-                               struct ia_css_resolution dvs_offset = {0, 0};
+                               if (!atomisp_hw_is_isp2401) {
+                                       dvs_offset.width = (PIX_SHIFT_FILTER_RUN_IN_X + binary->dvs_envelope.width) / 2;
+                               } else {
+                                       if (binary->dvs_envelope.width || binary->dvs_envelope.height) {
+                                               dvs_offset.width  = (PIX_SHIFT_FILTER_RUN_IN_X + binary->dvs_envelope.width) / 2;
+                                       }
+                               }
+                               dvs_offset.height = (PIX_SHIFT_FILTER_RUN_IN_Y + binary->dvs_envelope.height) / 2;
 
-                               if (binary->dvs_envelope.width || binary->dvs_envelope.height) {
-                                       dvs_offset.width  =
-#endif
-                                   (PIX_SHIFT_FILTER_RUN_IN_X + binary->dvs_envelope.width) / 2;
-#ifndef ISP2401
-                               dvs_offset.height =
-#else
-                               dvs_offset.height =
-#endif
-                                   (PIX_SHIFT_FILTER_RUN_IN_Y + binary->dvs_envelope.height) / 2;
-#ifdef ISP2401
-                       }
-#endif
+                               params->pipe_dvs_6axis_config[pipe_id] =
+                                   generate_dvs_6axis_table(&binary->out_frame_info[0].res, &dvs_offset);
+                               if (!params->pipe_dvs_6axis_config[pipe_id]) {
+                                       IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY);
+                                       return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
+                               }
+                               params->pipe_dvs_6axis_config_changed[pipe_id] = true;
 
-                       params->pipe_dvs_6axis_config[pipe_id] =
-                           generate_dvs_6axis_table(&binary->out_frame_info[0].res, &dvs_offset);
-                       if (!params->pipe_dvs_6axis_config[pipe_id]) {
-                               IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY);
-                               return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
+                               store_dvs_6axis_config(params->pipe_dvs_6axis_config[pipe_id],
+                                                   binary,
+                                                   dvs_in_frame_info,
+                                                   ddr_map->dvs_6axis_params_y);
+                               params->isp_params_changed = true;
                        }
-                       params->pipe_dvs_6axis_config_changed[pipe_id] = true;
                }
-
-               store_dvs_6axis_config(params->pipe_dvs_6axis_config[pipe_id],
-                                      binary,
-                                      dvs_in_frame_info,
-                                      ddr_map->dvs_6axis_params_y);
-               params->isp_params_changed = true;
        }
-}
 
-if (binary->info->sp.enable.ca_gdc)
-{
-       unsigned int i;
-       hrt_vaddress *virt_addr_tetra_x[
-        IA_CSS_MORPH_TABLE_NUM_PLANES];
-       size_t *virt_size_tetra_x[
-        IA_CSS_MORPH_TABLE_NUM_PLANES];
-       hrt_vaddress *virt_addr_tetra_y[
-        IA_CSS_MORPH_TABLE_NUM_PLANES];
-       size_t *virt_size_tetra_y[
-        IA_CSS_MORPH_TABLE_NUM_PLANES];
-
-       virt_addr_tetra_x[0] = &ddr_map->tetra_r_x;
-       virt_addr_tetra_x[1] = &ddr_map->tetra_gr_x;
-       virt_addr_tetra_x[2] = &ddr_map->tetra_gb_x;
-       virt_addr_tetra_x[3] = &ddr_map->tetra_b_x;
-       virt_addr_tetra_x[4] = &ddr_map->tetra_ratb_x;
-       virt_addr_tetra_x[5] = &ddr_map->tetra_batr_x;
-
-       virt_size_tetra_x[0] = &ddr_map_size->tetra_r_x;
-       virt_size_tetra_x[1] = &ddr_map_size->tetra_gr_x;
-       virt_size_tetra_x[2] = &ddr_map_size->tetra_gb_x;
-       virt_size_tetra_x[3] = &ddr_map_size->tetra_b_x;
-       virt_size_tetra_x[4] = &ddr_map_size->tetra_ratb_x;
-       virt_size_tetra_x[5] = &ddr_map_size->tetra_batr_x;
-
-       virt_addr_tetra_y[0] = &ddr_map->tetra_r_y;
-       virt_addr_tetra_y[1] = &ddr_map->tetra_gr_y;
-       virt_addr_tetra_y[2] = &ddr_map->tetra_gb_y;
-       virt_addr_tetra_y[3] = &ddr_map->tetra_b_y;
-       virt_addr_tetra_y[4] = &ddr_map->tetra_ratb_y;
-       virt_addr_tetra_y[5] = &ddr_map->tetra_batr_y;
-
-       virt_size_tetra_y[0] = &ddr_map_size->tetra_r_y;
-       virt_size_tetra_y[1] = &ddr_map_size->tetra_gr_y;
-       virt_size_tetra_y[2] = &ddr_map_size->tetra_gb_y;
-       virt_size_tetra_y[3] = &ddr_map_size->tetra_b_y;
-       virt_size_tetra_y[4] = &ddr_map_size->tetra_ratb_y;
-       virt_size_tetra_y[5] = &ddr_map_size->tetra_batr_y;
-
-       buff_realloced = false;
-       for (i = 0; i < IA_CSS_MORPH_TABLE_NUM_PLANES; i++) {
-               buff_realloced |=
-                   reallocate_buffer(virt_addr_tetra_x[i],
-                                     virt_size_tetra_x[i],
-                                     (size_t)
-                                     (MORPH_PLANE_BYTES(binary)),
-                                     params->morph_table_changed,
-                                     &err);
-               if (err != IA_CSS_SUCCESS) {
-                       IA_CSS_LEAVE_ERR_PRIVATE(err);
-                       return err;
-               }
-               buff_realloced |=
-                   reallocate_buffer(virt_addr_tetra_y[i],
-                                     virt_size_tetra_y[i],
-                                     (size_t)
-                                     (MORPH_PLANE_BYTES(binary)),
-                                     params->morph_table_changed,
-                                     &err);
-               if (err != IA_CSS_SUCCESS) {
-                       IA_CSS_LEAVE_ERR_PRIVATE(err);
-                       return err;
-               }
-       }
-       if (params->morph_table_changed || buff_realloced) {
-               const struct ia_css_morph_table *table = params->morph_table;
-               struct ia_css_morph_table *id_table = NULL;
-
-               if ((table) &&
-                   (table->width < binary->morph_tbl_width ||
-                    table->height < binary->morph_tbl_height)) {
-                       table = NULL;
-               }
-               if (!table) {
-                       err = sh_css_params_default_morph_table(&id_table,
-                                                               binary);
+       if (binary->info->sp.enable.ca_gdc)
+       {
+               unsigned int i;
+               hrt_vaddress *virt_addr_tetra_x[
+               IA_CSS_MORPH_TABLE_NUM_PLANES];
+               size_t *virt_size_tetra_x[
+               IA_CSS_MORPH_TABLE_NUM_PLANES];
+               hrt_vaddress *virt_addr_tetra_y[
+               IA_CSS_MORPH_TABLE_NUM_PLANES];
+               size_t *virt_size_tetra_y[
+               IA_CSS_MORPH_TABLE_NUM_PLANES];
+
+               virt_addr_tetra_x[0] = &ddr_map->tetra_r_x;
+               virt_addr_tetra_x[1] = &ddr_map->tetra_gr_x;
+               virt_addr_tetra_x[2] = &ddr_map->tetra_gb_x;
+               virt_addr_tetra_x[3] = &ddr_map->tetra_b_x;
+               virt_addr_tetra_x[4] = &ddr_map->tetra_ratb_x;
+               virt_addr_tetra_x[5] = &ddr_map->tetra_batr_x;
+
+               virt_size_tetra_x[0] = &ddr_map_size->tetra_r_x;
+               virt_size_tetra_x[1] = &ddr_map_size->tetra_gr_x;
+               virt_size_tetra_x[2] = &ddr_map_size->tetra_gb_x;
+               virt_size_tetra_x[3] = &ddr_map_size->tetra_b_x;
+               virt_size_tetra_x[4] = &ddr_map_size->tetra_ratb_x;
+               virt_size_tetra_x[5] = &ddr_map_size->tetra_batr_x;
+
+               virt_addr_tetra_y[0] = &ddr_map->tetra_r_y;
+               virt_addr_tetra_y[1] = &ddr_map->tetra_gr_y;
+               virt_addr_tetra_y[2] = &ddr_map->tetra_gb_y;
+               virt_addr_tetra_y[3] = &ddr_map->tetra_b_y;
+               virt_addr_tetra_y[4] = &ddr_map->tetra_ratb_y;
+               virt_addr_tetra_y[5] = &ddr_map->tetra_batr_y;
+
+               virt_size_tetra_y[0] = &ddr_map_size->tetra_r_y;
+               virt_size_tetra_y[1] = &ddr_map_size->tetra_gr_y;
+               virt_size_tetra_y[2] = &ddr_map_size->tetra_gb_y;
+               virt_size_tetra_y[3] = &ddr_map_size->tetra_b_y;
+               virt_size_tetra_y[4] = &ddr_map_size->tetra_ratb_y;
+               virt_size_tetra_y[5] = &ddr_map_size->tetra_batr_y;
+
+               buff_realloced = false;
+               for (i = 0; i < IA_CSS_MORPH_TABLE_NUM_PLANES; i++) {
+                       buff_realloced |=
+                           reallocate_buffer(virt_addr_tetra_x[i],
+                                           virt_size_tetra_x[i],
+                                           (size_t)
+                                           (MORPH_PLANE_BYTES(binary)),
+                                           params->morph_table_changed,
+                                           &err);
+                       if (err != IA_CSS_SUCCESS) {
+                               IA_CSS_LEAVE_ERR_PRIVATE(err);
+                               return err;
+                       }
+                       buff_realloced |=
+                           reallocate_buffer(virt_addr_tetra_y[i],
+                                           virt_size_tetra_y[i],
+                                           (size_t)
+                                           (MORPH_PLANE_BYTES(binary)),
+                                           params->morph_table_changed,
+                                           &err);
                        if (err != IA_CSS_SUCCESS) {
                                IA_CSS_LEAVE_ERR_PRIVATE(err);
                                return err;
                        }
-                       table = id_table;
                }
+               if (params->morph_table_changed || buff_realloced) {
+                       const struct ia_css_morph_table *table = params->morph_table;
+                       struct ia_css_morph_table *id_table = NULL;
+
+                       if ((table) &&
+                           (table->width < binary->morph_tbl_width ||
+                           table->height < binary->morph_tbl_height)) {
+                               table = NULL;
+                       }
+                       if (!table) {
+                               err = sh_css_params_default_morph_table(&id_table,
+                                                                       binary);
+                               if (err != IA_CSS_SUCCESS) {
+                                       IA_CSS_LEAVE_ERR_PRIVATE(err);
+                                       return err;
+                               }
+                               table = id_table;
+                       }
 
-               for (i = 0; i < IA_CSS_MORPH_TABLE_NUM_PLANES; i++) {
-                       store_morph_plane(table->coordinates_x[i],
-                                         table->width,
-                                         table->height,
-                                         *virt_addr_tetra_x[i],
-                                         binary->morph_tbl_aligned_width);
-                       store_morph_plane(table->coordinates_y[i],
-                                         table->width,
-                                         table->height,
-                                         *virt_addr_tetra_y[i],
-                                         binary->morph_tbl_aligned_width);
+                       for (i = 0; i < IA_CSS_MORPH_TABLE_NUM_PLANES; i++) {
+                               store_morph_plane(table->coordinates_x[i],
+                                               table->width,
+                                               table->height,
+                                               *virt_addr_tetra_x[i],
+                                               binary->morph_tbl_aligned_width);
+                               store_morph_plane(table->coordinates_y[i],
+                                               table->width,
+                                               table->height,
+                                               *virt_addr_tetra_y[i],
+                                               binary->morph_tbl_aligned_width);
+                       }
+                       if (id_table)
+                               ia_css_morph_table_free(id_table);
                }
-               if (id_table)
-                       ia_css_morph_table_free(id_table);
        }
-}
 
-/* After special cases like SC, FPN since they may change parameters */
-for (mem = 0; mem < N_IA_CSS_MEMORIES; mem++)
-{
-       const struct ia_css_isp_data *isp_data =
-           ia_css_isp_param_get_isp_mem_init(&binary->info->sp.mem_initializers,
-                                             IA_CSS_PARAM_CLASS_PARAM, mem);
-       size_t size = isp_data->size;
-
-       if (!size) continue;
-       buff_realloced = reallocate_buffer(&ddr_map->isp_mem_param[stage_num][mem],
-                                          &ddr_map_size->isp_mem_param[stage_num][mem],
-                                          size,
-                                          params->isp_mem_params_changed[pipe_id][stage_num][mem],
-                                          &err);
-       if (err != IA_CSS_SUCCESS) {
-               IA_CSS_LEAVE_ERR_PRIVATE(err);
-               return err;
-       }
-       if (params->isp_mem_params_changed[pipe_id][stage_num][mem] || buff_realloced) {
-               sh_css_update_isp_mem_params_to_ddr(binary,
-                                                   ddr_map->isp_mem_param[stage_num][mem],
-                                                   ddr_map_size->isp_mem_param[stage_num][mem], mem);
+       /* After special cases like SC, FPN since they may change parameters */
+       for (mem = 0; mem < N_IA_CSS_MEMORIES; mem++)
+       {
+               const struct ia_css_isp_data *isp_data =
+                   ia_css_isp_param_get_isp_mem_init(&binary->info->sp.mem_initializers,
+                                                   IA_CSS_PARAM_CLASS_PARAM, mem);
+               size_t size = isp_data->size;
+
+               if (!size) continue;
+               buff_realloced = reallocate_buffer(&ddr_map->isp_mem_param[stage_num][mem],
+                                               &ddr_map_size->isp_mem_param[stage_num][mem],
+                                               size,
+                                               params->isp_mem_params_changed[pipe_id][stage_num][mem],
+                                               &err);
+               if (err != IA_CSS_SUCCESS) {
+                       IA_CSS_LEAVE_ERR_PRIVATE(err);
+                       return err;
+               }
+               if (params->isp_mem_params_changed[pipe_id][stage_num][mem] || buff_realloced) {
+                       sh_css_update_isp_mem_params_to_ddr(binary,
+                                                           ddr_map->isp_mem_param[stage_num][mem],
+                                                           ddr_map_size->isp_mem_param[stage_num][mem], mem);
+               }
        }
-}
 
-IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_SUCCESS);
-return IA_CSS_SUCCESS;
+       IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_SUCCESS);
+       return IA_CSS_SUCCESS;
 }
 
 const struct ia_css_fpn_table *ia_css_get_fpn_table(struct ia_css_stream
@@ -4612,22 +4582,14 @@ free_ia_css_isp_parameter_set_info(
                        continue;
 
                /* sanity check - ptr must be valid */
-#ifndef ISP2401
                if (!ia_css_refcount_is_valid(addrs[i])) {
-#else
-               if (ia_css_refcount_is_valid(addrs[i])) {
-                       ia_css_refcount_decrement(IA_CSS_REFCOUNT_PARAM_BUFFER, addrs[i]);
-               } else {
-#endif
                        IA_CSS_ERROR("%s: IA_CSS_REFCOUNT_PARAM_BUFFER(0x%x) invalid arg", __func__,
                                     ptr);
                        err = IA_CSS_ERR_INVALID_ARGUMENTS;
                        continue;
                }
-#ifndef ISP2401
 
                ia_css_refcount_decrement(IA_CSS_REFCOUNT_PARAM_BUFFER, addrs[i]);
-#endif
        }
        ia_css_refcount_decrement(IA_CSS_REFCOUNT_PARAM_SET_POOL, ptr);