linux/drivers/media/platform/ti/vpe/sc.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2013 Texas Instruments Inc.
 *
 * David Griego, <[email protected]>
 * Dale Farnsworth, <[email protected]>
 * Archit Taneja, <[email protected]>
 */
#ifndef TI_SC_H
#define TI_SC_H

/* Scaler regs */
#define CFG_SC0
#define CFG_INTERLACE_O
#define CFG_LINEAR
#define CFG_SC_BYPASS
#define CFG_INVT_FID
#define CFG_USE_RAV
#define CFG_ENABLE_EV
#define CFG_AUTO_HS
#define CFG_DCM_2X
#define CFG_DCM_4X
#define CFG_HP_BYPASS
#define CFG_INTERLACE_I
#define CFG_ENABLE_SIN2_VER_INTP
#define CFG_Y_PK_EN
#define CFG_TRIM
#define CFG_SELFGEN_FID

#define CFG_SC1
#define CFG_ROW_ACC_INC_MASK
#define CFG_ROW_ACC_INC_SHIFT

#define CFG_SC2
#define CFG_ROW_ACC_OFFSET_MASK
#define CFG_ROW_ACC_OFFSET_SHIFT

#define CFG_SC3
#define CFG_ROW_ACC_OFFSET_B_MASK
#define CFG_ROW_ACC_OFFSET_B_SHIFT

#define CFG_SC4
#define CFG_TAR_H_MASK
#define CFG_TAR_H_SHIFT
#define CFG_TAR_W_MASK
#define CFG_TAR_W_SHIFT
#define CFG_LIN_ACC_INC_U_MASK
#define CFG_LIN_ACC_INC_U_SHIFT
#define CFG_NLIN_ACC_INIT_U_MASK
#define CFG_NLIN_ACC_INIT_U_SHIFT

#define CFG_SC5
#define CFG_SRC_H_MASK
#define CFG_SRC_H_SHIFT
#define CFG_SRC_W_MASK
#define CFG_SRC_W_SHIFT
#define CFG_NLIN_ACC_INC_U_MASK
#define CFG_NLIN_ACC_INC_U_SHIFT

#define CFG_SC6
#define CFG_ROW_ACC_INIT_RAV_MASK
#define CFG_ROW_ACC_INIT_RAV_SHIFT
#define CFG_ROW_ACC_INIT_RAV_B_MASK
#define CFG_ROW_ACC_INIT_RAV_B_SHIFT

#define CFG_SC8
#define CFG_NLIN_LEFT_MASK
#define CFG_NLIN_LEFT_SHIFT
#define CFG_NLIN_RIGHT_MASK
#define CFG_NLIN_RIGHT_SHIFT

#define CFG_SC9
#define CFG_LIN_ACC_INC

#define CFG_SC10
#define CFG_NLIN_ACC_INIT

#define CFG_SC11
#define CFG_NLIN_ACC_INC

#define CFG_SC12
#define CFG_COL_ACC_OFFSET_MASK
#define CFG_COL_ACC_OFFSET_SHIFT

#define CFG_SC13
#define CFG_SC_FACTOR_RAV_MASK
#define CFG_SC_FACTOR_RAV_SHIFT
#define CFG_CHROMA_INTP_THR_MASK
#define CFG_CHROMA_INTP_THR_SHIFT
#define CFG_DELTA_CHROMA_THR_MASK
#define CFG_DELTA_CHROMA_THR_SHIFT

#define CFG_SC17
#define CFG_EV_THR_MASK
#define CFG_EV_THR_SHIFT
#define CFG_DELTA_LUMA_THR_MASK
#define CFG_DELTA_LUMA_THR_SHIFT
#define CFG_DELTA_EV_THR_MASK
#define CFG_DELTA_EV_THR_SHIFT

#define CFG_SC18
#define CFG_HS_FACTOR_MASK
#define CFG_HS_FACTOR_SHIFT
#define CFG_CONF_DEFAULT_MASK
#define CFG_CONF_DEFAULT_SHIFT

#define CFG_SC19
#define CFG_HPF_COEFF0_MASK
#define CFG_HPF_COEFF0_SHIFT
#define CFG_HPF_COEFF1_MASK
#define CFG_HPF_COEFF1_SHIFT
#define CFG_HPF_COEFF2_MASK
#define CFG_HPF_COEFF2_SHIFT
#define CFG_HPF_COEFF3_MASK
#define CFG_HPF_COEFF3_SHIFT

#define CFG_SC20
#define CFG_HPF_COEFF4_MASK
#define CFG_HPF_COEFF4_SHIFT
#define CFG_HPF_COEFF5_MASK
#define CFG_HPF_COEFF5_SHIFT
#define CFG_HPF_NORM_SHIFT_MASK
#define CFG_HPF_NORM_SHIFT_SHIFT
#define CFG_NL_LIMIT_MASK
#define CFG_NL_LIMIT_SHIFT

#define CFG_SC21
#define CFG_NL_LO_THR_MASK
#define CFG_NL_LO_THR_SHIFT
#define CFG_NL_LO_SLOPE_MASK
#define CFG_NL_LO_SLOPE_SHIFT

#define CFG_SC22
#define CFG_NL_HI_THR_MASK
#define CFG_NL_HI_THR_SHIFT
#define CFG_NL_HI_SLOPE_SH_MASK
#define CFG_NL_HI_SLOPE_SH_SHIFT

#define CFG_SC23
#define CFG_GRADIENT_THR_MASK
#define CFG_GRADIENT_THR_SHIFT
#define CFG_GRADIENT_THR_RANGE_MASK
#define CFG_GRADIENT_THR_RANGE_SHIFT
#define CFG_MIN_GY_THR_MASK
#define CFG_MIN_GY_THR_SHIFT
#define CFG_MIN_GY_THR_RANGE_MASK
#define CFG_MIN_GY_THR_RANGE_SHIFT

#define CFG_SC24
#define CFG_ORG_H_MASK
#define CFG_ORG_H_SHIFT
#define CFG_ORG_W_MASK
#define CFG_ORG_W_SHIFT

#define CFG_SC25
#define CFG_OFF_H_MASK
#define CFG_OFF_H_SHIFT
#define CFG_OFF_W_MASK
#define CFG_OFF_W_SHIFT

/* number of phases supported by the polyphase scalers */
#define SC_NUM_PHASES

/* number of taps used by horizontal polyphase scaler */
#define SC_H_NUM_TAPS

/* number of taps used by vertical polyphase scaler */
#define SC_V_NUM_TAPS

/* number of taps expected by the scaler in it's coefficient memory */
#define SC_NUM_TAPS_MEM_ALIGN

/* Maximum frame width the scaler can handle (in pixels) */
#define SC_MAX_PIXEL_WIDTH

/* Maximum frame height the scaler can handle (in lines) */
#define SC_MAX_PIXEL_HEIGHT

/*
 * coefficient memory size in bytes:
 * num phases x num sets(luma and chroma) x num taps(aligned) x coeff size
 */
#define SC_COEF_SRAM_SIZE

struct sc_data {};

void sc_dump_regs(struct sc_data *sc);
void sc_set_hs_coeffs(struct sc_data *sc, void *addr, unsigned int src_w,
		unsigned int dst_w);
void sc_set_vs_coeffs(struct sc_data *sc, void *addr, unsigned int src_h,
		unsigned int dst_h);
void sc_config_scaler(struct sc_data *sc, u32 *sc_reg0, u32 *sc_reg8,
		u32 *sc_reg17, unsigned int src_w, unsigned int src_h,
		unsigned int dst_w, unsigned int dst_h);
struct sc_data *sc_create(struct platform_device *pdev, const char *res_name);

#endif