From 33c0fca893f032974e075b5930757749cb52a177 Mon Sep 17 00:00:00 2001 From: Sunmi Lee Date: Wed, 4 Jul 2018 13:57:42 +0900 Subject: [PATCH] [COMMON] fimc-is2: Added new argument in set_poly/post_scaler_coef function To support new method of setting scaler coefficient, new argumnet was added in function. PR JIRA ID: CPR-33 Change-Id: I322ffcd9ebd60dfe28ef57af827c81cd54d4ab3a Signed-off-by: Sunmi Lee --- .../hardware/api/fimc-is-hw-api-mcscaler-v2.h | 6 ++- .../api/fimc-is-hw-api-mcscaler-v5_0.c | 43 ++++++++++++++++++- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/exynos/fimc-is2/hardware/api/fimc-is-hw-api-mcscaler-v2.h b/drivers/media/platform/exynos/fimc-is2/hardware/api/fimc-is-hw-api-mcscaler-v2.h index 58c4e1435714..85fabb4dee06 100644 --- a/drivers/media/platform/exynos/fimc-is2/hardware/api/fimc-is-hw-api-mcscaler-v2.h +++ b/drivers/media/platform/exynos/fimc-is2/hardware/api/fimc-is-hw-api-mcscaler-v2.h @@ -108,7 +108,8 @@ void fimc_is_scaler_set_poly_scaling_ratio(void __iomem *base_addr, u32 output_i void fimc_is_scaler_set_h_init_phase_offset(void __iomem *base_addr, u32 output_id, u32 h_offset); void fimc_is_scaler_set_v_init_phase_offset(void __iomem *base_addr, u32 output_id, u32 v_offset); void fimc_is_scaler_set_poly_scaler_coef(void __iomem *base_addr, u32 output_id, - u32 hratio, u32 vratio, enum exynos_sensor_position sensor_position); + u32 hratio, u32 vratio, struct scaler_coef_cfg *sc_coef, + enum exynos_sensor_position sensor_position); void fimc_is_scaler_set_poly_round_mode(void __iomem *base_addr, u32 output_id, u32 mode); void fimc_is_scaler_set_post_scaler_enable(void __iomem *base_addr, u32 output_id, u32 enable); @@ -117,7 +118,8 @@ void fimc_is_scaler_get_post_img_size(void __iomem *base_addr, u32 output_id, u3 void fimc_is_scaler_set_post_dst_size(void __iomem *base_addr, u32 output_id, u32 width, u32 height); void fimc_is_scaler_get_post_dst_size(void __iomem *base_addr, u32 output_id, u32 *width, u32 *height); void fimc_is_scaler_set_post_scaling_ratio(void __iomem *base_addr, u32 output_id, u32 hratio, u32 vratio); -void fimc_is_scaler_set_post_scaler_coef(void __iomem *base_addr, u32 output_id, u32 hratio, u32 vratio); +void fimc_is_scaler_set_post_scaler_coef(void __iomem *base_addr, u32 output_id, + u32 hratio, u32 vratio, struct scaler_coef_cfg *sc_coef); void fimc_is_scaler_set_post_round_mode(void __iomem *base_addr, u32 output_id, u32 mode); void fimc_is_scaler_set_420_conversion(void __iomem *base_addr, u32 output_id, u32 conv420_weight, u32 conv420_en); diff --git a/drivers/media/platform/exynos/fimc-is2/hardware/api/fimc-is-hw-api-mcscaler-v5_0.c b/drivers/media/platform/exynos/fimc-is2/hardware/api/fimc-is-hw-api-mcscaler-v5_0.c index 47c065a3ca14..ff93458de149 100644 --- a/drivers/media/platform/exynos/fimc-is2/hardware/api/fimc-is-hw-api-mcscaler-v5_0.c +++ b/drivers/media/platform/exynos/fimc-is2/hardware/api/fimc-is-hw-api-mcscaler-v5_0.c @@ -1261,13 +1261,38 @@ u32 get_scaler_coef_ver1(u32 ratio, bool adjust_coef) return coef; } +u32 get_scaler_coef_ver2(u32 ratio, struct scaler_coef_cfg *sc_coef) +{ + u32 coef; + + if (ratio <= RATIO_X8_8) + coef = sc_coef->ratio_x8_8; + else if (ratio > RATIO_X8_8 && ratio <= RATIO_X7_8) + coef = sc_coef->ratio_x7_8; + else if (ratio > RATIO_X7_8 && ratio <= RATIO_X6_8) + coef = sc_coef->ratio_x6_8; + else if (ratio > RATIO_X6_8 && ratio <= RATIO_X5_8) + coef = sc_coef->ratio_x5_8; + else if (ratio > RATIO_X5_8 && ratio <= RATIO_X4_8) + coef = sc_coef->ratio_x4_8; + else if (ratio > RATIO_X4_8 && ratio <= RATIO_X3_8) + coef = sc_coef->ratio_x3_8; + else if (ratio > RATIO_X3_8 && ratio <= RATIO_X2_8) + coef = sc_coef->ratio_x2_8; + else + coef = sc_coef->ratio_x2_8; + + return coef; +} + void fimc_is_scaler_set_poly_scaler_coef(void __iomem *base_addr, u32 output_id, - u32 hratio, u32 vratio, + u32 hratio, u32 vratio, struct scaler_coef_cfg *sc_coef, enum exynos_sensor_position sensor_position) { u32 h_coef = 0, v_coef = 0; /* this value equals 0 - scale-down operation */ u32 h_phase_offset = 0, v_phase_offset = 0; +#if defined(LHM_ENABLE_EVT0) bool adjust_coef = false; /* M/M dev team guided, x7/8 ~ x5/8 => x8/8 ~ x7/8 @@ -1279,6 +1304,12 @@ void fimc_is_scaler_set_poly_scaler_coef(void __iomem *base_addr, u32 output_id, h_coef = get_scaler_coef_ver1(hratio, adjust_coef); v_coef = get_scaler_coef_ver1(vratio, adjust_coef); +#else + if (sc_coef) { + h_coef = get_scaler_coef_ver2(hratio, sc_coef); + v_coef = get_scaler_coef_ver2(vratio, sc_coef); + } +#endif /* scale up case */ if (hratio < RATIO_X8_8) @@ -1588,14 +1619,22 @@ void fimc_is_scaler_set_post_scaler_h_v_coef(void __iomem *base_addr, u32 output } } -void fimc_is_scaler_set_post_scaler_coef(void __iomem *base_addr, u32 output_id, u32 hratio, u32 vratio) +void fimc_is_scaler_set_post_scaler_coef(void __iomem *base_addr, u32 output_id, + u32 hratio, u32 vratio, struct scaler_coef_cfg *sc_coef) { u32 h_coef = 0, v_coef = 0; /* this value equals 0 - scale-down operation */ u32 h_phase_offset = 0, v_phase_offset = 0; +#if defined(LHM_ENABLE_EVT0) h_coef = get_scaler_coef_ver1(hratio, false); v_coef = get_scaler_coef_ver1(vratio, false); +#else + if (sc_coef) { + h_coef = get_scaler_coef_ver2(hratio, sc_coef); + v_coef = get_scaler_coef_ver2(vratio, sc_coef); + } +#endif /* scale up case */ if (hratio < RATIO_X8_8) -- 2.20.1