update:更新双目sensor驱动
This commit is contained in:
parent
4fd818749c
commit
0933b5aeec
|
@ -164,6 +164,7 @@
|
|||
fps = <15>;
|
||||
bit_rate = <1536>;//kb
|
||||
gop = <40>;
|
||||
enable_sharp = <1>;
|
||||
product_mode = <0>;//0:static ipc, 1:moving ipc, 2: doorbell, 3:cdr, 4:sdv, 5:projection, 6:UAV(Unmanned Aerial Vehicle)
|
||||
vbr = <1>;//< operate venc. VBR=1, CBR=0
|
||||
init_qp = <35>;
|
||||
|
@ -185,9 +186,9 @@
|
|||
};
|
||||
|
||||
sensor_1_venc: sensor_1_venc@1 {
|
||||
status = "disabled";
|
||||
status = "okay";
|
||||
s1vencfg0: s1vencfg0@0 {
|
||||
status = "disabled";
|
||||
status = "okay";
|
||||
ch_id = <1>;//vipp_num
|
||||
codec_type = <0>;//0//0:H264; 1:JPG; 2:H265
|
||||
res_w = <1600>;
|
||||
|
@ -275,12 +276,9 @@
|
|||
};
|
||||
|
||||
isp01:isp@1 {
|
||||
/*
|
||||
rpbuf = <&rpbuf_controller0>;
|
||||
iommus = <&mmu_aw 4 0>;
|
||||
delay_init = <1>;
|
||||
*/
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
isp02:isp@2 {
|
||||
|
@ -293,7 +291,7 @@
|
|||
|
||||
isp10:isp@4 {
|
||||
status = "disabled";
|
||||
iommus = <&mmu_aw 1 0>;
|
||||
iommus = <&mmu_aw 4 0>;
|
||||
};
|
||||
|
||||
scaler00:scaler@0 {
|
||||
|
@ -394,7 +392,7 @@
|
|||
|
||||
sensor0:sensor@0 {
|
||||
device_type = "sensor0";
|
||||
sensor0_mname = "sc202cs_mipi";
|
||||
sensor0_mname = "sc202csr_mipi";
|
||||
sensor0_twi_cci_id = <0>;
|
||||
sensor0_twi_addr = <0x20>;
|
||||
sensor0_mclk_id = <1>;
|
||||
|
@ -405,9 +403,9 @@
|
|||
sensor0_vflip = <0>;
|
||||
sensor0_hflip = <0>;
|
||||
sensor0_reset = <&pio PE 10 1 0 1 0>;
|
||||
sensor0_pwdn = <>;
|
||||
sensor0_sm_hs = <>;
|
||||
sensor0_sm_vs = <>;
|
||||
sensor0_power_en = <>;
|
||||
flash_handle = <&flash0>;
|
||||
act_handle = <&actuator0>;
|
||||
status = "okay";
|
||||
|
@ -415,7 +413,7 @@
|
|||
|
||||
sensor1:sensor@1 {
|
||||
device_type = "sensor1";
|
||||
sensor1_mname = "sc202cs_mipi_2";
|
||||
sensor1_mname = "sc202csi_mipi";
|
||||
sensor1_twi_cci_id = <0>;
|
||||
sensor1_twi_addr = <0x6c>;
|
||||
sensor1_mclk_id = <1>;
|
||||
|
@ -426,11 +424,12 @@
|
|||
sensor1_vflip = <0>;
|
||||
sensor1_hflip = <0>;
|
||||
sensor1_reset = <&pio PE 11 1 0 1 0>;
|
||||
sensor1_pwdn = <>;
|
||||
sensor1_sm_hs = <>;
|
||||
sensor1_sm_vs = <>;
|
||||
flash_handle = <>;
|
||||
act_handle = <>;
|
||||
status = "disabled";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
vinc00:vinc@0 {
|
||||
|
@ -457,10 +456,9 @@
|
|||
vinc1_rear_sensor_sel = <1>;
|
||||
vinc1_front_sensor_sel = <1>;
|
||||
vinc1_sensor_list = <0>;
|
||||
work_mode = <0x1>;
|
||||
iommus = <&mmu_aw 1 0>;
|
||||
delay_init = <1>;
|
||||
status = "disabled";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
vinc02:vinc@2 {
|
||||
|
@ -511,10 +509,9 @@
|
|||
vinc5_rear_sensor_sel = <1>;
|
||||
vinc5_front_sensor_sel = <1>;
|
||||
vinc5_sensor_list = <0>;
|
||||
work_mode = <0x1>;
|
||||
iommus = <&mmu_aw 1 0>;
|
||||
delay_init = <1>;
|
||||
status = "disabled";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
vinc12:vinc@6 {
|
||||
|
@ -565,10 +562,9 @@
|
|||
vinc9_rear_sensor_sel = <1>;
|
||||
vinc9_front_sensor_sel = <1>;
|
||||
vinc9_sensor_list = <0>;
|
||||
work_mode = <0x1>;
|
||||
iommus = <&mmu_aw 1 0>;
|
||||
delay_init = <1>;
|
||||
status = "disabled";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
vinc22:vinc@10 {
|
||||
|
@ -604,10 +600,10 @@
|
|||
vinc12_rear_sensor_sel = <0>;
|
||||
vinc12_front_sensor_sel = <0>;
|
||||
vinc12_sensor_list = <0>;
|
||||
work_mode = <0x1>;
|
||||
work_mode = <0x0>;
|
||||
iommus = <&mmu_aw 1 0>;
|
||||
delay_init = <1>;
|
||||
status = "okay";
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
vinc31:vinc@13 {
|
||||
|
@ -619,7 +615,6 @@
|
|||
vinc13_rear_sensor_sel = <1>;
|
||||
vinc13_front_sensor_sel = <1>;
|
||||
vinc13_sensor_list = <0>;
|
||||
work_mode = <0x1>;
|
||||
iommus = <&mmu_aw 1 0>;
|
||||
delay_init = <1>;
|
||||
status = "disabled";
|
||||
|
@ -649,6 +644,7 @@
|
|||
status = "disabled";
|
||||
};
|
||||
};
|
||||
/*
|
||||
gpio_charger: gpio_charger@0 {
|
||||
compatible = "gpio-charger";
|
||||
gpios = <&pio PH 3 0 1 1 1>;
|
||||
|
@ -657,11 +653,12 @@
|
|||
};
|
||||
gpio_keys {
|
||||
compatible = "gpio-keys";
|
||||
/*pinctrl-names = "default";
|
||||
pinctrl-0 = <&key_pins_pcduino>;*/
|
||||
//pinctrl-names = "default";
|
||||
//pinctrl-0 = <&key_pins_pcduino>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
};
|
||||
*/
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -887,8 +884,8 @@
|
|||
};
|
||||
|
||||
mipib_pins_a: mipib@0 {
|
||||
allwinner,pins = "PA10", "PA11";
|
||||
allwinner,pname = "mipib_ck0n", "mipib_ck0p";
|
||||
allwinner,pins = "PA8", "PA9", "PA10", "PA11";
|
||||
allwinner,pname = "mipib_d1n", "mipib_d1p", "mipib_ck0n", "mipib_ck0p";
|
||||
allwinner,function = "mipib_rx";
|
||||
allwinner,muxsel = <2>;
|
||||
allwinner,drive = <1>;
|
||||
|
@ -896,14 +893,14 @@
|
|||
};
|
||||
|
||||
mipib_pins_b: mipib@1 {
|
||||
allwinner,pins = "PA10", "PA11";
|
||||
allwinner,pins = "PA8", "PA9", "PA10", "PA11";
|
||||
allwinner,pname = "mipib_d1n", "mipib_d1p", "mipib_ck0n", "mipib_ck0p";
|
||||
allwinner,function = "io_disabled";
|
||||
allwinner,muxsel = <0xf>;
|
||||
allwinner,drive = <1>;
|
||||
allwinner,pull = <0>;
|
||||
};
|
||||
/*
|
||||
|
||||
mipib_4lane_pins_a: mipib_4lane@0 {
|
||||
allwinner,pins = "PA8", "PA9";
|
||||
allwinner,pname = "mipib_d1n", "mipib_d1p";
|
||||
|
@ -921,13 +918,13 @@
|
|||
allwinner,drive = <1>;
|
||||
allwinner,pull = <0>;
|
||||
};
|
||||
*/
|
||||
|
||||
twi0_pins_a: twi0@0 {
|
||||
allwinner,pins = "PE4", "PE5";
|
||||
allwinner,pname = "twi0_scl", "twi0_sda";
|
||||
allwinner,function = "twi0";
|
||||
allwinner,muxsel = <8>;
|
||||
allwinner,drive = <0>;
|
||||
allwinner,drive = <1>;
|
||||
allwinner,pull = <1>;
|
||||
};
|
||||
|
||||
|
@ -935,7 +932,7 @@
|
|||
allwinner,pins = "PE4", "PE5";
|
||||
allwinner,function = "io_disabled";
|
||||
allwinner,muxsel = <0xf>;
|
||||
allwinner,drive = <0>;
|
||||
allwinner,drive = <1>;
|
||||
allwinner,pull = <0>;
|
||||
};
|
||||
|
||||
|
@ -944,7 +941,7 @@
|
|||
allwinner,pname = "twi1_scl", "twi1_sda";
|
||||
allwinner,function = "twi1";
|
||||
allwinner,muxsel = <4>;
|
||||
allwinner,drive = <1>;
|
||||
allwinner,drive = <0>;
|
||||
allwinner,pull = <1>;
|
||||
};
|
||||
|
||||
|
@ -952,7 +949,7 @@
|
|||
allwinner,pins = "PA6", "PA7";
|
||||
allwinner,function = "io_disabled";
|
||||
allwinner,muxsel = <0xf>;
|
||||
allwinner,drive = <1>;
|
||||
allwinner,drive = <0>;
|
||||
allwinner,pull = <0>;
|
||||
};
|
||||
|
||||
|
@ -1591,7 +1588,7 @@
|
|||
/*usb_id_gpio = <&pio PH 14 0 1 0xffffffff 0xffffffff>;*/
|
||||
/*usb_det_vbus_gpio = <&pio PH 3 0 1 0xffffffff 0xffffffff>;*/
|
||||
usb_det_vbus_gpio = "axp_ctrl";
|
||||
det_vbus_supply = <&gpio_charger>;
|
||||
/*det_vbus_supply = <&gpio_charger>;*/
|
||||
usb_regulator_io = "nocare";
|
||||
usb_wakeup_suspend = <0x0>;
|
||||
usb_luns = <0x3>;
|
||||
|
@ -1601,7 +1598,7 @@
|
|||
};
|
||||
|
||||
&udc {
|
||||
det_vbus_supply = <&gpio_charger>;
|
||||
/*det_vbus_supply = <&gpio_charger>;*/
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
|
|
@ -1645,23 +1645,23 @@ CONFIG_ENABLE_SENSOR_FLIP_OPTION=y
|
|||
# CONFIG_ACTUATOR is not set
|
||||
# CONFIG_SENSOR_LIST is not set
|
||||
# CONFIG_BUF_AUTO_UPDATE is not set
|
||||
# CONFIG_VIN_LOG is not set
|
||||
CONFIG_VIN_LOG=y
|
||||
# CONFIG_PIPELINE_RESET is not set
|
||||
# CONFIG_MULTI_FRAME is not set
|
||||
CONFIG_SUPPORT_ISP_TDM=y
|
||||
# CONFIG_TDM_LBC_EN is not set
|
||||
CONFIG_TDM_ONE_BUFFER=y
|
||||
CONFIG_TDM_LBC_EN=y
|
||||
# CONFIG_TDM_ONE_BUFFER is not set
|
||||
# CONFIG_TDM_ONE_BUFFER_WITH_TWORX is not set
|
||||
# CONFIG_TDM_OFFLINE_HANDLE_RAW is not set
|
||||
# CONFIG_MIPI_VC is not set
|
||||
CONFIG_AVG_TDM_FIFO=y
|
||||
# CONFIG_AVG_TDM_FIFO is not set
|
||||
# CONFIG_DISPPLAY_SYNC is not set
|
||||
CONFIG_VIN_IOMMU=y
|
||||
CONFIG_D3D=y
|
||||
# CONFIG_D3D_LTF_EN is not set
|
||||
CONFIG_D3D_COMPRESS_EN=y
|
||||
# CONFIG_WDR is not set
|
||||
CONFIG_FRAMEDONE_TWO_BUFFER=y
|
||||
# CONFIG_FRAMEDONE_TWO_BUFFER is not set
|
||||
CONFIG_ISP_SERVER_MELIS=y
|
||||
CONFIG_VIN_INIT_MELIS=y
|
||||
# CONFIG_SUPPORT_THREE_CAMERA_MELIS is not set
|
||||
|
@ -2828,7 +2828,7 @@ CONFIG_PROC_FS=y
|
|||
CONFIG_MODULE_PROC_FS=y
|
||||
# CONFIG_EXECDOMAINS_PROC_FS is not set
|
||||
# CONFIG_PROC_SYSCTL is not set
|
||||
# CONFIG_PROC_PAGE_MONITOR is not set
|
||||
CONFIG_PROC_PAGE_MONITOR=y
|
||||
# CONFIG_PROC_CHILDREN is not set
|
||||
# CONFIG_PROC_UID is not set
|
||||
CONFIG_KERNFS=y
|
||||
|
|
|
@ -53,7 +53,8 @@ size = 16
|
|||
|
||||
[partition]
|
||||
name = rootfs
|
||||
size = 12288
|
||||
;size = 12288
|
||||
size = 12544
|
||||
downloadfile = "rootfs.fex"
|
||||
user_type = 0x8000
|
||||
|
||||
|
|
|
@ -1107,10 +1107,10 @@ struct isp_cfg_array cfg_arr[] = {
|
|||
#endif
|
||||
|
||||
#ifdef SENSOR_SC202CS
|
||||
{"sc202cs_mipi", "sc202cs_mipi_isp600_rgb_20250304_100237", 1600, 1200, 30, 0, 0, &sc202cs_mipi_rgb_isp_cfg},
|
||||
{"sc202cs_mipi", "sc202cs_mipi_isp600_rgb_20250304_100237", 1600, 1200, 30, 0, 1, &sc202cs_mipi_rgb_isp_cfg},
|
||||
{"sc202cs_mipi_2", "sc202cs_mipi_isp600_ir_20250221_141621", 1600, 1200, 30, 0, 0, &sc202cs_mipi_ir_isp_cfg},
|
||||
{"sc202cs_mipi_2", "sc202cs_mipi_isp600_ir_20250221_141621", 1600, 1200, 30, 0, 1, &sc202cs_mipi_ir_isp_cfg},
|
||||
{"sc202csr_mipi", "sc202cs_mipi_isp600_rgb_20250304_100237", 1600, 1200, 30, 0, 0, &sc202cs_mipi_rgb_isp_cfg},
|
||||
{"sc202csr_mipi", "sc202cs_mipi_isp600_rgb_20250304_100237", 1600, 1200, 30, 0, 1, &sc202cs_mipi_rgb_isp_cfg},
|
||||
{"sc202csi_mipi", "sc202cs_mipi_isp600_ir_20250221_141621", 1600, 1200, 30, 0, 0, &sc202cs_mipi_ir_isp_cfg},
|
||||
{"sc202csi_mipi", "sc202cs_mipi_isp600_ir_20250221_141621", 1600, 1200, 30, 0, 1, &sc202cs_mipi_ir_isp_cfg},
|
||||
#endif
|
||||
|
||||
#ifdef SENSOR_SC2336P
|
||||
|
|
|
@ -74,16 +74,12 @@ MODULE_LICENSE("GPL");
|
|||
#define GAIN_MAX 0xF8
|
||||
#define GAIN_STEP 1
|
||||
#define GAIN_DEFAULT 20
|
||||
#define GAIN_STEP_BASE 128 //mean gain min step is 1/64gain
|
||||
#define DIG_GAIN 0x3e06
|
||||
#define DIG_FINE_GAIN 0x3e07
|
||||
#define ANA_GAIN 0x3e09
|
||||
|
||||
#define MCLK (24*1000*1000)
|
||||
|
||||
#define SENSOR_NUM 0x2
|
||||
#define SENSOR_NAME "sc202cs_mipi"
|
||||
#define SENSOR_NAME_2 "sc202cs_mipi_2"
|
||||
#define SENSOR_NAME "sc202csr_mipi"
|
||||
#define SENSOR_NAME_2 "sc202csi_mipi"
|
||||
|
||||
/*
|
||||
* The default register settings
|
||||
|
@ -335,24 +331,35 @@ static int sensor_s_exp(struct v4l2_subdev *sd, unsigned int exp_val)
|
|||
{
|
||||
data_type explow, expmid, exphigh;
|
||||
struct sensor_info *info = to_state(sd);
|
||||
#if (SC202CS == 1)
|
||||
exphigh = (unsigned char) (0x0f & (exp_val>>16));
|
||||
expmid = (unsigned char) (0xff & (exp_val>>8));
|
||||
explow = (unsigned char) (0xf0 & (exp_val<<0));
|
||||
sensor_write(sd, 0x3e02, explow);
|
||||
sensor_write(sd, 0x3e01, expmid);
|
||||
sensor_write(sd, 0x3e00, exphigh);
|
||||
/*struct vin_md *vind = dev_get_drvdata(sd->v4l2_dev->dev);*/
|
||||
/*struct vin_core *vinc = vind->vinc[0];*/
|
||||
|
||||
if (exp_val > EXPOSURE_MAX << 4)
|
||||
exp_val = EXPOSURE_MAX << 4;
|
||||
|
||||
if (exp_val < 16)
|
||||
exp_val = 16;
|
||||
|
||||
// if (exp_val == info->exp) {
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
#if (SC202CS == 1)
|
||||
exphigh = (unsigned char)(0xf & (exp_val >> 12)); // upper 4 bits
|
||||
expmid = (unsigned char)(0xff & (exp_val >> 4)); // middle 7 bits
|
||||
explow = (unsigned char)(0xf0 & (exp_val << 4)); // lower 4 bits
|
||||
sensor_write(sd, 0x3e02, explow); //[7:4]
|
||||
sensor_write(sd, 0x3e01, expmid); //[7:0]
|
||||
sensor_write(sd, 0x3e00, exphigh); //[3:0]
|
||||
#else
|
||||
exphigh = (unsigned char) (0x0f & (exp_val>>16));
|
||||
expmid = (unsigned char) (0xff & (exp_val>>8));
|
||||
explow = (unsigned char) (0xf0 & (exp_val<<0));
|
||||
exphigh = (unsigned char)(exp_val >> 8);
|
||||
explow = (unsigned char)(exp_val & 0xFF);
|
||||
expmid = 0;
|
||||
sensor_write(sd, 0x3e01, exphigh);
|
||||
sensor_write(sd, 0x3e02, explow);
|
||||
sensor_write(sd, 0x3e01, expmid);
|
||||
sensor_write(sd, 0x3e00, exphigh);
|
||||
#endif
|
||||
|
||||
sensor_dbg("%s():%d, exp_val = %d\n", __func__, __LINE__, exp_val);
|
||||
//sensor_dbg("%s():%d, exp_val = %d\n", __func__, __LINE__, exp_val);
|
||||
info->exp = exp_val;
|
||||
|
||||
return 0;
|
||||
|
@ -366,96 +373,56 @@ static int sensor_g_gain(struct v4l2_subdev *sd, __s32 *value)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static unsigned char analog_Gain_Reg[] = {0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f};
|
||||
|
||||
static int setSensorGain(struct v4l2_subdev *sd, int gain)
|
||||
{
|
||||
int ana_gain = gain / GAIN_STEP_BASE;
|
||||
int dig_Gain;
|
||||
int gain_flag = 1;
|
||||
|
||||
if (ana_gain >= 16) {
|
||||
gain_flag = 4;
|
||||
} else if (ana_gain >= 8) {
|
||||
gain_flag = 3;
|
||||
} else if (ana_gain >= 4) {
|
||||
gain_flag = 2;
|
||||
} else if (ana_gain >= 2) {
|
||||
gain_flag = 1;
|
||||
} else {
|
||||
gain_flag = 0;
|
||||
}
|
||||
|
||||
sensor_write(sd, ANA_GAIN, analog_Gain_Reg[gain_flag]);
|
||||
dig_Gain = gain >> gain_flag; //dig_Gain min mean 1/128gain
|
||||
if (dig_Gain < 2 * GAIN_STEP_BASE) {
|
||||
//step1/128
|
||||
sensor_write(sd, DIG_GAIN, 0x00);
|
||||
sensor_write(sd, DIG_FINE_GAIN, dig_Gain - GAIN_STEP_BASE + 0x80);
|
||||
//sensor_print("sensor set analog_gain:0x%02x, dig_gain:0x%02x, dig_fine_gain:0x%02x", analog_Gain_Reg[gain_flag], 0x00, dig_Gain - 128 + 0x80);
|
||||
} else if (dig_Gain < 4 * GAIN_STEP_BASE) {
|
||||
//step1/64
|
||||
sensor_write(sd, DIG_GAIN, 0x01);
|
||||
sensor_write(sd, DIG_FINE_GAIN, (dig_Gain - GAIN_STEP_BASE * 2) / 2 + 0x80);
|
||||
//sensor_print("sensor set analog_gain:0x%02x, dig_gain:0x%02x, dig_fine_gain:0x%02x", analog_Gain_Reg[gain_flag], 0x01, (dig_Gain - 128 * 2) / 2 + 0x80);
|
||||
} else {
|
||||
sensor_write(sd, DIG_GAIN, 0x01);
|
||||
sensor_write(sd, DIG_FINE_GAIN, 0xfc);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sensor_s_gain(struct v4l2_subdev *sd, int gain_val)
|
||||
{
|
||||
struct sensor_info *info = to_state(sd);
|
||||
int tem_gain_val;
|
||||
//sensor_dbg("%s():%d. info:%p, gain_val:%d\n", __func__, __LINE__, info, gain_val);
|
||||
// if (gain_val == info->gain) {
|
||||
// return 0;
|
||||
// }
|
||||
//sensor_dbg("%s():%d. info:%p, gain_val:%d\n", __func__, __LINE__, info, gain_val);
|
||||
// info->gain = gain_val;
|
||||
|
||||
//gain min step is 1/128gain
|
||||
tem_gain_val = gain_val * GAIN_STEP_BASE;
|
||||
if ((tem_gain_val - tem_gain_val / 16 * 16) > 0) {
|
||||
tem_gain_val = tem_gain_val / 16 + 1;
|
||||
// return 0;
|
||||
|
||||
// if (gain_val < 1 * 16)
|
||||
// gain_val = 16;
|
||||
if (gain_val > 16 * 16 - 1)
|
||||
gain_val = 16 * 16 - 1;
|
||||
|
||||
if (gain_val < 32) {
|
||||
sensor_write(sd, 0x3314, 0x1e);
|
||||
sensor_write(sd, 0x3317, 0x10);
|
||||
} else {
|
||||
tem_gain_val = tem_gain_val / 16;
|
||||
}
|
||||
sensor_write(sd, 0x3314, 0x4f);
|
||||
sensor_write(sd, 0x3317, 0x0f);
|
||||
}
|
||||
|
||||
sensor_dbg("%s(), L:%d, gain_val:%d, tem_gain_val:%d, info->gain:%d\n",
|
||||
__func__, __LINE__, gain_val, tem_gain_val, info->gain);
|
||||
if (gain_val < 32) {
|
||||
sensor_write(sd, 0x3e08, 0x03);
|
||||
sensor_write(sd, 0x3e09, gain_val);
|
||||
} else if (gain_val >= 32 && gain_val < 64) {
|
||||
sensor_write(sd, 0x3e08, 0x07);
|
||||
sensor_write(sd, 0x3e09, gain_val >> 1);
|
||||
} else if (gain_val >= 64 && gain_val < 128) {
|
||||
sensor_write(sd, 0x3e08, 0x0f);
|
||||
sensor_write(sd, 0x3e09, gain_val >> 2);
|
||||
} else if (gain_val >= 128) {
|
||||
sensor_write(sd, 0x3e08, 0x1f);
|
||||
sensor_write(sd, 0x3e09, gain_val >> 3);
|
||||
}
|
||||
|
||||
setSensorGain(sd, tem_gain_val);
|
||||
//sensor_dbg("drv sensor_s_gain(%d)\n", gain_val);
|
||||
info->gain = gain_val;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sc202cs_sensor_vts;
|
||||
static int sensor_s_exp_gain(struct v4l2_subdev *sd,
|
||||
struct sensor_exp_gain *exp_gain)
|
||||
{
|
||||
struct sensor_info *info = to_state(sd);
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
int shutter = 0, frame_length = 0;
|
||||
|
||||
sensor_dbg("(%d, %d)\n", exp_gain->exp_val, exp_gain->gain_val);
|
||||
|
||||
|
||||
shutter = exp_gain->exp_val >> 4;
|
||||
if (shutter > sc202cs_sensor_vts - 8)
|
||||
frame_length = shutter + 8;
|
||||
else
|
||||
frame_length = sc202cs_sensor_vts;
|
||||
|
||||
|
||||
sensor_dbg("shutter = %d, frame_length = %d\n", shutter, frame_length);
|
||||
sensor_write(sd, 0x320e, (frame_length >> 8));
|
||||
sensor_write(sd, 0x320f, (frame_length & 0xff));
|
||||
|
||||
|
||||
sensor_s_exp(sd, exp_gain->exp_val);
|
||||
sensor_s_gain(sd, exp_gain->gain_val);
|
||||
info->exp = exp_gain->exp_val;
|
||||
info->gain = exp_gain->gain_val;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -499,7 +466,7 @@ static int sensor_s_hflip(struct v4l2_subdev *sd, int enable)
|
|||
|
||||
static int sensor_get_fmt_mbus_core(struct v4l2_subdev *sd, int *code)
|
||||
{
|
||||
*code = MEDIA_BUS_FMT_SBGGR10_1X10;//MEDIA_BUS_FMT_SRGGB10_1X10; // gc2053 support change the rgb format by itself
|
||||
*code = MEDIA_BUS_FMT_SBGGR10_1X10;// MEDIA_BUS_FMT_SRGGB10_1X10; // gc2053 support change the rgb format by itself
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -779,16 +746,16 @@ static struct sensor_win_size sensor_win_sizes[] = {
|
|||
.height = 1200, //
|
||||
.hoffset = 0,
|
||||
.voffset = 0,
|
||||
.hts = 1920,
|
||||
.hts = 2200,
|
||||
.vts = 1250,
|
||||
.pclk = 72000000,
|
||||
.pclk = 74250000,
|
||||
.mipi_bps = 371250000,
|
||||
.fps_fixed = 30,
|
||||
.bin_factor = 1,
|
||||
.intg_min = 1 << 4,
|
||||
.intg_max = (1250 - 8) << 4,
|
||||
.gain_min = 1 << 4,
|
||||
.gain_max = 64 << 4,
|
||||
.gain_max = 128 << 4,
|
||||
.regs = sensor_normal_regs,
|
||||
.regs_size = ARRAY_SIZE(sensor_normal_regs),
|
||||
.set_size = NULL,
|
||||
|
@ -918,7 +885,7 @@ static int sensor_reg_init(struct sensor_info *info)
|
|||
|
||||
info->width = wsize->width;
|
||||
info->height = wsize->height;
|
||||
sc202cs_sensor_vts = wsize->vts;
|
||||
|
||||
exp_gain.exp_val = EXPOSURE_DEFAULT;
|
||||
exp_gain.gain_val = GAIN_DEFAULT;
|
||||
sensor_s_exp_gain(sd, &exp_gain);
|
||||
|
@ -1070,10 +1037,10 @@ static int sensor_probe(struct i2c_client *client,
|
|||
//info->combo_mode = CMB_PHYA_OFFSET2 | MIPI_NORMAL_MODE;
|
||||
info->stream_seq = MIPI_BEFORE_SENSOR;
|
||||
info->af_first_flag = 1;
|
||||
//info->time_hs = 0x11;
|
||||
info->deskew = 0x02;
|
||||
info->exp = 0;
|
||||
info->gain = 0;
|
||||
//info->time_hs = 0x11;
|
||||
info->deskew = 0x02;
|
||||
|
||||
#if defined CONFIG_VIN_INIT_MELIS
|
||||
info->first_power_flag = 1;
|
||||
|
|
|
@ -28,7 +28,8 @@ CONFIG_FPU_DOUBLE=y
|
|||
# Sunxi Platform Support
|
||||
#
|
||||
# CONFIG_CPUFREQ_SUPPORT is not set
|
||||
# CONFIG_PANIC_CLI is not set
|
||||
CONFIG_PANIC_CLI=y
|
||||
CONFIG_PANIC_CLI_PWD=y
|
||||
|
||||
#
|
||||
# RTOS Kernel Setup
|
||||
|
@ -212,7 +213,7 @@ CONFIG_ISP_READ_THRESHOLD=y
|
|||
# CONFIG_ISP_FAST_CONVERGENCE is not set
|
||||
# CONFIG_ISP_ONLY_HARD_LIGHTADC is not set
|
||||
# CONFIG_ISP_HARD_LIGHTADC is not set
|
||||
CONFIG_ISP_NUMBER=1
|
||||
CONFIG_ISP_NUMBER=2
|
||||
|
||||
#
|
||||
# sensor driver select
|
||||
|
@ -287,7 +288,7 @@ CONFIG_RPMSG_NOTIFY=y
|
|||
# CONFIG_RPMSG_SPEEDTEST is not set
|
||||
CONFIG_AMP_SHARE_IRQ=y
|
||||
CONFIG_RPMSG_CLIENT=y
|
||||
CONFIG_RPMSG_CLIENT_TEST=y
|
||||
# CONFIG_RPMSG_CLIENT_TEST is not set
|
||||
CONFIG_RPMSG_CLIENT_QUEUE_SIZE=16
|
||||
# CONFIG_RPMSG_CLIENT_DEBUG is not set
|
||||
CONFIG_RPMSG_HEARBEAT=y
|
||||
|
@ -428,7 +429,7 @@ CONFIG_MODVERSIONS=y
|
|||
# CONFIG_SHOW_FULL_VERSION is not set
|
||||
CONFIG_CROSS_COMPILE="riscv64-unknown-elf-"
|
||||
# CONFIG_INIT_CARD_PRODUCT is not set
|
||||
CONFIG_LOG_DEFAULT_LEVEL=4
|
||||
CONFIG_LOG_DEFAULT_LEVEL=1
|
||||
# CONFIG_CC_STACKPROTECTOR_STRONG is not set
|
||||
# CONFIG_LOG_RELEASE is not set
|
||||
# CONFIG_BOOTUP_TURBO is not set
|
||||
|
@ -437,7 +438,7 @@ CONFIG_LOG_DEFAULT_LEVEL=4
|
|||
CONFIG_DYNAMIC_LOG_LEVEL_SUPPORT=y
|
||||
CONFIG_LOG_LEVEL_STORAGE_NONE=y
|
||||
# CONFIG_LOG_LEVEL_STORAGE_RTC is not set
|
||||
CONFIG_DYNAMIC_LOG_DEFAULT_LEVEL=4
|
||||
CONFIG_DYNAMIC_LOG_DEFAULT_LEVEL=2
|
||||
# CONFIG_FRAME_POINTER is not set
|
||||
CONFIG_FRAME_WARN=8192
|
||||
CONFIG_UART_CLI_USE_NONE=y
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
;i2c configuration
|
||||
;----------------------------------------------------------------------------------
|
||||
[twi0]
|
||||
twi0_scl = port:PE4<8><1><default><default>
|
||||
twi0_sda = port:PE5<8><1><default><default>
|
||||
twi0_scl = port:PE04<8><1><default><default>
|
||||
twi0_sda = port:PE05<8><1><default><default>
|
||||
|
||||
[twi1]
|
||||
;twi1_scl = port:PA06<4><1><default><default>
|
||||
;twi1_sda = port:PA07<4><1><default><default>
|
||||
;[twi1]
|
||||
;twi1_scl = port:PA06<4><1><0><default>
|
||||
;twi1_sda = port:PA07<4><1><0><default>
|
||||
|
||||
;[twi2]
|
||||
;twi2_scl = port:PH05<4><1><default><default>
|
||||
|
@ -47,6 +47,24 @@ uart_rx = port:PE01<7><1><default><default>
|
|||
|
||||
[sensor0]
|
||||
used0 = 1
|
||||
reset0 = port:PE10<1><1><default><default>
|
||||
pwdn0 = port:PF0<1><1><default><default>
|
||||
mclk0 = port:PE13<5><1><default><default>
|
||||
reset0 = port:PE10<1><1><default><default>
|
||||
pwdn0 = port:PF01<1><1><default><default>
|
||||
mclk0 = port:PE13<5><1><default><default>
|
||||
mclk_id0 = 1
|
||||
name0 = "sc202csr_mipi"
|
||||
twi_addr0 = 0x20
|
||||
twi_id0 = 0
|
||||
addr_width0 = 16
|
||||
data_width0 = 8
|
||||
|
||||
[sensor1]
|
||||
used1 = 1
|
||||
reset1 = port:PE11<1><1><default><default>
|
||||
pwdn1 = port:PF02<1><1><default><default>
|
||||
mclk1 = port:PE13<5><1><default><default>
|
||||
mclk_id1 = 1
|
||||
name1 = "sc202csi_mipi"
|
||||
twi_addr1 = 0x6c
|
||||
twi_id1 = 0
|
||||
addr_width1 = 16
|
||||
data_width1 = 8
|
||||
|
|
|
@ -19,23 +19,21 @@ int app_entry(void *param)
|
|||
rpmsg_notify("twi0", NULL, 0);
|
||||
rpmsg_notify("tdm0", NULL, 0);
|
||||
rpmsg_notify("isp0", NULL, 0);
|
||||
// rpmsg_notify("isp1", NULL, 0);
|
||||
rpmsg_notify("isp1", NULL, 0);
|
||||
rpmsg_notify("scaler0", NULL, 0);
|
||||
// rpmsg_notify("scaler1", NULL, 0);
|
||||
rpmsg_notify("scaler1", NULL, 0);
|
||||
rpmsg_notify("scaler4", NULL, 0);
|
||||
// rpmsg_notify("scaler5", NULL, 0);
|
||||
rpmsg_notify("scaler5", NULL, 0);
|
||||
rpmsg_notify("scaler8", NULL, 0);
|
||||
// rpmsg_notify("scaler9", NULL, 0);
|
||||
rpmsg_notify("scaler9", NULL, 0);
|
||||
rpmsg_notify("scaler12", NULL, 0);
|
||||
// rpmsg_notify("scaler13", NULL, 0);
|
||||
rpmsg_notify("vinc0", NULL, 0);
|
||||
// rpmsg_notify("vinc1", NULL, 0);
|
||||
rpmsg_notify("vinc1", NULL, 0);
|
||||
rpmsg_notify("vinc4", NULL, 0);
|
||||
// rpmsg_notify("vinc5", NULL, 0);
|
||||
rpmsg_notify("vinc5", NULL, 0);
|
||||
rpmsg_notify("vinc8", NULL, 0);
|
||||
// rpmsg_notify("vinc9", NULL, 0);
|
||||
rpmsg_notify("vinc9", NULL, 0);
|
||||
rpmsg_notify("vinc12", NULL, 0);
|
||||
// rpmsg_notify("vinc13", NULL, 0);
|
||||
#endif
|
||||
#else
|
||||
hal_msleep(200);
|
||||
|
|
|
@ -19,52 +19,38 @@
|
|||
#include "../../utility/media-bus-format.h"
|
||||
#include "../../utility/vin_supply.h"
|
||||
|
||||
#define MCLK (24*1000*1000)
|
||||
#define V4L2_IDENT_SENSOR 0xeb52
|
||||
#define MCLK (24*1000*1000)
|
||||
#define V4L2_IDENT_SENSOR 0xeb52
|
||||
|
||||
/*
|
||||
* Our nominal (default) frame rate.
|
||||
*/
|
||||
#define ID_REG_HIGH 0xf0
|
||||
#define ID_REG_LOW 0xf1
|
||||
#define ID_VAL_HIGH ((V4L2_IDENT_SENSOR) >> 8)
|
||||
#define ID_VAL_LOW ((V4L2_IDENT_SENSOR) & 0xff)
|
||||
#define SENSOR_FRAME_RATE 30
|
||||
|
||||
#define VTS 1250
|
||||
|
||||
#define EXPOSURE_MIN 6
|
||||
#define EXPOSURE_MAX (VTS - 6)
|
||||
#define EXPOSURE_STEP 1
|
||||
#define EXPOSURE_DEFAULT 0x0148
|
||||
|
||||
#define GAIN_MIN 0x00
|
||||
#define GAIN_MAX 0xF8
|
||||
#define GAIN_STEP 1
|
||||
#define GAIN_DEFAULT 20
|
||||
#define GAIN_STEP_BASE 128 //mean gain min step is 1/64gain
|
||||
//define the registers
|
||||
#define EXP_HIGH 0x3e00
|
||||
#define EXP_MID 0x3e01
|
||||
#define EXP_LOW 0x3e02
|
||||
#define DIG_GAIN 0x3e06
|
||||
#define DIG_FINE_GAIN 0x3e07
|
||||
#define ANA_GAIN 0x3e09
|
||||
#define GAIN_STEP_BASE 128
|
||||
|
||||
/*
|
||||
* The sc202cs i2c address
|
||||
*/
|
||||
#define I2C_ADDR 0x7c//0xdc
|
||||
#define ID_REG_HIGH 0x3107
|
||||
#define ID_REG_LOW 0x3108
|
||||
#define ID_VAL_HIGH 0xeb
|
||||
#define ID_VAL_LOW 0x52
|
||||
#define SENSOR_FRAME_RATE 30
|
||||
|
||||
#define GAIN_STEP_BASE 64 //mean gain min step is 1/64gain
|
||||
|
||||
#define I2C_ADDR 0x60
|
||||
//#define I2C_ADDR_2 0x32
|
||||
|
||||
#define SENSOR_NUM 0x2
|
||||
#define SENSOR_NAME "sc202cs_mipi"
|
||||
#define SENSOR_NAME_2 "sc202cs_mipi_2"
|
||||
#define SENSOR_NAME "sc202csr_mipi"
|
||||
#define SENSOR_NAME_2 "sc202csi_mipi"
|
||||
|
||||
#define SC202CS_1600X1200_30FPS
|
||||
|
||||
static int sensor_power_count[2];
|
||||
static int sensor_stream_count[2];
|
||||
static struct sensor_format_struct *current_win[2];
|
||||
static struct sensor_format_struct *current_switch_win[2];
|
||||
|
||||
#define SENSOR_30FPS 1
|
||||
#define SENSOR_25FPS 0
|
||||
#define SENSOR_20FPS 0
|
||||
#define SENSOR_15FPS 0
|
||||
|
||||
/*
|
||||
* The default register settings
|
||||
|
@ -72,14 +58,9 @@ static struct sensor_format_struct *current_switch_win[2];
|
|||
|
||||
static struct regval_list sensor_default_regs[] = {
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#if defined CONFIG_ISP_READ_THRESHOLD || defined CONFIG_ISP_ONLY_HARD_LIGHTADC//FULL_SIZE
|
||||
#if SENSOR_30FPS
|
||||
|
||||
static struct regval_list sensor_1600x1200_30_regs[] = {
|
||||
static struct regval_list sensor_normal_regs[] = {
|
||||
{0x0103, 0x01},
|
||||
{0x0100, 0x00},
|
||||
{0x36e9, 0x80},
|
||||
|
@ -190,19 +171,7 @@ static struct regval_list sensor_1600x1200_30_regs[] = {
|
|||
{0x450d, 0x61},
|
||||
{0x0100, 0x01},
|
||||
};
|
||||
#endif
|
||||
|
||||
#else //CONFIG_ISP_FAST_CONVERGENCE || CONFIG_ISP_HARD_LIGHTADC
|
||||
static struct regval_list sensor_480p120_regs[] = {
|
||||
|
||||
};
|
||||
#if SENSOR_30FPS
|
||||
static struct regval_list sensor_480p120fps_to_1600x1200_30fps[] = {
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/*
|
||||
* Here we'll try to encapsulate the changes for just the output
|
||||
* video format.
|
||||
|
@ -213,53 +182,29 @@ static struct regval_list sensor_fmt_raw[] = {
|
|||
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Code for dealing with controls.
|
||||
* fill with different sensor module
|
||||
* different sensor module has different settings here
|
||||
* if not support the follow function , retrun -EINVAL
|
||||
*/
|
||||
#if 0
|
||||
static int sensor_g_exp(struct v4l2_subdev *sd, __s32 *value)
|
||||
{
|
||||
struct sensor_info *info = to_state(sd);
|
||||
*value = info->exp;
|
||||
sensor_dbg("sensor_get_exposure = %d\n", info->exp);
|
||||
return 0;
|
||||
}
|
||||
static int sensor_g_gain(struct v4l2_subdev *sd, __s32 *value)
|
||||
{
|
||||
struct sensor_info *info = to_state(sd);
|
||||
*value = info->gain;
|
||||
sensor_dbg("sensor_get_gain = %d\n", info->gain);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
static int sc202cs_sensor_vts;
|
||||
|
||||
static int sensor_s_exp(int id, unsigned int exp_val)
|
||||
{
|
||||
unsigned int tmp_exp_val = exp_val;
|
||||
data_type explow, expmid, exphigh;
|
||||
|
||||
int explow, expmid, exphigh;
|
||||
//struct sensor_info *info = to_state(sd);
|
||||
/*struct vin_md *vind = dev_get_drvdata(sd->v4l2_dev->dev);*/
|
||||
/*struct vin_core *vinc = vind->vinc[0];*/
|
||||
|
||||
if (exp_val > EXPOSURE_MAX << 4)
|
||||
exp_val = EXPOSURE_MAX << 4;
|
||||
sensor_print("exp_val:%d.\n", exp_val);
|
||||
if (exp_val > sc202cs_sensor_vts << 4)
|
||||
exp_val = sc202cs_sensor_vts << 4;
|
||||
|
||||
if (exp_val < 16)
|
||||
exp_val = 16;
|
||||
|
||||
exphigh = (unsigned char) (0x0f & (exp_val>>16));
|
||||
expmid = (unsigned char) (0xff & (exp_val>>8));
|
||||
explow = (unsigned char) (0xf0 & (exp_val<<0));
|
||||
sensor_write(id, 0x3e02, explow);
|
||||
sensor_write(id, 0x3e01, expmid);
|
||||
sensor_write(id, 0x3e00, exphigh);
|
||||
sensor_dbg("%s():%d, exp_val = %d\n", __func__, __LINE__, exp_val);
|
||||
//info->exp = exp_val;
|
||||
sensor_print("exp_val:%d.\n", exp_val);
|
||||
|
||||
exphigh = (unsigned char)(0xf & (exp_val >> 12)); // upper 4 bits
|
||||
expmid = (unsigned char)(0xff & (exp_val >> 4)); // middle 7 bits
|
||||
explow = (unsigned char)(0xf0 & (exp_val << 4)); // lower 4 bits
|
||||
|
||||
sensor_write(id, 0x3e02, explow); //[7:4]
|
||||
sensor_write(id, 0x3e01, expmid); //[7:0]
|
||||
sensor_write(id, 0x3e00, exphigh); //[3:0]
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -272,7 +217,11 @@ static int setSensorGain(int id, int gain)
|
|||
int dig_Gain;
|
||||
int gain_flag = 1;
|
||||
|
||||
if (ana_gain >= 16) {
|
||||
if (ana_gain >= 32 * 2) {
|
||||
gain_flag = 5;
|
||||
} else if (ana_gain >= 32) {
|
||||
gain_flag = 5;
|
||||
} else if (ana_gain >= 16) {
|
||||
gain_flag = 4;
|
||||
} else if (ana_gain >= 8) {
|
||||
gain_flag = 3;
|
||||
|
@ -289,16 +238,21 @@ static int setSensorGain(int id, int gain)
|
|||
if (dig_Gain < 2 * GAIN_STEP_BASE) {
|
||||
//step1/128
|
||||
sensor_write(id, DIG_GAIN, 0x00);
|
||||
sensor_write(id, DIG_FINE_GAIN, dig_Gain - GAIN_STEP_BASE + 0x80);
|
||||
sensor_write(id, DIG_FINE_GAIN, dig_Gain - 128 + 0x80);
|
||||
//sensor_print("sensor set analog_gain:0x%02x, dig_gain:0x%02x, dig_fine_gain:0x%02x", analog_Gain_Reg[gain_flag], 0x00, dig_Gain - 128 + 0x80);
|
||||
} else if (dig_Gain < 4 * GAIN_STEP_BASE) {
|
||||
//step1/64
|
||||
sensor_write(id, DIG_GAIN, 0x01);
|
||||
sensor_write(id, DIG_FINE_GAIN, (dig_Gain - GAIN_STEP_BASE * 2) / 2 + 0x80);
|
||||
sensor_write(id, DIG_FINE_GAIN, (dig_Gain - 128 * 2) / 2 + 0x80);
|
||||
//sensor_print("sensor set analog_gain:0x%02x, dig_gain:0x%02x, dig_fine_gain:0x%02x", analog_Gain_Reg[gain_flag], 0x01, (dig_Gain - 128 * 2) / 2 + 0x80);
|
||||
} else if (dig_Gain < 8 * GAIN_STEP_BASE) {
|
||||
//step1/32
|
||||
sensor_write(id, DIG_GAIN, 0x03);
|
||||
sensor_write(id, DIG_FINE_GAIN, (dig_Gain - 128 * 4) / 4 + 0x80);
|
||||
//sensor_print("sensor set analog_gain:0x%02x, dig_gain:0x%02x, dig_fine_gain:0x%02x", analog_Gain_Reg[gain_flag], 0x03, (dig_Gain - 128 * 4) / 4 + 0x80);
|
||||
} else {
|
||||
sensor_write(id, DIG_GAIN, 0x01);
|
||||
sensor_write(id, DIG_FINE_GAIN, 0xfc);
|
||||
sensor_write(id, DIG_GAIN, 0x03);
|
||||
sensor_write(id, DIG_FINE_GAIN, 0xfe);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -306,8 +260,10 @@ static int setSensorGain(int id, int gain)
|
|||
|
||||
static int sensor_s_gain(int id, int gain_val)
|
||||
{
|
||||
#if 0
|
||||
int tem_gain_val;
|
||||
|
||||
|
||||
sensor_print("gain_val:%d.\n", gain_val);
|
||||
//gain min step is 1/128gain
|
||||
tem_gain_val = gain_val * GAIN_STEP_BASE;
|
||||
if ((tem_gain_val - tem_gain_val / 16 * 16) > 0) {
|
||||
|
@ -316,156 +272,94 @@ static int sensor_s_gain(int id, int gain_val)
|
|||
tem_gain_val = tem_gain_val / 16;
|
||||
}
|
||||
|
||||
sensor_dbg("%s(), L:%d, gain_val:%d, tem_gain_val:%d, info->gain:%d\n",
|
||||
__func__, __LINE__, gain_val, tem_gain_val, info->gain);
|
||||
|
||||
sensor_print("%s(), L:%d, gain_val:%d, tem_gain_val:%d\n",
|
||||
__func__, __LINE__, gain_val, tem_gain_val);
|
||||
|
||||
setSensorGain(id, tem_gain_val);
|
||||
#else
|
||||
if (gain_val > 16 * 16 - 1)
|
||||
gain_val = 16 * 16 - 1;
|
||||
|
||||
if (gain_val < 32) {
|
||||
sensor_write(id, 0x3314, 0x1e);
|
||||
sensor_write(id, 0x3317, 0x10);
|
||||
} else {
|
||||
sensor_write(id, 0x3314, 0x4f);
|
||||
sensor_write(id, 0x3317, 0x0f);
|
||||
}
|
||||
|
||||
if (gain_val < 32) {
|
||||
sensor_write(id, 0x3e08, 0x03);
|
||||
sensor_write(id, 0x3e09, gain_val);
|
||||
} else if (gain_val >= 32 && gain_val < 64) {
|
||||
sensor_write(id, 0x3e08, 0x07);
|
||||
sensor_write(id, 0x3e09, gain_val >> 1);
|
||||
} else if (gain_val >= 64 && gain_val < 128) {
|
||||
sensor_write(id, 0x3e08, 0x0f);
|
||||
sensor_write(id, 0x3e09, gain_val >> 2);
|
||||
} else if (gain_val >= 128) {
|
||||
sensor_write(id, 0x3e08, 0x1f);
|
||||
sensor_write(id, 0x3e09, gain_val >> 3);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int sc202cs_sensor_vts;
|
||||
static int sensor_s_exp_gain(int id, struct sensor_exp_gain *exp_gain)
|
||||
{
|
||||
int exp_val, gain_val;
|
||||
int exp_val,gain_val;
|
||||
int shutter = 0, frame_length = 0;
|
||||
|
||||
exp_val = exp_gain->exp_val;
|
||||
gain_val = exp_gain->gain_val;
|
||||
sensor_s_exp(id, exp_gain->exp_val);
|
||||
sensor_s_gain(id, exp_gain->gain_val);
|
||||
sensor_s_exp(id, exp_val);
|
||||
sensor_s_gain(id, gain_val);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int sensor_flip_status;
|
||||
static int sensor_s_vflip(int id, int enable)
|
||||
{
|
||||
data_type get_value;
|
||||
data_type set_value;
|
||||
|
||||
if (!(enable == 0 || enable == 1))
|
||||
return -1;
|
||||
|
||||
sensor_read(id, 0x00, &get_value);
|
||||
sensor_dbg("ready to vflip, regs_data = 0x%x\n", get_value);
|
||||
|
||||
if (enable) {
|
||||
set_value = get_value | 0x04;
|
||||
sensor_flip_status |= 0x04;
|
||||
} else {
|
||||
set_value = get_value & 0xFB;
|
||||
sensor_flip_status &= 0xFB;
|
||||
}
|
||||
sensor_write(id, 0x00, set_value);
|
||||
usleep_range(80000, 100000);
|
||||
sensor_read(id, 0x00, &get_value);
|
||||
sensor_dbg("after vflip, regs_data = 0x%x, sensor_flip_status = %d\n",
|
||||
get_value, sensor_flip_status);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sensor_s_hflip(int id, int enable)
|
||||
{
|
||||
data_type get_value;
|
||||
data_type set_value;
|
||||
|
||||
if (!(enable == 0 || enable == 1))
|
||||
return -1;
|
||||
|
||||
sensor_read(id, 0x00, &get_value);
|
||||
sensor_dbg("ready to hflip, regs_data = 0x%x\n", get_value);
|
||||
|
||||
if (enable) {
|
||||
set_value = get_value | 0x08;
|
||||
sensor_flip_status |= 0x08;
|
||||
} else {
|
||||
set_value = get_value & 0xF7;
|
||||
sensor_flip_status &= 0xF7;
|
||||
}
|
||||
sensor_write(id, 0x00, set_value);
|
||||
usleep_range(80000, 100000);
|
||||
sensor_read(id, 0x00, &get_value);
|
||||
sensor_dbg("after hflip, regs_data = 0x%x, sensor_flip_status = %d\n",
|
||||
get_value, sensor_flip_status);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sensor_get_fmt_mbus_core(struct v4l2_subdev *sd, int *code)
|
||||
{
|
||||
// struct sensor_info *info = to_state(sd);
|
||||
// data_type get_value = 0, check_value = 0;
|
||||
|
||||
// sensor_read(sd, 0x17, &get_value);
|
||||
// check_value = get_value & 0x03;
|
||||
// check_value = sensor_flip_status & 0x3;
|
||||
// sensor_dbg("0x17 = 0x%x, check_value = 0x%x\n", get_value, check_value);
|
||||
|
||||
// switch (check_value) {
|
||||
// case 0x00:
|
||||
// sensor_dbg("RGGB\n");
|
||||
// *code = MEDIA_BUS_FMT_SRGGB10_1X10;
|
||||
// break;
|
||||
// case 0x01:
|
||||
// sensor_dbg("GRBG\n");
|
||||
// *code = MEDIA_BUS_FMT_SGRBG10_1X10;
|
||||
// break;
|
||||
// case 0x02:
|
||||
// sensor_dbg("GBRG\n");
|
||||
// *code = MEDIA_BUS_FMT_SGBRG10_1X10;
|
||||
// break;
|
||||
// case 0x03:
|
||||
// sensor_dbg("BGGR\n");
|
||||
// *code = MEDIA_BUS_FMT_SBGGR10_1X10;
|
||||
// break;
|
||||
// default:
|
||||
// *code = info->fmt->mbus_code;
|
||||
// }
|
||||
*code = MEDIA_BUS_FMT_SRGGB10_1X10; // sc202cs support change the rgb format by itself
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Stuff that knows about the sensor.
|
||||
*/
|
||||
static int sensor_power(int id, int on)
|
||||
{
|
||||
if (on && (sensor_power_count[id])++ > 0)
|
||||
int ret;
|
||||
if (on && (sensor_power_count[id])++ > 0) {
|
||||
return 0;
|
||||
else if (!on && (sensor_power_count[id] == 0 || --(sensor_power_count[id]) > 0))
|
||||
} else if (!on && (sensor_power_count[id] == 0 || --(sensor_power_count[id]) > 0)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (on) {
|
||||
switch(on){
|
||||
case PWR_ON:
|
||||
sensor_print("PWR_ON!\n");
|
||||
vin_set_mclk(id, 0);
|
||||
hal_usleep(1000);
|
||||
vin_set_mclk_freq(id, MCLK);
|
||||
vin_set_mclk(id, 1);
|
||||
hal_usleep(1000);
|
||||
//vin_gpio_set_status(id, PWDN, 1);
|
||||
ret = vin_gpio_get_status(id, IR_CUT0);
|
||||
if(ret != 1){ //if not output, set output
|
||||
vin_gpio_set_status(id, IR_CUT0, 1); /* power en*/
|
||||
vin_gpio_write(id, IR_CUT0, CSI_GPIO_HIGH); /* power en*/
|
||||
}
|
||||
//vin_gpio_get_status(id, IR_CUT0);
|
||||
vin_gpio_read(id, IR_CUT0);
|
||||
vin_gpio_set_status(id, PWDN, 1);
|
||||
vin_gpio_set_status(id, RESET, 1);
|
||||
//vin_gpio_set_status(sd, POWER_EN, 1);
|
||||
//vin_gpio_write(id, PWDN, CSI_GPIO_LOW);
|
||||
//vin_gpio_set_status(id, IR_CUT0, 1); /* power en*/
|
||||
|
||||
//vin_gpio_write(id, IR_CUT0, CSI_GPIO_HIGH); /* power en*/
|
||||
vin_gpio_write(id, PWDN, CSI_GPIO_LOW);
|
||||
vin_gpio_write(id, RESET, CSI_GPIO_LOW);
|
||||
hal_usleep(1000);
|
||||
//vin_gpio_write(id, PWDN, CSI_GPIO_HIGH);
|
||||
hal_usleep(1000);
|
||||
vin_gpio_write(id, PWDN, CSI_GPIO_HIGH);
|
||||
vin_gpio_write(id, RESET, CSI_GPIO_HIGH);
|
||||
hal_usleep(1000);
|
||||
break;
|
||||
|
||||
break;
|
||||
case PWR_OFF:
|
||||
sensor_print("PWR_OFF!\n");
|
||||
vin_set_mclk(id, 0);
|
||||
hal_usleep(1000);
|
||||
// vin_gpio_set_status(id, PWDN, 1);
|
||||
vin_gpio_set_status(id, PWDN, 1);
|
||||
vin_gpio_set_status(id, RESET, 1);
|
||||
// vin_gpio_write(id, PWDN, CSI_GPIO_LOW);
|
||||
vin_gpio_write(id, PWDN, CSI_GPIO_LOW);
|
||||
vin_gpio_write(id, RESET, CSI_GPIO_LOW);
|
||||
break;
|
||||
default:
|
||||
|
@ -495,55 +389,25 @@ static int sensor_set_ir(int id, int status)
|
|||
default:
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int sensor_reset(int id, u32 val)
|
||||
{
|
||||
|
||||
sensor_dbg("%s: val=%d\n", __func__);
|
||||
switch (val) {
|
||||
case 0:
|
||||
vin_gpio_write(id, RESET, CSI_GPIO_HIGH);
|
||||
hal_usleep(1000);
|
||||
break;
|
||||
case 1:
|
||||
vin_gpio_write(id, RESET, CSI_GPIO_LOW);
|
||||
hal_usleep(1000);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int sensor_detect(int id)
|
||||
{
|
||||
static int sensor_detect(int id){
|
||||
data_type rdval;
|
||||
int eRet;
|
||||
int times_out = 3;
|
||||
do {
|
||||
eRet = sensor_read(id, ID_REG_HIGH, &rdval);
|
||||
sensor_dbg("eRet:%d, ID_VAL_HIGH:0x%x, times_out:%d\n", eRet, rdval, times_out);
|
||||
hal_usleep(200);
|
||||
times_out--;
|
||||
} while (eRet < 0 && times_out > 0);
|
||||
|
||||
sensor_read(id, ID_REG_HIGH, &rdval);
|
||||
sensor_dbg("ID_VAL_HIGH = %2x, Done!\n", rdval);
|
||||
if (rdval != ID_VAL_HIGH)
|
||||
sensor_print("ID_VAL_HIGH = %2x, Done!\n", rdval);
|
||||
|
||||
if(rdval != ID_VAL_HIGH)
|
||||
return -ENODEV;
|
||||
|
||||
sensor_read(id, ID_REG_LOW, &rdval);
|
||||
sensor_dbg("ID_VAL_LOW = %2x, Done!\n", rdval);
|
||||
if (rdval != ID_VAL_LOW)
|
||||
sensor_print("ID_VAL_LOW = %2x, Done!\n", rdval);
|
||||
if(rdval != ID_VAL_LOW)
|
||||
return -ENODEV;
|
||||
|
||||
sensor_dbg("Done!\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -552,10 +416,8 @@ static int sensor_init(int id)
|
|||
int ret;
|
||||
|
||||
sensor_dbg("sensor_init\n");
|
||||
|
||||
/*Make sure it is a target sensor */
|
||||
ret = sensor_detect(id);
|
||||
if (ret) {
|
||||
if(ret) {
|
||||
sensor_err("chip found is not an target chip.\n");
|
||||
return ret;
|
||||
}
|
||||
|
@ -567,53 +429,29 @@ static int sensor_init(int id)
|
|||
* Store information about the video data format.
|
||||
*/
|
||||
static struct sensor_format_struct sensor_formats[] = {
|
||||
#if defined CONFIG_ISP_READ_THRESHOLD || defined CONFIG_ISP_ONLY_HARD_LIGHTADC // FULL_SIZE
|
||||
#if SENSOR_30FPS
|
||||
|
||||
{
|
||||
.mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10,//MEDIA_BUS_FMT_SRGGB10_1X10, /*.mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10, */
|
||||
.width = 1600,
|
||||
.height = 1200,
|
||||
.hoffset = 0,
|
||||
.voffset = 0,
|
||||
.hts = 1920,
|
||||
.vts = 1250,
|
||||
.pclk = 72000000,
|
||||
.mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10, /*.mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10, */
|
||||
.width = 1600,
|
||||
.height = 1200,//1080,
|
||||
.hoffset = 0,
|
||||
.voffset = 0,
|
||||
.hts = 2200,
|
||||
.vts = 1250,
|
||||
.pclk = 74250000,
|
||||
.mipi_bps = 371250000,
|
||||
.fps_fixed = 30,
|
||||
.bin_factor = 1,
|
||||
.intg_min = 1 << 4,
|
||||
.intg_max = (1250 - 8) << 4,
|
||||
.intg_max = 1250 << 4,
|
||||
.gain_min = 1 << 4,
|
||||
.gain_max = 64 << 4,
|
||||
.gain_max = 128 << 4,
|
||||
.offs_h = 0,
|
||||
.offs_v = 0,
|
||||
.regs = sensor_1600x1200_30_regs,
|
||||
.regs_size = ARRAY_SIZE(sensor_1600x1200_30_regs),
|
||||
}
|
||||
#endif
|
||||
#else //CONFIG_ISP_FAST_CONVERGENCE || CONFIG_ISP_HARD_LIGHTADC
|
||||
{
|
||||
.mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10,
|
||||
.width = 640,
|
||||
.height = 480,
|
||||
.hoffset = 0,
|
||||
.voffset = 0,
|
||||
.hts = 1696,
|
||||
.vts = 525,
|
||||
.pclk = 106848000,
|
||||
.mipi_bps = 648 * 1000 * 1000,
|
||||
.fps_fixed = 120,
|
||||
.bin_factor = 1,
|
||||
.intg_min = 1 << 4,
|
||||
.intg_max = (525 - 16) << 4,
|
||||
.gain_min = 1 << 4,
|
||||
.gain_max = 110 << 4,
|
||||
.offs_h = 0,
|
||||
.offs_v = 0,
|
||||
.regs = sensor_480p120_regs,
|
||||
.regs_size = ARRAY_SIZE(sensor_480p120_regs),
|
||||
}
|
||||
#endif
|
||||
.regs = sensor_normal_regs,
|
||||
.regs_size = ARRAY_SIZE(sensor_normal_regs),
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
static struct sensor_format_struct *sensor_get_format(int id, int isp_id)
|
||||
|
@ -679,18 +517,18 @@ static struct sensor_format_struct switch_sensor_formats[] = {
|
|||
.height = 1200,//1080,
|
||||
.hoffset = 0,
|
||||
.voffset = 0,
|
||||
.hts = 1920,
|
||||
.vts = 1250,
|
||||
.pclk = 72000000,
|
||||
.mipi_bps = 672 * 1000 * 1000,
|
||||
.hts = 2200,
|
||||
.vts = 1250,
|
||||
.pclk = 74250000,
|
||||
.mipi_bps = 371250000,
|
||||
.fps_fixed = 30,
|
||||
.bin_factor = 1,
|
||||
.intg_min = 1 << 4,
|
||||
.intg_max = (1250 - 16) << 4,
|
||||
.intg_max = 1250 << 4,
|
||||
.gain_min = 1 << 4,
|
||||
.gain_max = 110 << 4,
|
||||
.switch_regs = sensor_480p120fps_to_1600x1200_30fps,
|
||||
.switch_regs_size = ARRAY_SIZE(sensor_480p120fps_to_1600x1200_30fps),
|
||||
.gain_max = 128 << 4,
|
||||
.switch_regs = sensor_normal_regs,
|
||||
.switch_regs_size = ARRAY_SIZE(sensor_normal_regs),
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -746,12 +584,9 @@ done:
|
|||
|
||||
static int sensor_g_mbus_config(int id, struct v4l2_mbus_config *cfg, struct mbus_framefmt_res *res)
|
||||
{
|
||||
//struct sensor_info *info = to_state(sd);
|
||||
|
||||
cfg->type = V4L2_MBUS_CSI2;
|
||||
cfg->flags = 0 | V4L2_MBUS_CSI2_1_LANE | V4L2_MBUS_CSI2_CHANNEL_0;
|
||||
// res->res_time_hs = 0x11;
|
||||
res->deskew = 2;
|
||||
res->res_time_hs = 0x28;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -775,7 +610,6 @@ static int sensor_reg_init(int id, int isp_id)
|
|||
return ret;
|
||||
|
||||
sc202cs_sensor_vts = current_win[id]->vts;
|
||||
#if 0
|
||||
//#if defined CONFIG_ISP_READ_THRESHOLD || defined CONFIG_ISP_FAST_CONVERGENCE
|
||||
if (ispid == 0) {
|
||||
exp_gain.exp_val = clamp(*((unsigned int *)ISP0_NORFLASH_SAVE + 2), 16, 1125 << 4);
|
||||
|
@ -784,19 +618,10 @@ static int sensor_reg_init(int id, int isp_id)
|
|||
exp_gain.exp_val = clamp(*((unsigned int *)ISP1_NORFLASH_SAVE + 2), 16, 1125 << 4);
|
||||
exp_gain.gain_val = clamp(*((unsigned int *)ISP1_NORFLASH_SAVE + 1), 16, 110 << 4);
|
||||
}
|
||||
#if defined CONFIG_ISP_FAST_CONVERGENCE || defined CONFIG_ISP_HARD_LIGHTADC
|
||||
temperature_ctrl = 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
exp_gain.exp_val = 0xff0302;
|
||||
exp_gain.gain_val = 0xff24;
|
||||
sensor_s_exp_gain(id, &exp_gain);
|
||||
// sensor_write(id, 0x3e, 0x91);
|
||||
//#else //CONFIG_ISP_HARD_LIGHTADC
|
||||
|
||||
//#endif
|
||||
//sensor_flip_status = 0x0;
|
||||
sc202cs_sensor_vts = current_win[id]->vts;
|
||||
//sensor_dbg("sc202cs_sensor_vts = %d\n", sc202cs_sensor_vts);
|
||||
|
||||
return 0;
|
||||
|
@ -804,12 +629,13 @@ exp_gain.gain_val = 0xff24;
|
|||
|
||||
static int sensor_s_stream(int id, int isp_id, int enable)
|
||||
{
|
||||
sensor_dbg("step sensor_s_stream\n");
|
||||
if (enable && sensor_stream_count[id]++ > 0)
|
||||
return 0;
|
||||
else if (!enable && (sensor_stream_count[id] == 0 || --sensor_stream_count[id] > 0))
|
||||
return 0;
|
||||
|
||||
sensor_dbg("%s on = %d, 2560*1440 fps: 15\n", __func__, enable);
|
||||
sensor_dbg("%s on = %d, 1600*1200 fps: 15\n", __func__, enable);
|
||||
|
||||
if (!enable)
|
||||
return 0;
|
||||
|
@ -823,7 +649,7 @@ static int sensor_s_switch(int id)
|
|||
struct sensor_exp_gain exp_gain;
|
||||
int ret = -1;
|
||||
temperature_ctrl = 1;
|
||||
sc202cs_sensor_vts = current_switch_win[id]->vts;
|
||||
bf2257cs_sensor_vts = current_switch_win[id]->vts;
|
||||
if (current_switch_win[id]->switch_regs)
|
||||
ret = sensor_write_array(id, current_switch_win[id]->switch_regs, current_switch_win[id]->switch_regs_size);
|
||||
else
|
||||
|
|
|
@ -69,7 +69,8 @@ struct sensor_cfg_array sensor_array[] = {
|
|||
{"gc2083_mipi", &gc2083_core},
|
||||
#endif
|
||||
#ifdef CONFIG_SENSOR_SC202CS_MIPI
|
||||
{"sc202cs_mipi", &sc202cs_core},
|
||||
{"sc202csr_mipi", &sc202cs_core},
|
||||
{"sc202csi_mipi", &sc202cs_core},
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -159,15 +159,15 @@ struct vin_mclk_info vind_default_mclk[VIN_MAX_CCI] = {
|
|||
.mclk = HAL_CLK_PERIPH_CSI_MASTER0,
|
||||
.clk_24m = HAL_CLK_SRC_HOSC,
|
||||
.clk_pll = HAL_CLK_PLL_CSI,
|
||||
.pin = GPIOE(12),
|
||||
.pin_func = {0x5, 0xf},
|
||||
.pin = GPIOA(10),
|
||||
.pin_func = {0x4, 0xf},
|
||||
},
|
||||
{
|
||||
.mclk = HAL_CLK_PERIPH_CSI_MASTER1,
|
||||
.clk_24m = HAL_CLK_SRC_HOSC,
|
||||
.clk_pll = HAL_CLK_PLL_CSI,
|
||||
.pin = GPIOE(13),
|
||||
.pin_func = {0x5, 0xf},
|
||||
.pin = GPIOA(13),
|
||||
.pin_func = {0x4, 0xf},
|
||||
},
|
||||
{
|
||||
.mclk = HAL_CLK_PERIPH_CSI_MASTER1,
|
||||
|
@ -226,21 +226,6 @@ struct sensor_list global_sensors[VIN_MAX_CSI] = {
|
|||
.ir_cut_gpio[0] = GPIOD(18), /*-cut*/
|
||||
.ir_cut_gpio[1] = GPIOD(8), /*+cut*/
|
||||
.ir_led_gpio = 0xffff, //GPIOE(10)
|
||||
#elif defined(CONFIG_SENSOR_SC202CS_MIPI)
|
||||
.used = 1,
|
||||
.sensor_name = "sc202cs_mipi",
|
||||
.sensor_twi_addr = 0x20,
|
||||
.sensor_twi_id = 0,
|
||||
.mclk_id = 1,
|
||||
.use_isp = 1,
|
||||
.id = 0,
|
||||
.addr_width = 16,
|
||||
.data_width = 8,
|
||||
.reset_gpio = GPIOE(10),
|
||||
.pwdn_gpio = 0xffff,
|
||||
.ir_cut_gpio[0] = 0xffff,/*-cut*/
|
||||
.ir_cut_gpio[1] = 0xffff,/*+cut*/
|
||||
.ir_led_gpio = 0xffff,
|
||||
#else //CONFIG_SENSOR_GC2053_MIPI
|
||||
.used = 1,
|
||||
.sensor_name = "gc2083_mipi",
|
||||
|
@ -448,7 +433,7 @@ struct vin_mclk_info vind_default_mclk[VIN_MAX_CCI] = {
|
|||
struct sensor_list global_sensors[VIN_MAX_CSI] = {
|
||||
/*mipi0 parser0*/
|
||||
[0] = {
|
||||
#if defined(CONFIG_SENSOR_BF2257CS_MIPI)
|
||||
#ifdef CONFIG_SENSOR_BF2257CS_MIPI
|
||||
.used = 1,
|
||||
.sensor_name = "bf2257cs_mipi",
|
||||
.sensor_twi_addr = 0x7C,
|
||||
|
@ -463,71 +448,59 @@ struct sensor_list global_sensors[VIN_MAX_CSI] = {
|
|||
.ir_cut_gpio[0] = 0xffff,/*-cut*/
|
||||
.ir_cut_gpio[1] = 0xffff,/*+cut*/
|
||||
.ir_led_gpio = 0xffff,
|
||||
#elif defined(CONFIG_SENSOR_GC2083_MIPI)
|
||||
/*
|
||||
#elif defined(CONFIG_SENSOR_OV02B10_MIPI)
|
||||
.used = 1,
|
||||
.sensor_name = "gc2083_mipi",
|
||||
.sensor_twi_addr = 0x6e,
|
||||
.sensor_twi_id = 0,
|
||||
.sensor_name = "ov02b10_mipi",
|
||||
.sensor_twi_addr = 0x7C,
|
||||
.sensor_twi_id = 1,
|
||||
.mclk_id = 0,
|
||||
.use_isp = 1,
|
||||
.id = 0,
|
||||
.addr_width = 16,
|
||||
.addr_width = 8,
|
||||
.data_width = 8,
|
||||
.reset_gpio = GPIOF(5),
|
||||
.reset_gpio = GPIOE(7),
|
||||
.pwdn_gpio = GPIOE(8),
|
||||
.ir_cut_gpio[0] = GPIOF(1),/*-cut*/
|
||||
.ir_cut_gpio[1] = GPIOF(2),/*+cut*/
|
||||
.ir_led_gpio = 0xffff,
|
||||
// #elif defined(CONFIG_SENSOR_OV02B10_MIPI)
|
||||
// .used = 1,
|
||||
// .sensor_name = "ov02b10_mipi",
|
||||
// .sensor_twi_addr = 0x78,
|
||||
// .sensor_twi_id = 1,
|
||||
// .mclk_id = 0,
|
||||
// .use_isp = 1,
|
||||
// .id = 0,
|
||||
// .addr_width = 8,
|
||||
// .data_width = 8,
|
||||
// .reset_gpio = GPIOE(7),
|
||||
// .pwdn_gpio = GPIOE(8),
|
||||
// .ir_cut_gpio[0] = 0xffff,/*-cut*/
|
||||
// .ir_cut_gpio[1] = 0xffff,/*+cut*/
|
||||
// .ir_led_gpio = GPIOF(3),
|
||||
#elif defined(CONFIG_SENSOR_SC202CS_MIPI)
|
||||
.ir_cut_gpio[0] = 0xffff,
|
||||
.ir_cut_gpio[1] = 0xffff,
|
||||
.ir_led_gpio = 0xffff,
|
||||
|
||||
#elif defined(CONFIG_SENSOR_SC202CS_MIPI)
|
||||
.used = 1,
|
||||
.sensor_name = "sc202cs_mipi",
|
||||
.sensor_twi_addr = 0x20,
|
||||
.sensor_twi_id = 0,
|
||||
.mclk_id = 1,
|
||||
.use_isp = 1,
|
||||
.id = 0,
|
||||
.addr_width = 16,
|
||||
.data_width = 8,
|
||||
.reset_gpio = GPIOE(10),
|
||||
.pwdn_gpio = 0xffff,
|
||||
.ir_cut_gpio[0] = 0xffff,/*-cut*/
|
||||
.ir_cut_gpio[1] = 0xffff,/*+cut*/
|
||||
.ir_led_gpio = 0xffff,
|
||||
#else
|
||||
.used = 1,
|
||||
.sensor_name = "gc2083_mipi",
|
||||
.sensor_twi_addr = 0x6e,
|
||||
.sensor_twi_id = 0,
|
||||
.sensor_twi_addr = 0x7C,
|
||||
.sensor_twi_id = 1,
|
||||
.mclk_id = 0,
|
||||
.use_isp = 1,
|
||||
.id = 0,
|
||||
.addr_width = 16,
|
||||
.data_width = 8,
|
||||
.reset_gpio = GPIOF(5),
|
||||
.reset_gpio = GPIOE(7),
|
||||
.pwdn_gpio = GPIOE(8),
|
||||
.ir_cut_gpio[0] = GPIOF(1),/*-cut*/
|
||||
.ir_cut_gpio[1] = GPIOF(2),/*+cut*/
|
||||
.ir_cut_gpio[0] = GPIOD(5),
|
||||
.ir_cut_gpio[1] = 0xffff,
|
||||
.ir_led_gpio = 0xffff,
|
||||
*/
|
||||
#else
|
||||
.used = 1,
|
||||
.sensor_name = "gc2053_mipi",
|
||||
.sensor_twi_addr = 0x6e,
|
||||
.sensor_twi_id = 1,
|
||||
.mclk_id = 0,
|
||||
.use_isp = 1,
|
||||
.id = 0,
|
||||
.addr_width = 8,
|
||||
.data_width = 8,
|
||||
.reset_gpio = GPIOE(6),
|
||||
.pwdn_gpio = GPIOE(7),
|
||||
.ir_cut_gpio[0] = 0xffff,/*-cut*/
|
||||
.ir_cut_gpio[1] = 0xffff,/*+cut*/
|
||||
.ir_led_gpio = 0xffff,
|
||||
#endif
|
||||
},
|
||||
/*mipi1 parser1*/
|
||||
[1] = {
|
||||
#if defined(CONFIG_SENSOR_BF2257CS_MIPI)
|
||||
#ifdef CONFIG_SENSOR_BF2257CS_MIPI
|
||||
.used = 1,
|
||||
.sensor_name = "bf2257cs_mipi_2",
|
||||
.sensor_twi_addr = 0xdc,
|
||||
|
@ -542,39 +515,41 @@ struct sensor_list global_sensors[VIN_MAX_CSI] = {
|
|||
.ir_cut_gpio[0] = 0xffff,/*-cut*/
|
||||
.ir_cut_gpio[1] = 0xffff,/*+cut*/
|
||||
.ir_led_gpio = 0xffff,
|
||||
#elif defined(CONFIG_SENSOR_OV02B10_MIPI)
|
||||
#elif defined(CONFIG_SENSOR_OV02B10_MIPI)
|
||||
.used = 1,
|
||||
.sensor_name = "ov02b10_mipi",
|
||||
.sensor_twi_addr = 0x78,
|
||||
.sensor_twi_addr = 0x7C,
|
||||
.sensor_twi_id = 1,
|
||||
.mclk_id = 1,
|
||||
.use_isp = 1,
|
||||
.id = 1,
|
||||
.addr_width = 8,
|
||||
.data_width = 8,
|
||||
.reset_gpio = GPIOE(6),
|
||||
.pwdn_gpio = GPIOE(9),
|
||||
.ir_cut_gpio[0] = 0xffff,/*-cut*/
|
||||
.reset_gpio = GPIOE(7),
|
||||
.pwdn_gpio = GPIOE(8),
|
||||
.ir_cut_gpio[0] = GPIOD(5),
|
||||
.ir_cut_gpio[1] = 0xffff,/*+cut*/
|
||||
.ir_led_gpio = 0xffff,
|
||||
#elif defined(CONFIG_SENSOR_SC202CS_MIPI)
|
||||
.ir_led_gpio = 0xffff,
|
||||
/*
|
||||
#elif defined(CONFIG_SENSOR_SC202CS_MIPI)
|
||||
.used = 1,
|
||||
.sensor_name = "sc202cs_mipi_2",
|
||||
.sensor_twi_addr = 0x6c,
|
||||
.sensor_twi_id = 0,
|
||||
.sensor_name = "sc202cs_mipi",
|
||||
.sensor_twi_addr = 0x7C,
|
||||
.sensor_twi_id = 1,
|
||||
.mclk_id = 1,
|
||||
.use_isp = 1,
|
||||
.id = 1,
|
||||
.addr_width = 16,
|
||||
.addr_width = 8,
|
||||
.data_width = 8,
|
||||
.reset_gpio = GPIOE(11),
|
||||
.pwdn_gpio = 0xffff,
|
||||
.ir_cut_gpio[0] = 0xffff,/*-cut*/
|
||||
.ir_cut_gpio[1] = 0xffff,/*+cut*/
|
||||
.ir_led_gpio = 0xffff,
|
||||
.reset_gpio = GPIOE(7),
|
||||
.pwdn_gpio = GPIOE(8),
|
||||
.ir_cut_gpio[0] = 0xffff,
|
||||
.ir_cut_gpio[1] = 0xffff,
|
||||
.ir_led_gpio = 0xffff,
|
||||
*/
|
||||
#else
|
||||
.used = 1,
|
||||
.sensor_name = "gc2083_mipi",
|
||||
.sensor_name = "gc2053_mipi_2",
|
||||
.sensor_twi_addr = 0x6e,
|
||||
.sensor_twi_id = 0,
|
||||
.mclk_id = 1,
|
||||
|
@ -604,8 +579,8 @@ struct vin_core global_video[VIN_MAX_VIDEO] = {
|
|||
.isp_tx_ch = 0,
|
||||
.base = CSI_DMA0_REG_BASE,
|
||||
.irq = SUNXI_IRQ_CSIC_DMA0,
|
||||
.o_width = 1600,
|
||||
.o_height = 1200,
|
||||
.o_width = 512,
|
||||
.o_height = 288,
|
||||
//.fourcc = V4L2_PIX_FMT_LBC_2_5X,
|
||||
.fourcc = V4L2_PIX_FMT_NV12,
|
||||
.use_sensor_list = 0,
|
||||
|
@ -614,7 +589,7 @@ struct vin_core global_video[VIN_MAX_VIDEO] = {
|
|||
.used = 1,
|
||||
.id = 1,
|
||||
.rear_sensor = 1,
|
||||
.front_sensor = 1,
|
||||
.front_sensor = 0,
|
||||
.csi_sel = 1,
|
||||
.mipi_sel = 1,
|
||||
.isp_sel = 1,
|
||||
|
@ -622,8 +597,8 @@ struct vin_core global_video[VIN_MAX_VIDEO] = {
|
|||
.isp_tx_ch = 0,
|
||||
.base = CSI_DMA0_REG_BASE,
|
||||
.irq = SUNXI_IRQ_CSIC_DMA0,
|
||||
.o_width = 1600,
|
||||
.o_height = 1200,
|
||||
.o_width = 512,
|
||||
.o_height = 288,
|
||||
//.fourcc = V4L2_PIX_FMT_LBC_2_5X,
|
||||
.fourcc = V4L2_PIX_FMT_NV12,
|
||||
.use_sensor_list = 0,
|
||||
|
|
|
@ -155,6 +155,33 @@ int vin_gpio_set_status(int id, enum gpio_type gpio_id, unsigned int status)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int vin_gpio_get_status(int id, enum gpio_type gpio_id)
|
||||
{
|
||||
gpio_pin_t gpio;
|
||||
int ret;
|
||||
gpio_direction_t direction;
|
||||
|
||||
if (gpio_id == PWDN)
|
||||
gpio = global_sensors[id].pwdn_gpio;
|
||||
else if (gpio_id == RESET)
|
||||
gpio = global_sensors[id].reset_gpio;
|
||||
else if (gpio_id == IR_CUT0)
|
||||
gpio = global_sensors[id].ir_cut_gpio[0];
|
||||
else if (gpio_id == IR_CUT1)
|
||||
gpio = global_sensors[id].ir_cut_gpio[1];
|
||||
else if (gpio_id == IR_LED)
|
||||
gpio = global_sensors[id].ir_led_gpio;
|
||||
else
|
||||
return -1;
|
||||
|
||||
if (gpio == 0xffff)
|
||||
return -1;
|
||||
|
||||
ret = hal_gpio_get_direction(gpio, &direction);
|
||||
vin_warn("%s(),l:%d, direction:%d\n", __func__, __LINE__, direction);
|
||||
return (int)direction;
|
||||
}
|
||||
|
||||
int vin_gpio_write(int id, enum gpio_type gpio_id, unsigned int out_value)
|
||||
{
|
||||
gpio_pin_t gpio;
|
||||
|
@ -185,6 +212,32 @@ int vin_gpio_write(int id, enum gpio_type gpio_id, unsigned int out_value)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int vin_gpio_read(int id, enum gpio_type gpio_id)
|
||||
{
|
||||
gpio_pin_t gpio;
|
||||
int ret, data;
|
||||
|
||||
if (gpio_id == PWDN)
|
||||
gpio = global_sensors[id].pwdn_gpio;
|
||||
else if (gpio_id == RESET)
|
||||
gpio = global_sensors[id].reset_gpio;
|
||||
else if (gpio_id == IR_CUT0)
|
||||
gpio = global_sensors[id].ir_cut_gpio[0];
|
||||
else if (gpio_id == IR_CUT1)
|
||||
gpio = global_sensors[id].ir_cut_gpio[1];
|
||||
else if (gpio_id == IR_LED)
|
||||
gpio = global_sensors[id].ir_led_gpio;
|
||||
else
|
||||
return -1;
|
||||
|
||||
if (gpio == 0xffff)
|
||||
return -1;
|
||||
|
||||
ret = hal_gpio_get_data(gpio, &data);
|
||||
vin_warn("%s(),l:%d, data:%d\n", __func__, __LINE__, data);
|
||||
return data;
|
||||
}
|
||||
|
||||
int vin_set_mclk_freq(int id, unsigned long freq)
|
||||
{
|
||||
hal_clk_t mclk_src = 0;
|
||||
|
|
|
@ -45,6 +45,8 @@ int sunxi_twi_exit(int id);
|
|||
|
||||
int vin_gpio_set_status(int id, enum gpio_type gpio_id, unsigned int status);
|
||||
int vin_gpio_write(int id, enum gpio_type gpio_id, unsigned int out_value);
|
||||
int vin_gpio_get_status(int id, enum gpio_type gpio_id);
|
||||
int vin_gpio_read(int id, enum gpio_type gpio_id);
|
||||
int vin_set_mclk_freq(int id, unsigned long freq);
|
||||
int vin_set_mclk(int id, unsigned int on_off);
|
||||
|
||||
|
|
|
@ -558,7 +558,44 @@ static int vin_g_config(void)
|
|||
global_video[i].used = ivalue;
|
||||
if(1 != ivalue)
|
||||
continue;
|
||||
|
||||
#if (CONFIG_ISP_NUMBER == 2)
|
||||
//sensor_name
|
||||
char sensor_name[100];
|
||||
memset(sensor_name, 0, sizeof(sensor_name));
|
||||
memset(sub_name, 0, sizeof(sub_name));
|
||||
sprintf(sub_name, "name%d", i);
|
||||
ret = Hal_Cfg_GetSubKeyValue(main_name, sub_name, (void*)sensor_name, DATA_TYPE_STRING);
|
||||
if(0 != ret) {
|
||||
vin_err("%s %s: %s\n", main_name, sub_name, sensor_name);
|
||||
//break;
|
||||
}else{
|
||||
memset(global_sensors[i].sensor_name, 0, sizeof(global_sensors[i].sensor_name));
|
||||
sprintf(global_sensors[i].sensor_name, "%s", sensor_name);
|
||||
}
|
||||
//addr_width
|
||||
int addr_width = 0;
|
||||
memset(sub_name, 0, sizeof(sub_name));
|
||||
sprintf(sub_name, "addr_width%d", i);
|
||||
ret = Hal_Cfg_GetSubKeyValue(main_name, sub_name, (void*)&addr_width, DATA_TYPE_SINGLE_WORD);
|
||||
if(0 != ret) {
|
||||
vin_err("%s %s: 0x%x\n", main_name, sub_name, addr_width);
|
||||
//break;
|
||||
}else{
|
||||
global_sensors[i].addr_width = addr_width;
|
||||
}
|
||||
|
||||
//data_width
|
||||
int data_width = 0;
|
||||
memset(sub_name, 0, sizeof(sub_name));
|
||||
sprintf(sub_name, "data_width%d", i);
|
||||
ret = Hal_Cfg_GetSubKeyValue(main_name, sub_name, (void*)&data_width, DATA_TYPE_SINGLE_WORD);
|
||||
if(0 != ret) {
|
||||
vin_err("%s %s: 0x%x\n", main_name, sub_name, data_width);
|
||||
//break;
|
||||
}else{
|
||||
global_sensors[i].data_width = data_width;
|
||||
}
|
||||
#endif
|
||||
sprintf(sub_name, "reset%d", i);
|
||||
ret = Hal_Cfg_GetSubKeyValue(main_name, sub_name, (void*)&gpio_cfg, 4);
|
||||
if(0 != ret) {
|
||||
|
@ -582,6 +619,34 @@ static int vin_g_config(void)
|
|||
vind_default_mclk[i].pin = (gpio_cfg.port - 1) * 32 + gpio_cfg.port_num;
|
||||
vind_default_mclk[i].pin_func[0] = gpio_cfg.mul_sel;
|
||||
vind_default_mclk[i].pin_func[1] = 0xf;
|
||||
#if (CONFIG_ISP_NUMBER == 2)
|
||||
sprintf(sub_name, "twi_id%d", i);
|
||||
ret = Hal_Cfg_GetSubKeyValue(main_name, sub_name, (void*)&ivalue, 1);
|
||||
if(0 == ret) {
|
||||
vin_err("%s is %d ok, default:%d\n", sub_name, ivalue, global_sensors[i].sensor_twi_id);
|
||||
global_sensors[i].sensor_twi_id = ivalue;
|
||||
}else{
|
||||
vin_err("%s is %d faill, default:%d\n", sub_name, ivalue, global_sensors[i].sensor_twi_id);
|
||||
}
|
||||
|
||||
sprintf(sub_name, "twi_addr%d", i);
|
||||
ret = Hal_Cfg_GetSubKeyValue(main_name, sub_name, (void*)&ivalue, 1);
|
||||
if(0 == ret) {
|
||||
vin_err("%s is %d ok, default:0x%x\n", sub_name, ivalue, global_sensors[i].sensor_twi_addr);
|
||||
global_sensors[i].sensor_twi_addr = ivalue;
|
||||
}else{
|
||||
vin_err("%s is %d faill, default:0x%x\n", sub_name, ivalue, global_sensors[i].sensor_twi_addr);
|
||||
}
|
||||
|
||||
sprintf(sub_name, "mclk_id%d", i);
|
||||
ret = Hal_Cfg_GetSubKeyValue(main_name, sub_name, (void*)&ivalue, 1);
|
||||
if(0 == ret) {
|
||||
vin_err("%s is %d ok, default:0x%x\n", sub_name, ivalue, global_sensors[i].mclk_id);
|
||||
global_sensors[i].mclk_id = ivalue;
|
||||
}else{
|
||||
vin_err("%s is %d faill, default:0x%x\n", sub_name, ivalue, global_sensors[i].mclk_id);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#else
|
||||
// #define MEMRESERVE 0x5f700000
|
||||
#define MEMRESERVE 0x43200000
|
||||
#define MEMRESERVE_SIZE (0x1400000 - 0x2000) //0x2000 reserved for boot0 read flash and write to it
|
||||
#define MEMRESERVE_SIZE (0xa00000 - 0x2000) //0x2000 reserved for boot0 read flash and write to it
|
||||
#endif
|
||||
extern struct rt_memheap isp_mempool;
|
||||
|
||||
|
|
|
@ -115,12 +115,12 @@
|
|||
// #include "SENSOR_H/gc2083_mipi_2_isp600_20230913_015805_gj_ir.h"
|
||||
// #include "SENSOR_H/gc2083_mipi_isp600_20241112_color.h"
|
||||
// #include "SENSOR_H/gc2083_mipi_isp600_20250106_color.h"
|
||||
#include "SENSOR_H/gc2083_mipi_isp600_20250218_104237.h"
|
||||
#include "SENSOR_H/gc2083_mipi_isp600_20250116_color.h"
|
||||
#include "SENSOR_H/gc2083_mipi_isp600_20240911_ir.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SENSOR_SC2356_MIPI
|
||||
#include "SENSOR_H/sc2356_mipi_isp600_ir_20250221_141621.h"
|
||||
#include "SENSOR_H/sc2365_mipi_isp600_20250107_100622.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SENSOR_SC202CS_MIPI
|
||||
|
@ -209,20 +209,20 @@ struct isp_cfg_array cfg_arr[] = {
|
|||
// {"gc2083_mipi", "gc2083_mipi_2_isp600_20230913_015805_gj_ir", 1920, 1088, 15, 0, 1, &gc2083_mipi_ir_isp_cfg},
|
||||
// {"gc2083_mipi", "gc2083_mipi_isp600_20241112_color", 1920, 1088, 15, 0, 0, &gc2083_mipi_isp_cfg},
|
||||
// {"gc2083_mipi", "gc2083_mipi_isp600_20250106_color", 1920, 1088, 15, 0, 0, &gc2083_mipi_isp_cfg},
|
||||
{"gc2083_mipi", "gc2083_mipi_isp600_20250218_104237", 1920, 1088, 15, 0, 0, &gc2083_mipi_isp_cfg},
|
||||
{"gc2083_mipi", "gc2083_mipi_isp600_20250116_color", 1920, 1088, 15, 0, 0, &gc2083_mipi_isp_cfg},
|
||||
{"gc2083_mipi", "gc2083_mipi_isp600_20240911_ir", 1920, 1088, 15, 0, 1, &gc2083_mipi_ir_isp_cfg},
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SENSOR_SC2356_MIPI
|
||||
{"sc2356_mipi", "sc2356_mipi_isp600_ir_20250221_141621", 1600, 1200, 15, 0, 0, &sc2356_mipi_isp_cfg},
|
||||
{"sc2356_mipi", "sc2356_mipi_isp600_ir_20250221_141621", 1600, 1200, 15, 1, 0, &sc2356_mipi_isp_cfg},
|
||||
{"sc2356_mipi", "sc2365_mipi_isp600_20250107_100622", 1600, 1200, 15, 0, 0, &sc2356_mipi_isp_cfg},
|
||||
{"sc2356_mipi", "sc2365_mipi_isp600_20250107_100622", 1600, 1200, 15, 1, 0, &sc2356_mipi_isp_cfg},
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SENSOR_SC202CS_MIPI
|
||||
{"sc202cs_mipi", "sc202cs_mipi_isp600_rgb_20250304_100237", 1600, 1200, 30, 0, 0, &sc202cs_mipi_rgb_isp_cfg},
|
||||
{"sc202cs_mipi", "sc202cs_mipi_isp600_rgb_20250304_100237", 1600, 1200, 30, 1, 0, &sc202cs_mipi_rgb_isp_cfg},
|
||||
{"sc202ms_mipi", "sc202cs_mipi_isp600_ir_20250221_141621", 1600, 1200, 30, 0, 0, &sc202cs_mipi_ir_isp_cfg},
|
||||
{"sc202ms_mipi", "sc202cs_mipi_isp600_ir_20250221_141621", 1600, 1200, 30, 1, 0, &sc202cs_mipi_ir_isp_cfg},
|
||||
{"sc202csr_mipi", "sc202cs_mipi_isp600_rgb_20250304_100237", 1600, 1200, 30, 0, 0, &sc202cs_mipi_rgb_isp_cfg},
|
||||
{"sc202csr_mipi", "sc202cs_mipi_isp600_rgb_20250304_100237", 1600, 1200, 30, 1, 0, &sc202cs_mipi_rgb_isp_cfg},
|
||||
{"sc202csi_mipi", "sc202cs_mipi_isp600_ir_20250221_141621", 1600, 1200, 30, 0, 0, &sc202cs_mipi_ir_isp_cfg},
|
||||
{"sc202csi_mipi", "sc202cs_mipi_isp600_ir_20250221_141621", 1600, 1200, 30, 1, 0, &sc202cs_mipi_ir_isp_cfg},
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SENSOR_GC1084_MIPI
|
||||
|
|
|
@ -13,7 +13,7 @@ export HOME=${HOME:-/root}
|
|||
export PS1='\u@\h:\w\$ '
|
||||
export LD_LIBRARY_PATH=/usr/lib/eyesee-mpp:${LD_LIBRARY_PATH}
|
||||
ulimit -c unlimited
|
||||
#mount -t debugfs none /sys/kernel/debug
|
||||
mount -t debugfs none /sys/kernel/debug
|
||||
|
||||
[ -x /bin/more ] || alias more=less
|
||||
[ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi
|
||||
|
|
|
@ -145,7 +145,7 @@ CONFIG_KERNEL_BUILD_USER=""
|
|||
CONFIG_KERNEL_BUILD_DOMAIN=""
|
||||
CONFIG_KERNEL_PRINTK=y
|
||||
# CONFIG_KERNEL_SWAP is not set
|
||||
# CONFIG_KERNEL_DEBUG_FS is not set
|
||||
CONFIG_KERNEL_DEBUG_FS=y
|
||||
# CONFIG_KERNEL_HW_PERF_EVENTS is not set
|
||||
# CONFIG_KERNEL_PERF_EVENTS is not set
|
||||
# CONFIG_KERNEL_FRAME_POINTER is not set
|
||||
|
|
Loading…
Reference in New Issue