[COMMON] fimc-is2: Code cleanup of hw-djag
authorSunmi Lee <carrotsm.lee@samsung.com>
Sun, 17 Jun 2018 08:18:54 +0000 (17:18 +0900)
committerSunyoung Kang <sy0816.kang@samsung.com>
Mon, 23 Jul 2018 08:05:23 +0000 (17:05 +0900)
Change-Id: I302f923ef12888de48b37f66c662910c13fbe492
Signed-off-by: Sunmi Lee <carrotsm.lee@samsung.com>
drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-djag.c
drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-mcscaler-v2.c

index b3537ca0afde2cb45fcf116bf6582ce4a8ad1792..73e1f7b1b3408d19f849f9152de162dee16c7d53 100644 (file)
@@ -104,7 +104,7 @@ int fimc_is_hw_mcsc_update_djag_register(struct fimc_is_hw_ip *hw_ip,
        u32 out_width = 0, out_height = 0;
        const struct djag_setfile_contents *djag_tuneset;
        u32 hratio, vratio, min_ratio;
-       u32 scale_index = MCSC_DJAG_PRESCALE_INDEX_1;
+       u32 scale_index = MCSC_DJAG_PRESCALE_INDEX_1, backup_in;
        enum exynos_sensor_position sensor_position;
        int output_id = 0;
 
@@ -116,6 +116,28 @@ int fimc_is_hw_mcsc_update_djag_register(struct fimc_is_hw_ip *hw_ip,
                return ret;
 
        hw_mcsc = (struct fimc_is_hw_mcsc *)hw_ip->priv_info;
+
+       backup_in = hw_mcsc->djag_input_source;
+       if (hw_ip->hardware->video_mode)
+               hw_mcsc->djag_input_source = DEV_HW_MCSC0;
+       else
+               hw_mcsc->djag_input_source = DEV_HW_MCSC1;
+
+       if (backup_in != hw_mcsc->djag_input_source)
+               sdbg_hw(0, "djag input_source changed %d-> %d\n", hw_ip,
+                       backup_in - DEV_HW_MCSC0, hw_mcsc->djag_input_source - DEV_HW_MCSC0);
+
+#ifdef ENABLE_DJAG_IN_MCSC
+       param->input.djag_out_width = 0;
+       param->input.djag_out_height = 0;
+#endif
+
+       fimc_is_scaler_set_djag_input_source(hw_ip->regs,
+                       hw_mcsc->djag_input_source - DEV_HW_MCSC0);
+
+       if (hw_mcsc->djag_input_source != hw_ip->id)
+               return ret;
+
        sensor_position = hw_ip->hardware->sensor_position[instance];
        djag_tuneset = &init_djag_cfgs;
 
@@ -159,8 +181,10 @@ int fimc_is_hw_mcsc_update_djag_register(struct fimc_is_hw_ip *hw_ip,
        else
                scale_index = MCSC_DJAG_PRESCALE_INDEX_4;
 
+#ifdef ENABLE_DJAG_IN_MCSC
        param->input.djag_out_width = out_width;
        param->input.djag_out_height = out_height;
+#endif
 
        sdbg_hw(2, "djag scale up (%dx%d) -> (%dx%d)\n", hw_ip,
                in_width, in_height, out_width, out_height);
index f8cc7c596f3e396301b3d184be0e41d5be76d704..2877059b2a9ca850da08c13ff6fbe0b6673a64ef 100644 (file)
@@ -791,11 +791,6 @@ static int fimc_is_hw_mcsc_shot(struct fimc_is_hw_ip *hw_ip, struct fimc_is_fram
        lindex = frame->shot->ctl.vendor_entry.lowIndexParam;
        hindex = frame->shot->ctl.vendor_entry.highIndexParam;
 
-       if (hardware->video_mode)
-               hw_mcsc->djag_input_source = DEV_HW_MCSC0;
-       else
-               hw_mcsc->djag_input_source = DEV_HW_MCSC1;
-
        hw_mcsc->back_param = param;
        hw_mcsc->back_lindex = lindex;
        hw_mcsc->back_hindex = hindex;
@@ -980,16 +975,7 @@ int fimc_is_hw_mcsc_update_param(struct fimc_is_hw_ip *hw_ip,
                ret = fimc_is_hw_mcsc_dma_input(hw_ip, &param->input, instance);
        }
 
-       if (cap->djag == MCSC_CAP_SUPPORT) {
-               fimc_is_scaler_set_djag_input_source(hw_ip->regs,
-                       hw_mcsc->djag_input_source - DEV_HW_MCSC0);
-
-               param->input.djag_out_width = 0;
-               param->input.djag_out_height = 0;
-
-               if (hw_mcsc->djag_input_source == hw_ip->id)
-                       fimc_is_hw_mcsc_update_djag_register(hw_ip, param, instance);   /* for DZoom */
-       }
+       fimc_is_hw_mcsc_update_djag_register(hw_ip, param, instance);   /* for DZoom */
 
        for (i = MCSC_OUTPUT0; i < cap->max_output; i++) {
                if (control_cmd || (lindex & LOWBIT_OF((i + PARAM_MCS_OUTPUT0)))