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>
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);
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);
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,
};
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;
#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,
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;
#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,