115e2f1baSYong Zhi /* SPDX-License-Identifier: GPL-2.0 */
215e2f1baSYong Zhi /* Copyright (C) 2018 Intel Corporation */
315e2f1baSYong Zhi 
415e2f1baSYong Zhi #ifndef __IPU3_TABLES_H
515e2f1baSYong Zhi #define __IPU3_TABLES_H
615e2f1baSYong Zhi 
7cce8cccaSMauro Carvalho Chehab #include <linux/bitops.h>
8cce8cccaSMauro Carvalho Chehab 
915e2f1baSYong Zhi #include "ipu3-abi.h"
1015e2f1baSYong Zhi 
1115e2f1baSYong Zhi #define IMGU_BDS_GRANULARITY		32	/* Downscaling granularity */
1215e2f1baSYong Zhi #define IMGU_BDS_MIN_SF_INV		IMGU_BDS_GRANULARITY
1315e2f1baSYong Zhi #define IMGU_BDS_CONFIG_LEN		97
1415e2f1baSYong Zhi 
1515e2f1baSYong Zhi #define IMGU_SCALER_DOWNSCALE_4TAPS_LEN	128
1615e2f1baSYong Zhi #define IMGU_SCALER_DOWNSCALE_2TAPS_LEN	64
17cce8cccaSMauro Carvalho Chehab #define IMGU_SCALER_FP			BIT(31) /* 1.0 in fixed point */
1815e2f1baSYong Zhi 
1915e2f1baSYong Zhi #define IMGU_XNR3_VMEM_LUT_LEN		16
2015e2f1baSYong Zhi 
2115e2f1baSYong Zhi #define IMGU_GDC_LUT_UNIT		4
2215e2f1baSYong Zhi #define IMGU_GDC_LUT_LEN		256
2315e2f1baSYong Zhi 
2427b795adSYong Zhi struct imgu_css_bds_config {
2515e2f1baSYong Zhi 	struct imgu_abi_bds_phase_arr hor_phase_arr;
2615e2f1baSYong Zhi 	struct imgu_abi_bds_phase_arr ver_phase_arr;
2715e2f1baSYong Zhi 	struct imgu_abi_bds_ptrn_arr ptrn_arr;
2815e2f1baSYong Zhi 	u16 sample_patrn_length;
2915e2f1baSYong Zhi 	u8 hor_ds_en;
3015e2f1baSYong Zhi 	u8 ver_ds_en;
3115e2f1baSYong Zhi };
3215e2f1baSYong Zhi 
3327b795adSYong Zhi struct imgu_css_xnr3_vmem_defaults {
3415e2f1baSYong Zhi 	s16 x[IMGU_XNR3_VMEM_LUT_LEN];
3515e2f1baSYong Zhi 	s16 a[IMGU_XNR3_VMEM_LUT_LEN];
3615e2f1baSYong Zhi 	s16 b[IMGU_XNR3_VMEM_LUT_LEN];
3715e2f1baSYong Zhi 	s16 c[IMGU_XNR3_VMEM_LUT_LEN];
3815e2f1baSYong Zhi };
3915e2f1baSYong Zhi 
4027b795adSYong Zhi extern const struct imgu_css_bds_config
4127b795adSYong Zhi 			imgu_css_bds_configs[IMGU_BDS_CONFIG_LEN];
4227b795adSYong Zhi extern const s32 imgu_css_downscale_4taps[IMGU_SCALER_DOWNSCALE_4TAPS_LEN];
4327b795adSYong Zhi extern const s32 imgu_css_downscale_2taps[IMGU_SCALER_DOWNSCALE_2TAPS_LEN];
4427b795adSYong Zhi extern const s16 imgu_css_gdc_lut[IMGU_GDC_LUT_UNIT][IMGU_GDC_LUT_LEN];
4527b795adSYong Zhi extern const struct imgu_css_xnr3_vmem_defaults imgu_css_xnr3_vmem_defaults;
4627b795adSYong Zhi extern const struct ipu3_uapi_bnr_static_config imgu_css_bnr_defaults;
4727b795adSYong Zhi extern const struct ipu3_uapi_dm_config imgu_css_dm_defaults;
4827b795adSYong Zhi extern const struct ipu3_uapi_ccm_mat_config imgu_css_ccm_defaults;
4927b795adSYong Zhi extern const struct ipu3_uapi_gamma_corr_lut imgu_css_gamma_lut;
5027b795adSYong Zhi extern const struct ipu3_uapi_csc_mat_config imgu_css_csc_defaults;
5127b795adSYong Zhi extern const struct ipu3_uapi_cds_params imgu_css_cds_defaults;
5227b795adSYong Zhi extern const struct ipu3_uapi_shd_config_static imgu_css_shd_defaults;
5327b795adSYong Zhi extern const struct ipu3_uapi_yuvp1_iefd_config imgu_css_iefd_defaults;
5427b795adSYong Zhi extern const struct ipu3_uapi_yuvp1_yds_config imgu_css_yds_defaults;
5527b795adSYong Zhi extern const struct ipu3_uapi_yuvp1_chnr_config imgu_css_chnr_defaults;
5627b795adSYong Zhi extern const struct ipu3_uapi_yuvp1_y_ee_nr_config imgu_css_y_ee_nr_defaults;
5715e2f1baSYong Zhi extern const struct ipu3_uapi_yuvp2_tcc_gain_pcwl_lut_static_config
5827b795adSYong Zhi 						imgu_css_tcc_gain_pcwl_lut;
5915e2f1baSYong Zhi extern const struct ipu3_uapi_yuvp2_tcc_r_sqr_lut_static_config
6027b795adSYong Zhi 						imgu_css_tcc_r_sqr_lut;
6127b795adSYong Zhi extern const struct imgu_abi_anr_config imgu_css_anr_defaults;
6227b795adSYong Zhi extern const struct ipu3_uapi_awb_fr_config_s imgu_css_awb_fr_defaults;
6327b795adSYong Zhi extern const struct ipu3_uapi_ae_grid_config imgu_css_ae_grid_defaults;
6427b795adSYong Zhi extern const struct ipu3_uapi_ae_ccm imgu_css_ae_ccm_defaults;
6527b795adSYong Zhi extern const struct ipu3_uapi_af_config_s imgu_css_af_defaults;
6627b795adSYong Zhi extern const struct ipu3_uapi_awb_config_s imgu_css_awb_defaults;
6715e2f1baSYong Zhi 
6815e2f1baSYong Zhi #endif
69