OSDN Git Service

media: atomisp: get rid of ia_css_sc_param.h version dependency
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Wed, 29 Apr 2020 09:50:52 +0000 (11:50 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Wed, 20 May 2020 10:32:18 +0000 (12:32 +0200)
That's the last header file which had ifdefs for ISP2401.

The problem is that the conflicting dependencies were on another
file (sh_css_defs.h). Move the conflicting code to it, adding
a prefix which would describe what version the macro applies.

Then, ensure that binary.c will use the right version,
according with the hardware version.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sc/sc_1.0/ia_css_sc_param.h
drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/src/binary.c
drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_defs.h

index cc44b6a..38a6258 100644 (file)
 
 #include "type_support.h"
 
-/* To position the shading center grid point on the center of output image,
- * one more grid cell is needed as margin. */
-#define SH_CSS_SCTBL_CENTERING_MARGIN  1
-
-/* The shading table width and height are the number of grids, not cells. The last grid should be counted. */
-#define SH_CSS_SCTBL_LAST_GRID_COUNT   1
-
-#ifdef ISP2401
-/* Number of horizontal grids per color in the shading table. */
-#define _ISP_SCTBL_WIDTH_PER_COLOR(input_width, deci_factor_log2) \
-       (ISP_BQ_GRID_WIDTH(input_width, deci_factor_log2) + \
-       SH_CSS_SCTBL_CENTERING_MARGIN + SH_CSS_SCTBL_LAST_GRID_COUNT)
-
-/* Number of vertical grids per color in the shading table. */
-#define _ISP_SCTBL_HEIGHT(input_height, deci_factor_log2) \
-       (ISP_BQ_GRID_HEIGHT(input_height, deci_factor_log2) + \
-       SH_CSS_SCTBL_CENTERING_MARGIN + SH_CSS_SCTBL_LAST_GRID_COUNT)
-#endif
-
-/* Legacy API: Number of horizontal grids per color in the shading table. */
-#define _ISP_SCTBL_LEGACY_WIDTH_PER_COLOR(input_width, deci_factor_log2) \
-       (ISP_BQ_GRID_WIDTH(input_width, deci_factor_log2) + SH_CSS_SCTBL_LAST_GRID_COUNT)
-
-/* Legacy API: Number of vertical grids per color in the shading table. */
-#define _ISP_SCTBL_LEGACY_HEIGHT(input_height, deci_factor_log2) \
-       (ISP_BQ_GRID_HEIGHT(input_height, deci_factor_log2) + SH_CSS_SCTBL_LAST_GRID_COUNT)
-
 /* SC (Shading Corrction) */
 struct sh_css_isp_sc_params {
        s32 gain_shift;
index b500459..f510381 100644 (file)
@@ -1354,17 +1354,15 @@ ia_css_binary_fill_info(const struct ia_css_binary_xinfo *xinfo,
        if (info->enable.sc)
        {
                if (!atomisp_hw_is_isp2401) {
-                       binary->sctbl_width_per_color = _ISP_SCTBL_WIDTH_PER_COLOR(sc_3a_dis_padded_width, s3a_log_deci);
+                       binary->sctbl_width_per_color = _ISP2400_SCTBL_WIDTH_PER_COLOR(sc_3a_dis_padded_width, s3a_log_deci);
                        binary->sctbl_aligned_width_per_color = ISP2400_SH_CSS_MAX_SCTBL_ALIGNED_WIDTH_PER_COLOR;
-                       binary->sctbl_height = _ISP_SCTBL_HEIGHT(sc_3a_dis_height, s3a_log_deci);
+                       binary->sctbl_height = _ISP2400_SCTBL_HEIGHT(sc_3a_dis_height, s3a_log_deci);
                } else {
-                       binary->sctbl_width_per_color = _ISP_SCTBL_WIDTH_PER_COLOR(isp_internal_width, s3a_log_deci);
+                       binary->sctbl_width_per_color = _ISP2401_SCTBL_WIDTH_PER_COLOR(isp_internal_width, s3a_log_deci);
                        binary->sctbl_aligned_width_per_color = ISP2401_SH_CSS_MAX_SCTBL_ALIGNED_WIDTH_PER_COLOR;
-                       binary->sctbl_height = _ISP_SCTBL_HEIGHT(isp_internal_height, s3a_log_deci);
-#ifdef ISP2401
+                       binary->sctbl_height = _ISP2401_SCTBL_HEIGHT(isp_internal_height, s3a_log_deci);
                        binary->sctbl_legacy_width_per_color  = _ISP_SCTBL_LEGACY_WIDTH_PER_COLOR(sc_3a_dis_padded_width, s3a_log_deci);
                        binary->sctbl_legacy_height = _ISP_SCTBL_LEGACY_HEIGHT(sc_3a_dis_height, s3a_log_deci);
-#endif
                }
        } else
        {
index 611a522..fcd5081 100644 (file)
@@ -252,14 +252,40 @@ RGB[0,8191],coef[-8192,8191] -> RGB[0,8191]
        CEIL_MUL(_ISP_MORPH_TABLE_WIDTH(width), \
                 SH_CSS_MORPH_TABLE_ELEMS_PER_DDR_WORD)
 
-#define _ISP_SCTBL_WIDTH_PER_COLOR(input_width, deci_factor_log2) \
+#define _ISP2400_SCTBL_WIDTH_PER_COLOR(input_width, deci_factor_log2) \
        (ISP_BQ_GRID_WIDTH(input_width, deci_factor_log2) + 1)
-#define _ISP_SCTBL_HEIGHT(input_height, deci_factor_log2) \
+#define _ISP2400_SCTBL_HEIGHT(input_height, deci_factor_log2) \
        (ISP_BQ_GRID_HEIGHT(input_height, deci_factor_log2) + 1)
-#define _ISP_SCTBL_ALIGNED_WIDTH_PER_COLOR(input_width, deci_factor_log2) \
+#define _ISP2400_SCTBL_ALIGNED_WIDTH_PER_COLOR(input_width, deci_factor_log2) \
        CEIL_MUL(_ISP_SCTBL_WIDTH_PER_COLOR(input_width, deci_factor_log2), \
                 ISP_VEC_NELEMS)
 
+/* To position the shading center grid point on the center of output image,
+ * one more grid cell is needed as margin. */
+#define SH_CSS_SCTBL_CENTERING_MARGIN  1
+
+/* The shading table width and height are the number of grids, not cells. The last grid should be counted. */
+#define SH_CSS_SCTBL_LAST_GRID_COUNT   1
+
+/* Number of horizontal grids per color in the shading table. */
+#define _ISP2401_SCTBL_WIDTH_PER_COLOR(input_width, deci_factor_log2) \
+       (ISP_BQ_GRID_WIDTH(input_width, deci_factor_log2) + \
+       SH_CSS_SCTBL_CENTERING_MARGIN + SH_CSS_SCTBL_LAST_GRID_COUNT)
+
+/* Number of vertical grids per color in the shading table. */
+#define _ISP2401_SCTBL_HEIGHT(input_height, deci_factor_log2) \
+       (ISP_BQ_GRID_HEIGHT(input_height, deci_factor_log2) + \
+       SH_CSS_SCTBL_CENTERING_MARGIN + SH_CSS_SCTBL_LAST_GRID_COUNT)
+
+
+/* ISP2401: Legacy API: Number of horizontal grids per color in the shading table. */
+#define _ISP_SCTBL_LEGACY_WIDTH_PER_COLOR(input_width, deci_factor_log2) \
+       (ISP_BQ_GRID_WIDTH(input_width, deci_factor_log2) + SH_CSS_SCTBL_LAST_GRID_COUNT)
+
+/* ISP2401: Legacy API: Number of vertical grids per color in the shading table. */
+#define _ISP_SCTBL_LEGACY_HEIGHT(input_height, deci_factor_log2) \
+       (ISP_BQ_GRID_HEIGHT(input_height, deci_factor_log2) + SH_CSS_SCTBL_LAST_GRID_COUNT)
+
 
 /* *****************************************************************
  * Statistics for 3A (Auto Focus, Auto White Balance, Auto Exposure)