Commit be2a6954 authored by carbon's avatar carbon

camera: support sensor gc2083

parent 0caef942
......@@ -16,6 +16,7 @@ CONFIG_STORAGE_TYPE_sd=y
CONFIG_SENSOR_TUNING_PARAM_cv180x_src_sms_sc200ai=y
CONFIG_SENSOR_SMS_SC200AI=y
CONFIG_SENSOR_GCORE_GC2053=y
CONFIG_SENSOR_GCORE_GC2083=y
CONFIG_UBOOT_2021_10=y
CONFIG_KERNEL_SRC_5.10=y
CONFIG_KERNEL_LZMA=y
......
......@@ -8,6 +8,7 @@
"GCORE_GC2053",
"GCORE_GC2053_1L",
"GCORE_GC2053_SLAVE",
"GCORE_GC2083",
"GCORE_GC2093",
"GCORE_GC2093_SLAVE",
"GCORE_GC2145",
......
......@@ -2,6 +2,7 @@ ifeq ($(CHIP_ARCH),CV183X)
sensor-$(CONFIG_SENSOR_GCORE_GC2053) += gcore_gc2053
sensor-$(CONFIG_SENSOR_GCORE_GC2053_SLAVE) += gcore_gc2053_slave
sensor-$(CONFIG_SENSOR_GCORE_GC2053_1L) += gcore_gc2053_1L
sensor-$(CONFIG_SENSOR_GCORE_GC2083) += gcore_gc2083
sensor-$(CONFIG_SENSOR_GCORE_GC2093) += gcore_gc2093
sensor-$(CONFIG_SENSOR_GCORE_GC2093_SLAVE) += gcore_gc2093_slave
sensor-$(CONFIG_SENSOR_GCORE_GC4653) += gcore_gc4653
......@@ -60,6 +61,7 @@ sensor-$(CONFIG_SENSOR_GCORE_GC1054) += gcore_gc1054
sensor-$(CONFIG_SENSOR_GCORE_GC2053) += gcore_gc2053
sensor-$(CONFIG_SENSOR_GCORE_GC2053_SLAVE) += gcore_gc2053_slave
sensor-$(CONFIG_SENSOR_GCORE_GC2053_1L) += gcore_gc2053_1L
sensor-$(CONFIG_SENSOR_GCORE_GC2083) += gcore_gc2083
sensor-$(CONFIG_SENSOR_GCORE_GC2093) += gcore_gc2093
sensor-$(CONFIG_SENSOR_GCORE_GC2145) += gcore_gc2145
sensor-$(CONFIG_SENSOR_GCORE_GC4023) += gcore_gc4023
......
......@@ -46,6 +46,9 @@ gcore_gc2053_slave:
gcore_gc2053_1L:
$(call MAKE_SENSOR, ${@})
gcore_gc2083:
$(call MAKE_SENSOR, ${@})
gcore_gc2093:
$(call MAKE_SENSOR, ${@})
......
SHELL = /bin/bash
ifeq ($(PARAM_FILE), )
PARAM_FILE=../../../../../../$(shell echo $(MW_VER))/Makefile.param
include $(PARAM_FILE)
endif
SDIR = $(PWD)
SRCS = $(wildcard $(SDIR)/*.c)
INCS = -I$(MW_INC) -I$(ISP_INC) -I$(KERNEL_INC) -I./include
OBJS = $(SRCS:.c=.o)
DEPS = $(SRCS:.c=.d)
TARGET_A = $(MW_LIB)/libsns_gc2083.a
TARGET_SO = $(MW_LIB)/libsns_gc2083.so
EXTRA_CFLAGS = $(INCS)
EXTRA_LDFLAGS =
.PHONY : clean all
all : $(TARGET_A) $(TARGET_SO)
$(SDIR)/%.o: $(SDIR)/%.c
@$(CC) $(DEPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
@echo [$(notdir $(CC))] $(notdir $@)
$(TARGET_A): $(OBJS)
@$(AR) $(ARFLAGS) $@ $(OBJS)
@echo -e $(YELLOW)[LINK]$(END)[$(notdir $(AR))] $(notdir $(TARGET_A))
$(TARGET_SO): $(OBJS)
@$(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -o $@ --start-group $(OBJS) --end-group
@echo -e $(GREEN)[LINK]$(END)[$(notdir $(LD))] $(notdir $(TARGET_SO))
clean:
@rm -f $(OBJS) $(DEPS) $(TARGET_A) $(TARGET_SO)
-include $(DEPS)
#ifndef __GC2083_CMOS_EX_H_
#define __GC2083_CMOS_EX_H_
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
#ifdef ARCH_CV182X
#include <linux/cvi_vip_cif.h>
#include <linux/cvi_vip_snsr.h>
#include "cvi_type.h"
#else
#include <linux/cif_uapi.h>
#include <linux/vi_snsr.h>
#include <linux/cvi_type.h>
#endif
#include "cvi_sns_ctrl.h"
#ifndef UNUSED
#define UNUSED(x) ((void)(x))
#endif
enum gc2083_linear_regs_e {
LINEAR_EXP_H, //0x0d03
LINEAR_EXP_L, //0x0d04
LINEAR_AGAIN_L, //0x00d0
LINEAR_AGAIN_MAG1, //0x0155
LINEAR_AGAIN_MAG2, //0x0410
LINEAR_AGAIN_MAG3, //0x0411
LINEAR_AGAIN_MAG4, //0x0412
LINEAR_AGAIN_MAG5, //0x0413
LINEAR_AGAIN_MAG6, //0x0414
LINEAR_AGAIN_MAG7, //0x0415
LINEAR_AGAIN_MAG8, //0x0416
LINEAR_AGAIN_MAG9, //0x0417
LINEAR_COL_AGAIN_H, //0x00b8
LINEAR_COL_AGAIN_L, //0x00b9
LINEAR_AGAIN_HOLD_2E, // 0x031d
LINEAR_AGAIN_H, //0x0dc1
LINEAR_AGAIN_HOLD_28, // 0x031d
LINEAR_DGAIN_H, //0x00b1
LINEAR_DGAIN_L, //0x00b2
LINEAR_VTS_H, //0x0d41 (frame length)
LINEAR_VTS_L, //0x0d42
LINEAR_REGS_NUM
};
typedef enum _GC2083_MODE_E {
GC2083_MODE_1920X1080P30 = 0,
GC2083_MODE_NUM
} GC2083_SLAVE_MODE_E;
typedef struct _GC2083_STATE_S {
CVI_U32 u32Sexp_MAX;
} GC2083_STATE_S;
typedef struct _GC2083_MODE_S {
ISP_WDR_SIZE_S astImg[2];
CVI_FLOAT f32MaxFps;
CVI_FLOAT f32MinFps;
CVI_U32 u32HtsDef;
CVI_U32 u32VtsDef;
SNS_ATTR_S stExp[2];
SNS_ATTR_LARGE_S stAgain[2];
SNS_ATTR_LARGE_S stDgain[2];
char name[64];
} GC2083_MODE_S;
/****************************************************************************
* external variables and functions *
****************************************************************************/
extern ISP_SNS_STATE_S *g_pastGc2083[VI_MAX_PIPE_NUM];
extern ISP_SNS_COMMBUS_U g_aunGc2083_BusInfo[];
extern ISP_SNS_MIRRORFLIP_TYPE_E g_aeGc2083_MirrorFip[VI_MAX_PIPE_NUM];
extern CVI_U8 gc2083_i2c_addr;
extern const CVI_U32 gc2083_addr_byte;
extern const CVI_U32 gc2083_data_byte;
extern void gc2083_init(VI_PIPE ViPipe);
extern void gc2083_exit(VI_PIPE ViPipe);
extern void gc2083_standby(VI_PIPE ViPipe);
extern void gc2083_restart(VI_PIPE ViPipe);
extern int gc2083_write_register(VI_PIPE ViPipe, int addr, int data);
extern int gc2083_read_register(VI_PIPE ViPipe, int addr);
extern void gc2083_mirror_flip(VI_PIPE ViPipe, ISP_SNS_MIRRORFLIP_TYPE_E eSnsMirrorFlip);
extern int gc2083_probe(VI_PIPE ViPipe);
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* End of #ifdef __cplusplus */
#endif /* __GC2083_CMOS_EX_H_ */
#ifndef __GC2083_CMOS_PARAM_H_
#define __GC2083_CMOS_PARAM_H_
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
#ifdef ARCH_CV182X
#include <linux/cvi_vip_cif.h>
#include <linux/cvi_vip_snsr.h>
#include "cvi_type.h"
#else
#include <linux/cif_uapi.h>
#include <linux/vi_snsr.h>
#include <linux/cvi_type.h>
#endif
#include "cvi_sns_ctrl.h"
#include "gc2083_cmos_ex.h"
static const GC2083_MODE_S g_stGc2083_mode[GC2083_MODE_NUM] = {
[GC2083_MODE_1920X1080P30] = {
.name = "1920X1080P30",
.astImg[0] = {
.stSnsSize = {
.u32Width = 1920,
.u32Height = 1080,
},
.stWndRect = {
.s32X = 0,
.s32Y = 0,
.u32Width = 1920,
.u32Height = 1080,
},
.stMaxSize = {
.u32Width = 1920,
.u32Height = 1080,
},
},
.f32MaxFps = 30,
.f32MinFps = 2.07, /* 1125 * 30 / 0x3FFF */
.u32HtsDef = 2200,
.u32VtsDef = 1125,
.stExp[0] = {
.u16Min = 1,
.u16Max = 1125 - 8,
.u16Def = 400,
.u16Step = 1,
},
.stAgain[0] = {
.u32Min = 64,
.u32Max = 62977,
.u32Def = 64,
.u32Step = 1,
},
.stDgain[0] = {
.u32Min = 64*16,
.u32Max = 7073*16,
.u32Def = 581*16,
.u32Step = 10*16,
},
},
};
static ISP_CMOS_NOISE_CALIBRATION_S g_stIspNoiseCalibratio = {.CalibrationCoef = {
{ //iso 100
{0.05999477580189704895, 0.13019448518753051758}, //B: slope, intercept
{0.06732148677110671997, -1.36387133598327636719}, //Gb: slope, intercept
{0.06651904433965682983, -1.10093510150909423828}, //Gr: slope, intercept
{0.06406146287918090820, 0.33316791057586669922}, //R: slope, intercept
},
{ //iso 200
{0.06256803125143051147, 4.54908418655395507813}, //B: slope, intercept
{0.06911934912204742432, 2.79023528099060058594}, //Gb: slope, intercept
{0.06846688687801361084, 2.88726186752319335938}, //Gr: slope, intercept
{0.06652788817882537842, 4.40276956558227539063}, //R: slope, intercept
},
{ //iso 400
{0.06841833144426345825, 11.72280883789062500000}, //B: slope, intercept
{0.07257881015539169312, 10.86985683441162109375}, //Gb: slope, intercept
{0.07174283266067504883, 11.20646286010742187500}, //Gr: slope, intercept
{0.07294593751430511475, 11.17350578308105468750}, //R: slope, intercept
},
{ //iso 800
{0.07805790752172470093, 20.62956619262695312500}, //B: slope, intercept
{0.07694032043218612671, 22.20356750488281250000}, //Gb: slope, intercept
{0.07647507637739181519, 22.50957298278808593750}, //Gr: slope, intercept
{0.08402533829212188721, 19.11953735351562500000}, //R: slope, intercept
},
{ //iso 1600
{0.09468275308609008789, 34.07563018798828125000}, //B: slope, intercept
{0.08710632473230361938, 39.15500259399414062500}, //Gb: slope, intercept
{0.08662072569131851196, 39.37175750732421875000}, //Gr: slope, intercept
{0.10222808271646499634, 31.34789276123046875000}, //R: slope, intercept
},
{ //iso 3200
{0.12651191651821136475, 49.56183242797851562500}, //B: slope, intercept
{0.10816962271928787231, 59.42719650268554687500}, //Gb: slope, intercept
{0.10751257836818695068, 59.90552902221679687500}, //Gr: slope, intercept
{0.13802853226661682129, 45.09576034545898437500}, //R: slope, intercept
},
{ //iso 6400
{0.17422541975975036621, 70.04063415527343750000}, //B: slope, intercept
{0.14234761893749237061, 85.51583862304687500000}, //Gb: slope, intercept
{0.14159946143627166748, 86.23278045654296875000}, //Gr: slope, intercept
{0.19450971484184265137, 62.65447235107421875000}, //R: slope, intercept
},
{ //iso 12800
{0.24947367608547210693, 108.30633544921875000000}, //B: slope, intercept
{0.19751225411891937256, 130.88159179687500000000}, //Gb: slope, intercept
{0.19614629447460174561, 132.49082946777343750000}, //Gr: slope, intercept
{0.28106108307838439941, 97.15969085693359375000}, //R: slope, intercept
},
{ //iso 25600
{0.35420843958854675293, 137.06745910644531250000}, //B: slope, intercept
{0.27778801321983337402, 168.72366333007812500000}, //Gb: slope, intercept
{0.27540388703346252441, 170.54939270019531250000}, //Gr: slope, intercept
{0.39949953556060791016, 123.29409790039062500000}, //R: slope, intercept
},
{ //iso 51200
{0.45704349875450134277, 179.20147705078125000000}, //B: slope, intercept
{0.32142028212547302246, 246.71363830566406250000}, //Gb: slope, intercept
{0.31958609819412231445, 246.82630920410156250000}, //Gr: slope, intercept
{0.51058447360992431641, 161.86299133300781250000}, //R: slope, intercept
},
{ //iso 102400
{0.61760461330413818359, 222.90534973144531250000}, //B: slope, intercept
{0.42568457126617431641, 319.29257202148437500000}, //Gb: slope, intercept
{0.41750904917716979980, 324.93432617187500000000}, //Gr: slope, intercept
{0.67956107854843139648, 203.78948974609375000000}, //R: slope, intercept
},
{ //iso 204800
{0.63289469480514526367, 216.99952697753906250000}, //B: slope, intercept
{0.44890350103378295898, 306.80810546875000000000}, //Gb: slope, intercept
{0.44229975342750549316, 310.13763427734375000000}, //Gr: slope, intercept
{0.69596910476684570313, 196.70443725585937500000}, //R: slope, intercept
},
{ //iso 409600
{0.71106964349746704102, 187.98352050781250000000}, //B: slope, intercept
{0.55859673023223876953, 246.22378540039062500000}, //Gb: slope, intercept
{0.55284017324447631836, 249.86463928222656250000}, //Gr: slope, intercept
{0.77318203449249267578, 168.85035705566406250000}, //R: slope, intercept
},
{ //iso 819200
{0.70888006687164306641, 188.44216918945312500000}, //B: slope, intercept
{0.56110274791717529297, 245.46603393554687500000}, //Gb: slope, intercept
{0.55100852251052856445, 250.33049011230468750000}, //Gr: slope, intercept
{0.76897650957107543945, 169.31251525878906250000}, //R: slope, intercept
},
{ //iso 1638400
{0.70520979166030883789, 188.93899536132812500000}, //B: slope, intercept
{0.56178557872772216797, 245.21235656738281250000}, //Gb: slope, intercept
{0.55338454246520996094, 249.57423400878906250000}, //Gr: slope, intercept
{0.77306479215621948242, 168.86497497558593750000}, //R: slope, intercept
},
{ //iso 3276800
{0.71255809068679809570, 187.86839294433593750000}, //B: slope, intercept
{0.56056070327758789063, 245.57748413085937500000}, //Gb: slope, intercept
{0.55358195304870605469, 249.62020874023437500000}, //Gr: slope, intercept
{0.77431541681289672852, 168.74313354492187500000}, //R: slope, intercept
},
} };
static ISP_CMOS_BLACK_LEVEL_S g_stIspBlcCalibratio = {
.bUpdate = CVI_TRUE,
.blcAttr = {
.Enable = 1,
.enOpType = OP_TYPE_AUTO,
.stManual = {252, 252, 252, 252, 0, 0, 0, 0
#ifdef ARCH_CV182X
, 1093, 1093, 1093, 1093
#endif
},
.stAuto = {
{252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252 },
{252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252 },
{252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252 },
{252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252 },
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
#ifdef ARCH_CV182X
{1093, 1093, 1093, 1093, 1093, 1093, 1093, 1095,
1099, 1104, 1125, 1130, 1125, 1127, 1126, 1126},
{1093, 1093, 1093, 1093, 1093, 1093, 1094, 1095,
1097, 1104, 1128, 1128, 1126, 1124, 1127, 1127},
{1093, 1093, 1093, 1093, 1093, 1093, 1094, 1095,
1098, 1104, 1128, 1131, 1125, 1127, 1128, 1126},
{1093, 1093, 1093, 1093, 1093, 1093, 1093, 1095,
1097, 1103, 1123, 1124, 1124, 1123, 1121, 1125},
#endif
},
},
};
struct combo_dev_attr_s gc2083_rx_attr = {
.input_mode = INPUT_MODE_MIPI,
.mac_clk = RX_MAC_CLK_200M,
.mipi_attr = {
.raw_data_type = RAW_DATA_10BIT,
.lane_id = {3, 2, 4, -1, -1},
.pn_swap = {0, 0, 0, 0, 0},
.wdr_mode = CVI_MIPI_WDR_MODE_NONE,
},
.mclk = {
.cam = 0,
.freq = CAMPLL_FREQ_24M,
},
.devno = 0,
};
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* End of #ifdef __cplusplus */
#endif /* __GC2083_CMOS_PARAM_H_ */
......@@ -123,6 +123,7 @@ extern ISP_SNS_OBJ_S stSnsGc1054_Obj;
extern ISP_SNS_OBJ_S stSnsGc2053_Obj;
extern ISP_SNS_OBJ_S stSnsGc2053_Slave_Obj;
extern ISP_SNS_OBJ_S stSnsGc2053_1l_Obj;
extern ISP_SNS_OBJ_S stSnsGc2083_Obj;
extern ISP_SNS_OBJ_S stSnsGc2093_Obj;
extern ISP_SNS_OBJ_S stSnsGc2093_Slave_Obj;
extern ISP_SNS_OBJ_S stSnsGc2145_Obj;
......
......@@ -33,6 +33,10 @@ ifeq ($(CONFIG_SENSOR_GCORE_GC2053_1L), y)
KBUILD_DEFINES += -DSENSOR_GCORE_GC2053_1L
endif
ifeq ($(CONFIG_SENSOR_GCORE_GC2083), y)
KBUILD_DEFINES += -DSENSOR_GCORE_GC2083
endif
ifeq ($(CONFIG_SENSOR_GCORE_GC2093), y)
KBUILD_DEFINES += -DSENSOR_GCORE_GC2093
endif
......
......@@ -185,6 +185,7 @@ typedef enum _SAMPLE_SNS_TYPE_E {
GCORE_GC2053_MIPI_2M_30FPS_10BIT,
GCORE_GC2053_SLAVE_MIPI_2M_30FPS_10BIT,
GCORE_GC2053_1L_MIPI_2M_30FPS_10BIT,
GCORE_GC2083_MIPI_2M_30FPS_10BIT,
GCORE_GC2093_MIPI_2M_30FPS_10BIT,
GCORE_GC2093_SLAVE_MIPI_2M_30FPS_10BIT,
GCORE_GC2145_MIPI_2M_12FPS_8BIT,
......
......@@ -92,6 +92,7 @@ static const char *snsr_type_name[SAMPLE_SNS_TYPE_BUTT] = {
"GCORE_GC2053_MIPI_2M_30FPS_10BIT",
"GCORE_GC2053_SLAVE_MIPI_2M_30FPS_10BIT",
"GCORE_GC2053_1L_MIPI_2M_30FPS_10BIT",
"GCORE_GC2083_MIPI_2M_30FPS_10BIT",
"GCORE_GC2093_MIPI_2M_30FPS_10BIT",
"GCORE_GC2093_SLAVE_MIPI_2M_30FPS_10BIT",
"GCORE_GC2145_MIPI_2M_12FPS_8BIT",
......@@ -321,6 +322,7 @@ CVI_S32 SAMPLE_COMM_SNS_GetSize(SAMPLE_SNS_TYPE_E enMode, PIC_SIZE_E *penSize)
case GCORE_GC2053_MIPI_2M_30FPS_10BIT:
case GCORE_GC2053_SLAVE_MIPI_2M_30FPS_10BIT:
case GCORE_GC2053_1L_MIPI_2M_30FPS_10BIT:
case GCORE_GC2083_MIPI_2M_30FPS_10BIT:
case GCORE_GC2093_MIPI_2M_30FPS_10BIT:
case GCORE_GC2093_MIPI_2M_30FPS_10BIT_WDR2TO1:
case GCORE_GC2093_SLAVE_MIPI_2M_30FPS_10BIT:
......@@ -817,6 +819,7 @@ CVI_S32 SAMPLE_COMM_SNS_GetDevAttr(SAMPLE_SNS_TYPE_E enSnsType, VI_DEV_ATTR_S *p
case GCORE_GC2053_MIPI_2M_30FPS_10BIT:
case GCORE_GC2053_SLAVE_MIPI_2M_30FPS_10BIT:
case GCORE_GC2053_1L_MIPI_2M_30FPS_10BIT:
case GCORE_GC2083_MIPI_2M_30FPS_10BIT:
case GCORE_GC2093_MIPI_2M_30FPS_10BIT:
case GCORE_GC2093_MIPI_2M_30FPS_10BIT_WDR2TO1:
case GCORE_GC2093_SLAVE_MIPI_2M_30FPS_10BIT:
......@@ -1036,6 +1039,7 @@ CVI_S32 SAMPLE_COMM_SNS_GetIspAttrBySns(SAMPLE_SNS_TYPE_E enSnsType, ISP_PUB_ATT
case GCORE_GC2053_MIPI_2M_30FPS_10BIT:
case GCORE_GC2053_SLAVE_MIPI_2M_30FPS_10BIT:
case GCORE_GC2053_1L_MIPI_2M_30FPS_10BIT:
case GCORE_GC2083_MIPI_2M_30FPS_10BIT:
case GCORE_GC2093_MIPI_2M_30FPS_10BIT:
case GCORE_GC2093_MIPI_2M_30FPS_10BIT_WDR2TO1:
case GCORE_GC2093_SLAVE_MIPI_2M_30FPS_10BIT:
......@@ -1106,6 +1110,10 @@ CVI_VOID *SAMPLE_COMM_SNS_GetSnsObj(SAMPLE_SNS_TYPE_E enSnsType)
pSnsObj = &stSnsGc2053_1l_Obj;
break;
#endif
#if defined(SENSOR_GCORE_GC2083)
case GCORE_GC2083_MIPI_2M_30FPS_10BIT:
return &stSnsGc2083_Obj;
#endif
#if defined(SENSOR_GCORE_GC2093)
case GCORE_GC2093_MIPI_2M_30FPS_10BIT:
case GCORE_GC2093_MIPI_2M_30FPS_10BIT_WDR2TO1:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment