[COMMON] fimc-is2: Modified and separated the function related to tdnr
authorSunmi Lee <carrotsm.lee@samsung.com>
Fri, 29 Jun 2018 06:50:37 +0000 (15:50 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:22:52 +0000 (20:22 +0300)
To increase the readability, hw_mcsc_tdnr_deinit function was added.
Also a conditonal sentence was added in tdnr_init function to check whether TDNR was supported or not.

Change-Id: Ie2317aae49a39311992e6280b518e999b0f5417d
Signed-off-by: Sunmi Lee <carrotsm.lee@samsung.com>
drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-mcscaler-v2.c
drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-mcscaler-v2.h
drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-tdnr-v1.c
drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-tdnr-v2.c

index 6a3c5ec4b91fa02655ed66069ad9c19c926c31d1..6be1bf88e2b91d5cdda94364832c9c5b976856c3 100644 (file)
@@ -463,6 +463,7 @@ static int fimc_is_hw_mcsc_disable(struct fimc_is_hw_ip *hw_ip, u32 instance, ul
        struct fimc_is_hw_mcsc_cap *cap = GET_MCSC_HW_CAP(hw_ip);
        struct fimc_is_hw_mcsc *hw_mcsc;
        struct fimc_is_hw_ip *hw_ip_ = NULL;
+       struct mcs_param *mcs_param;
 
        FIMC_BUG(!hw_ip);
        FIMC_BUG(!cap);
@@ -527,17 +528,8 @@ static int fimc_is_hw_mcsc_disable(struct fimc_is_hw_ip *hw_ip, u32 instance, ul
        fimc_is_scaler_clear_shadow_ctrl(hw_ip->regs, hw_ip->id);
 
        /* disable TDNR */
-       if (cap->tdnr == MCSC_CAP_SUPPORT) {
-               fimc_is_scaler_set_tdnr_mode_select(hw_ip->regs, TDNR_MODE_BYPASS);
-
-               fimc_is_scaler_clear_tdnr_rdma_addr(hw_ip->regs, TDNR_IMAGE);
-               fimc_is_scaler_clear_tdnr_rdma_addr(hw_ip->regs, TDNR_WEIGHT);
-
-               fimc_is_scaler_set_tdnr_wdma_enable(hw_ip->regs, TDNR_WEIGHT, false);
-               fimc_is_scaler_clear_tdnr_wdma_addr(hw_ip->regs, TDNR_WEIGHT);
-
-               hw_mcsc->cur_tdnr_mode = TDNR_MODE_BYPASS;
-       }
+       mcs_param = &hw_ip->region[instance]->parameter.mcs;
+       fimc_is_hw_mcsc_tdnr_deinit(hw_ip, mcs_param, instance);
 
        for (output_id = MCSC_OUTPUT0; output_id < cap->max_output; output_id++)
                set_bit(output_id, &mcsc_out_st);
index 3ebfe054bd679d3b90a9104cac7bf2926a45bba2..64da6b62e387c0e1277d7e8a925a2ed0fa35bc6a 100644 (file)
@@ -237,6 +237,8 @@ u32 fimc_is_scaler_get_idle_status(void __iomem *base_addr, u32 hw_id);
 
 void fimc_is_hw_mcsc_tdnr_init(struct fimc_is_hw_ip *hw_ip,
        struct mcs_param *mcs_param, u32 instance);
+void fimc_is_hw_mcsc_tdnr_deinit(struct fimc_is_hw_ip *hw_ip,
+       struct mcs_param *mcs_param, u32 instance);
 int fimc_is_hw_mcsc_update_tdnr_register(struct fimc_is_hw_ip *hw_ip,
        struct fimc_is_frame *frame,
        struct is_param_region *param,
index 6045befb8d9894f45b4cba4e941adfac687cb8f5..6bd746a88c58962e6c09ea6bc3aecfacf2c8d2fa 100644 (file)
@@ -83,17 +83,20 @@ static const struct tdnr_configs init_tdnr_cfgs = {
 };
 
 static void fimc_is_hw_mcsc_tdnr_init(struct fimc_is_hw_ip *hw_ip,
-       struct mcs_param *mcs_param,
-       u32 instance)
+       struct mcs_param *mcs_param, u32 instance)
 {
-#ifdef ENABLE_DNR_IN_MCSC
        struct fimc_is_hw_mcsc *hw_mcsc;
+       struct fimc_is_hw_mcsc_cap *cap;
 
        BUG_ON(!hw_ip->priv_info);
        BUG_ON(!mcs_param);
 
-       hw_mcsc = (struct fimc_is_hw_mcsc *)hw_ip->priv_info;
+       cap = GET_MCSC_HW_CAP(hw_ip);
+       if (cap->tdnr != MCSC_CAP_SUPPORT)
+               return;
 
+       hw_mcsc = (struct fimc_is_hw_mcsc *)hw_ip->priv_info;
+#ifdef ENABLE_DNR_IN_MCSC
        hw_mcsc->tdnr_first = MCSC_DNR_USE_FIRST;
        hw_mcsc->tdnr_output = MCSC_DNR_OUTPUT_INDEX;
        hw_mcsc->tdnr_internal_buf = MCSC_DNR_USE_INTERNAL_BUF;
@@ -122,6 +125,32 @@ static void fimc_is_hw_mcsc_tdnr_init(struct fimc_is_hw_ip *hw_ip,
 #endif
 }
 
+void fimc_is_hw_mcsc_tdnr_deinit(struct fimc_is_hw_ip *hw_ip,
+       struct mcs_param *mcs_param, u32 instance)
+{
+       struct fimc_is_hw_mcsc *hw_mcsc;
+       struct fimc_is_hw_mcsc_cap *cap;
+
+       BUG_ON(!hw_ip->priv_info);
+       BUG_ON(!mcs_param);
+
+       cap = GET_MCSC_HW_CAP(hw_ip);
+       if (cap->tdnr != MCSC_CAP_SUPPORT)
+               return;
+
+       hw_mcsc = (struct fimc_is_hw_mcsc *)hw_ip->priv_info;
+
+       fimc_is_scaler_set_tdnr_mode_select(hw_ip->regs, TDNR_MODE_BYPASS);
+
+       fimc_is_scaler_clear_tdnr_rdma_addr(hw_ip->regs, TDNR_IMAGE);
+       fimc_is_scaler_clear_tdnr_rdma_addr(hw_ip->regs, TDNR_WEIGHT);
+
+       fimc_is_scaler_set_tdnr_wdma_enable(hw_ip->regs, TDNR_WEIGHT, false);
+       fimc_is_scaler_clear_tdnr_wdma_addr(hw_ip->regs, TDNR_WEIGHT);
+
+       hw_mcsc->cur_tdnr_mode = TDNR_MODE_BYPASS;
+}
+
 static int fimc_is_hw_mcsc_check_tdnr_mode_pre(struct fimc_is_hw_ip *hw_ip,
        struct fimc_is_group *head,
        struct fimc_is_frame *frame,
index e32b82e99193e929c08fb8259def9142f5ad2208..fd24efa8717bcdd896ee864ee11b2ed23e885def 100644 (file)
@@ -85,14 +85,18 @@ static const struct tdnr_configs init_tdnr_cfgs = {
 void fimc_is_hw_mcsc_tdnr_init(struct fimc_is_hw_ip *hw_ip,
        struct mcs_param *mcs_param, u32 instance)
 {
-#ifdef ENABLE_DNR_IN_MCSC
        struct fimc_is_hw_mcsc *hw_mcsc;
+       struct fimc_is_hw_mcsc_cap *cap;
 
        BUG_ON(!hw_ip->priv_info);
        BUG_ON(!mcs_param);
 
-       hw_mcsc = (struct fimc_is_hw_mcsc *)hw_ip->priv_info;
+       cap = GET_MCSC_HW_CAP(hw_ip);
+       if (cap->tdnr != MCSC_CAP_SUPPORT)
+               return;
 
+       hw_mcsc = (struct fimc_is_hw_mcsc *)hw_ip->priv_info;
+#ifdef ENABLE_DNR_IN_MCSC
        hw_mcsc->tdnr_first = MCSC_DNR_USE_FIRST;
        hw_mcsc->tdnr_output = MCSC_DNR_OUTPUT_INDEX;
        hw_mcsc->tdnr_internal_buf = MCSC_DNR_USE_INTERNAL_BUF;
@@ -112,6 +116,32 @@ void fimc_is_hw_mcsc_tdnr_init(struct fimc_is_hw_ip *hw_ip,
 #endif
 }
 
+void fimc_is_hw_mcsc_tdnr_deinit(struct fimc_is_hw_ip *hw_ip,
+       struct mcs_param *mcs_param, u32 instance)
+{
+       struct fimc_is_hw_mcsc *hw_mcsc;
+       struct fimc_is_hw_mcsc_cap *cap;
+
+       BUG_ON(!hw_ip->priv_info);
+       BUG_ON(!mcs_param);
+
+       cap = GET_MCSC_HW_CAP(hw_ip);
+       if (cap->tdnr != MCSC_CAP_SUPPORT)
+               return;
+
+       hw_mcsc = (struct fimc_is_hw_mcsc *)hw_ip->priv_info;
+
+       fimc_is_scaler_set_tdnr_mode_select(hw_ip->regs, TDNR_MODE_BYPASS);
+
+       fimc_is_scaler_clear_tdnr_rdma_addr(hw_ip->regs, TDNR_IMAGE);
+       fimc_is_scaler_clear_tdnr_rdma_addr(hw_ip->regs, TDNR_WEIGHT);
+
+       fimc_is_scaler_set_tdnr_wdma_enable(hw_ip->regs, TDNR_WEIGHT, false);
+       fimc_is_scaler_clear_tdnr_wdma_addr(hw_ip->regs, TDNR_WEIGHT);
+
+       hw_mcsc->cur_tdnr_mode = TDNR_MODE_BYPASS;
+}
+
 static int fimc_is_hw_mcsc_check_tdnr_mode_pre(struct fimc_is_hw_ip *hw_ip,
        struct fimc_is_group *head,
        struct fimc_is_frame *frame,