linux/drivers/staging/media/starfive/camss/stf-isp.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * stf_isp.h
 *
 * StarFive Camera Subsystem - ISP Module
 *
 * Copyright (C) 2021-2023 StarFive Technology Co., Ltd.
 */

#ifndef STF_ISP_H
#define STF_ISP_H

#include <media/v4l2-subdev.h>

#include "stf-video.h"

#define ISP_RAW_DATA_BITS
#define SCALER_RATIO_MAX
#define STF_ISP_REG_OFFSET_MAX
#define STF_ISP_REG_DELAY_MAX

/* isp registers */
#define ISP_REG_CSI_INPUT_EN_AND_STATUS
#define CSI_SCD_ERR
#define CSI_ITU656_ERR
#define CSI_ITU656_F
#define CSI_SCD_DONE
#define CSI_BUSY_S
#define CSI_EN_S

#define ISP_REG_CSIINTS
#define CSI_INTS(n)
#define CSI_SHA_M(n)
#define CSI_INTS_MASK

#define ISP_REG_CSI_MODULE_CFG
#define CSI_DUMP_EN
#define CSI_VS_EN
#define CSI_SC_EN
#define CSI_OBA_EN
#define CSI_AWB_EN
#define CSI_LCCF_EN
#define CSI_OECFHM_EN
#define CSI_OECF_EN
#define CSI_LCBQ_EN
#define CSI_OBC_EN
#define CSI_DEC_EN
#define CSI_DC_EN

#define ISP_REG_SENSOR
#define DVP_SYNC_POL(n)
#define ITU656_EN(n)
#define IMAGER_SEL(n)

#define ISP_REG_RAW_FORMAT_CFG
#define SMY13(n)
#define SMY12(n)
#define SMY11(n)
#define SMY10(n)
#define SMY3(n)
#define SMY2(n)
#define SMY1(n)
#define SMY0(n)

#define ISP_REG_PIC_CAPTURE_START_CFG
#define VSTART_CAP(n)
#define HSTART_CAP(n)

#define ISP_REG_PIC_CAPTURE_END_CFG
#define VEND_CAP(n)
#define HEND_CAP(n)

#define ISP_REG_DUMP_CFG_0
#define ISP_REG_DUMP_CFG_1
#define DUMP_ID(n)
#define DUMP_SHT(n)
#define DUMP_BURST_LEN(n)
#define DUMP_SD(n)
#define DUMP_BURST_LEN_MASK
#define DUMP_SD_MASK

#define ISP_REG_DEC_CFG
#define DEC_V_KEEP(n)
#define DEC_V_PERIOD(n)
#define DEC_H_KEEP(n)
#define DEC_H_PERIOD(n)

#define ISP_REG_OBC_CFG
#define OBC_W_H(y)
#define OBC_W_W(x)

#define ISP_REG_DC_CFG_1
#define DC_AXI_ID(n)

#define ISP_REG_LCCF_CFG_0
#define Y_DISTANCE(y)
#define X_DISTANCE(x)

#define ISP_REG_LCCF_CFG_1
#define LCCF_MAX_DIS(n)

#define ISP_REG_LCBQ_CFG_0
#define H_LCBQ(y)
#define W_LCBQ(x)

#define ISP_REG_LCBQ_CFG_1
#define Y_COOR(y)
#define X_COOR(x)

#define ISP_REG_LCCF_CFG_2
#define ISP_REG_LCCF_CFG_3
#define ISP_REG_LCCF_CFG_4
#define ISP_REG_LCCF_CFG_5
#define LCCF_F2_PAR(n)
#define LCCF_F1_PAR(n)

#define ISP_REG_OECF_X0_CFG0
#define ISP_REG_OECF_X0_CFG1
#define ISP_REG_OECF_X0_CFG2
#define ISP_REG_OECF_X0_CFG3
#define ISP_REG_OECF_X0_CFG4
#define ISP_REG_OECF_X0_CFG5
#define ISP_REG_OECF_X0_CFG6
#define ISP_REG_OECF_X0_CFG7

#define ISP_REG_OECF_Y3_CFG0
#define ISP_REG_OECF_Y3_CFG1
#define ISP_REG_OECF_Y3_CFG2
#define ISP_REG_OECF_Y3_CFG3
#define ISP_REG_OECF_Y3_CFG4
#define ISP_REG_OECF_Y3_CFG5
#define ISP_REG_OECF_Y3_CFG6
#define ISP_REG_OECF_Y3_CFG7

#define ISP_REG_OECF_S0_CFG0
#define ISP_REG_OECF_S3_CFG7
#define OCEF_PAR_H(n)
#define OCEF_PAR_L(n)

#define ISP_REG_AWB_X0_CFG_0
#define ISP_REG_AWB_X0_CFG_1
#define ISP_REG_AWB_X1_CFG_0
#define ISP_REG_AWB_X1_CFG_1
#define ISP_REG_AWB_X2_CFG_0
#define ISP_REG_AWB_X2_CFG_1
#define ISP_REG_AWB_X3_CFG_0
#define ISP_REG_AWB_X3_CFG_1
#define AWB_X_SYMBOL_H(n)
#define AWB_X_SYMBOL_L(n)

#define ISP_REG_AWB_Y0_CFG_0
#define ISP_REG_AWB_Y0_CFG_1
#define ISP_REG_AWB_Y1_CFG_0
#define ISP_REG_AWB_Y1_CFG_1
#define ISP_REG_AWB_Y2_CFG_0
#define ISP_REG_AWB_Y2_CFG_1
#define ISP_REG_AWB_Y3_CFG_0
#define ISP_REG_AWB_Y3_CFG_1
#define AWB_Y_SYMBOL_H(n)
#define AWB_Y_SYMBOL_L(n)

#define ISP_REG_AWB_S0_CFG_0
#define ISP_REG_AWB_S0_CFG_1
#define ISP_REG_AWB_S1_CFG_0
#define ISP_REG_AWB_S1_CFG_1
#define ISP_REG_AWB_S2_CFG_0
#define ISP_REG_AWB_S2_CFG_1
#define ISP_REG_AWB_S3_CFG_0
#define ISP_REG_AWB_S3_CFG_1
#define AWB_S_SYMBOL_H(n)
#define AWB_S_SYMBOL_L(n)

#define ISP_REG_OBCG_CFG_0
#define ISP_REG_OBCG_CFG_1
#define ISP_REG_OBCG_CFG_2
#define ISP_REG_OBCG_CFG_3
#define ISP_REG_OBCO_CFG_0
#define ISP_REG_OBCO_CFG_1
#define ISP_REG_OBCO_CFG_2
#define ISP_REG_OBCO_CFG_3
#define GAIN_D_POINT(x)
#define GAIN_C_POINT(x)
#define GAIN_B_POINT(x)
#define GAIN_A_POINT(x)
#define OFFSET_D_POINT(x)
#define OFFSET_C_POINT(x)
#define OFFSET_B_POINT(x)
#define OFFSET_A_POINT(x)

#define ISP_REG_ISP_CTRL_0
#define ISPC_LINE
#define ISPC_SC
#define ISPC_CSI
#define ISPC_ISP
#define ISPC_ENUO
#define ISPC_ENLS
#define ISPC_ENSS1
#define ISPC_ENSS0
#define ISPC_RST
#define ISPC_EN
#define ISPC_RST_MASK
#define ISPC_INT_ALL_MASK

#define ISP_REG_ISP_CTRL_1
#define CTRL_SAT(n)
#define CTRL_DBC
#define CTRL_CTC
#define CTRL_YHIST
#define CTRL_YCURVE
#define CTRL_CTM
#define CTRL_BIYUV
#define CTRL_SCE
#define CTRL_EE
#define CTRL_CCE
#define CTRL_RGE
#define CTRL_CME
#define CTRL_AE
#define CTRL_CE
#define CTRL_SAT_MASK

#define ISP_REG_PIPELINE_XY_SIZE
#define H_ACT_CAP(n)
#define W_ACT_CAP(n)

#define ISP_REG_ICTC
#define GF_MODE(n)
#define MAXGT(n)
#define MINGT(n)

#define ISP_REG_IDBC
#define BADGT(n)
#define BADXT(n)

#define ISP_REG_ICFAM
#define CROSS_COV(n)
#define HV_W(n)

#define ISP_REG_CS_GAIN
#define CMAD(n)
#define CMAB(n)

#define ISP_REG_CS_THRESHOLD
#define CMD(n)
#define CMB(n)

#define ISP_REG_CS_OFFSET
#define VOFF(n)
#define UOFF(n)

#define ISP_REG_CS_HUE_F
#define SIN(n)
#define COS(n)

#define ISP_REG_CS_SCALE

#define ISP_REG_IESHD
#define SHAD_UP_M
#define SHAD_UP_EN

#define ISP_REG_YADJ0
#define YOIR(n)
#define YIMIN(n)

#define ISP_REG_YADJ1
#define YOMAX(n)
#define YOMIN(n)

#define ISP_REG_Y_PLANE_START_ADDR
#define ISP_REG_UV_PLANE_START_ADDR
#define ISP_REG_STRIDE

#define ISP_REG_ITIIWSR
#define ITI_HSIZE(n)
#define ITI_WSIZE(n)

#define ISP_REG_ITIDWLSR
#define ISP_REG_ITIPDFR
#define ISP_REG_ITIDRLSR

#define ISP_REG_DNYUV_YSWR0
#define ISP_REG_DNYUV_YSWR1
#define ISP_REG_DNYUV_CSWR0
#define ISP_REG_DNYUV_CSWR1
#define YUVSW5(n)
#define YUVSW4(n)
#define YUVSW3(n)
#define YUVSW2(n)
#define YUVSW1(n)
#define YUVSW0(n)

#define ISP_REG_DNYUV_YDR0
#define ISP_REG_DNYUV_YDR1
#define ISP_REG_DNYUV_YDR2
#define ISP_REG_DNYUV_CDR0
#define ISP_REG_DNYUV_CDR1
#define ISP_REG_DNYUV_CDR2
#define CURVE_D_H(n)
#define CURVE_D_L(n)

#define ISP_REG_ICAMD_0
#define ISP_REG_ICAMD_12
#define ISP_REG_ICAMD_20
#define ISP_REG_ICAMD_24
#define ISP_REG_ICAMD_25
#define DNRM_F(n)
#define CCM_M_DAT(n)

#define ISP_REG_GAMMA_VAL0
#define ISP_REG_GAMMA_VAL1
#define ISP_REG_GAMMA_VAL2
#define ISP_REG_GAMMA_VAL3
#define ISP_REG_GAMMA_VAL4
#define ISP_REG_GAMMA_VAL5
#define ISP_REG_GAMMA_VAL6
#define ISP_REG_GAMMA_VAL7
#define ISP_REG_GAMMA_VAL8
#define ISP_REG_GAMMA_VAL9
#define ISP_REG_GAMMA_VAL10
#define ISP_REG_GAMMA_VAL11
#define ISP_REG_GAMMA_VAL12
#define ISP_REG_GAMMA_VAL13
#define ISP_REG_GAMMA_VAL14
#define GAMMA_S_VAL(n)
#define GAMMA_VAL(n)

#define ISP_REG_R2Y_0
#define ISP_REG_R2Y_1
#define ISP_REG_R2Y_2
#define ISP_REG_R2Y_3
#define ISP_REG_R2Y_4
#define ISP_REG_R2Y_5
#define ISP_REG_R2Y_6
#define ISP_REG_R2Y_7
#define ISP_REG_R2Y_8

#define ISP_REG_SHARPEN0
#define ISP_REG_SHARPEN1
#define ISP_REG_SHARPEN2
#define ISP_REG_SHARPEN3
#define ISP_REG_SHARPEN4
#define ISP_REG_SHARPEN5
#define ISP_REG_SHARPEN6
#define ISP_REG_SHARPEN7
#define ISP_REG_SHARPEN8
#define ISP_REG_SHARPEN9
#define ISP_REG_SHARPEN10
#define ISP_REG_SHARPEN11
#define ISP_REG_SHARPEN12
#define ISP_REG_SHARPEN13
#define ISP_REG_SHARPEN14
#define S_DELTA(n)
#define S_WEIGHT(n)

#define ISP_REG_SHARPEN_FS0
#define ISP_REG_SHARPEN_FS1
#define ISP_REG_SHARPEN_FS2
#define ISP_REG_SHARPEN_FS3
#define ISP_REG_SHARPEN_FS4
#define ISP_REG_SHARPEN_FS5
#define S_FACTOR(n)
#define S_SLOPE(n)

#define ISP_REG_SHARPEN_WN
#define PDIRF(n)
#define NDIRF(n)
#define WSUM(n)

#define ISP_REG_IUVS1
#define UVDIFF2(n)
#define UVDIFF1(n)

#define ISP_REG_IUVS2
#define UVF(n)
#define UVSLOPE(n)

#define ISP_REG_IUVCKS1
#define UVCKDIFF2(n)
#define UVCKDIFF1(n)

#define ISP_REG_IUVCKS2

#define ISP_REG_ISHRPET
#define TH(n)
#define EN(n)

#define ISP_REG_YCURVE_0
#define ISP_REG_YCURVE_63

#define IMAGE_MAX_WIDTH
#define IMAGE_MAX_HEIGH

/* pad id for media framework */
enum stf_isp_pad_id {};

struct stf_isp_format {};

struct stf_isp_format_table {};

struct stf_isp_dev {};

int stf_isp_reset(struct stf_isp_dev *isp_dev);
void stf_isp_init_cfg(struct stf_isp_dev *isp_dev);
void stf_isp_settings(struct stf_isp_dev *isp_dev,
		      struct v4l2_rect *crop, u32 mcode);
void stf_isp_stream_set(struct stf_isp_dev *isp_dev);
int stf_isp_init(struct stfcamss *stfcamss);
int stf_isp_register(struct stf_isp_dev *isp_dev, struct v4l2_device *v4l2_dev);
int stf_isp_unregister(struct stf_isp_dev *isp_dev);

#endif /* STF_ISP_H */