From 7c09a8c19aea501938874c3ddfcb1f46764a6a8a Mon Sep 17 00:00:00 2001 From: Sunmi Lee Date: Fri, 29 Jun 2018 15:50:37 +0900 Subject: [PATCH] [COMMON] fimc-is2: Modified and separated the function related to tdnr 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 --- .../hardware/fimc-is-hw-mcscaler-v2.c | 14 ++----- .../hardware/fimc-is-hw-mcscaler-v2.h | 2 + .../fimc-is2/hardware/fimc-is-hw-tdnr-v1.c | 37 +++++++++++++++++-- .../fimc-is2/hardware/fimc-is-hw-tdnr-v2.c | 34 ++++++++++++++++- 4 files changed, 70 insertions(+), 17 deletions(-) diff --git a/drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-mcscaler-v2.c b/drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-mcscaler-v2.c index 6a3c5ec4b91f..6be1bf88e2b9 100644 --- a/drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-mcscaler-v2.c +++ b/drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-mcscaler-v2.c @@ -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); diff --git a/drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-mcscaler-v2.h b/drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-mcscaler-v2.h index 3ebfe054bd67..64da6b62e387 100644 --- a/drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-mcscaler-v2.h +++ b/drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-mcscaler-v2.h @@ -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, diff --git a/drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-tdnr-v1.c b/drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-tdnr-v1.c index 6045befb8d98..6bd746a88c58 100644 --- a/drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-tdnr-v1.c +++ b/drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-tdnr-v1.c @@ -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, diff --git a/drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-tdnr-v2.c b/drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-tdnr-v2.c index e32b82e99193..fd24efa8717b 100644 --- a/drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-tdnr-v2.c +++ b/drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-tdnr-v2.c @@ -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, -- 2.20.1