add(media): add mipi switch and sensor sc202cs. [MIPI_SWITCH][CAMERA_V1.2]
This commit is contained in:
parent
fb4f7b3baf
commit
a2ba6d78f2
|
@ -42,15 +42,15 @@
|
|||
|
||||
reserved-memory {
|
||||
e907_fw: e907_fw {
|
||||
reg = <0x0 0x43080000 0x0 0x00180000>;
|
||||
reg = <0x0 0x43080000 0x0 0x00190000>;
|
||||
};
|
||||
|
||||
isp_reserved: isp_reserved {
|
||||
reg = <0x0 0x43200000 0x0 0x00a00000>;
|
||||
reg = <0x0 0x43210000 0x0 0x01E00000>;
|
||||
};
|
||||
|
||||
e907_dram: riscv_memserve {
|
||||
reg = <0x0 0x43c00000 0x0 0x00400000>;
|
||||
reg = <0x0 0x45010000 0x0 0x00530000>;
|
||||
no-map;
|
||||
};
|
||||
|
||||
|
@ -164,12 +164,12 @@
|
|||
status = "okay";
|
||||
ch_id = <0>;//vipp_num
|
||||
codec_type = <0>;//0//0:H264; 1:JPG; 2:H265
|
||||
res_w = <640>;
|
||||
res_h = <480>;
|
||||
res_w = <1920>;
|
||||
res_h = <1080>;
|
||||
fps = <15>;
|
||||
bit_rate = <1536>;//kb
|
||||
gop = <40>;
|
||||
vbr = <0>;//< operate venc. VBR=1, CBR=0
|
||||
vbr = <1>;//< operate venc. VBR=1, CBR=0
|
||||
init_qp = <35>;
|
||||
i_min_qp = <25>;
|
||||
i_max_qp = <45>;
|
||||
|
@ -189,12 +189,12 @@
|
|||
status = "okay";
|
||||
ch_id = <1>;//vipp_num
|
||||
codec_type = <0>;//0//0:H264; 1:JPG; 2:H265
|
||||
res_w = <640>;
|
||||
res_h = <480>;
|
||||
res_w = <1600>;
|
||||
res_h = <1200>;
|
||||
fps = <15>;
|
||||
bit_rate = <1536>;//kb
|
||||
gop = <40>;
|
||||
vbr = <0>;//< operate venc. VBR=1, CBR=0
|
||||
vbr = <1>;//< operate venc. VBR=1, CBR=0
|
||||
init_qp = <35>;
|
||||
i_min_qp = <25>;
|
||||
i_max_qp = <45>;
|
||||
|
@ -209,17 +209,17 @@
|
|||
};
|
||||
|
||||
sensor_2_venc: sensor_2_venc@2 {
|
||||
status = "disabled";
|
||||
status = "okay";
|
||||
s2vencfg0: s2vencfg0@0 {
|
||||
status = "disabled";
|
||||
status = "okay";
|
||||
ch_id = <2>;//vipp_num
|
||||
codec_type = <0>;//0//0:H264; 1:JPG; 2:H265
|
||||
res_w = <1920>;
|
||||
res_h = <1080>;
|
||||
res_w = <1600>;
|
||||
res_h = <1200>;
|
||||
fps = <15>;
|
||||
bit_rate = <1536>;//kb
|
||||
gop = <40>;
|
||||
vbr = <0>;//< operate venc. VBR=1, CBR=0
|
||||
vbr = <1>;//< operate venc. VBR=1, CBR=0
|
||||
init_qp = <35>;
|
||||
i_min_qp = <25>;
|
||||
i_max_qp = <45>;
|
||||
|
@ -266,7 +266,9 @@
|
|||
};
|
||||
|
||||
isp02:isp@2 {
|
||||
status = "disabled";
|
||||
rpbuf = <&rpbuf_controller0>;
|
||||
iommus = <&mmu_aw 4 0>;
|
||||
delay_init = <1>;
|
||||
};
|
||||
|
||||
isp03:isp@3 {
|
||||
|
@ -275,6 +277,7 @@
|
|||
|
||||
isp10:isp@4 {
|
||||
status = "disabled";
|
||||
iommus = <&mmu_aw 4 0>;
|
||||
};
|
||||
|
||||
scaler00:scaler@0 {
|
||||
|
@ -289,7 +292,8 @@
|
|||
};
|
||||
|
||||
scaler02:scaler@2 {
|
||||
status = "disabled";
|
||||
iommus = <&mmu_aw 1 0>;
|
||||
delay_init = <1>;
|
||||
};
|
||||
|
||||
scaler03:scaler@3 {
|
||||
|
@ -308,7 +312,8 @@
|
|||
};
|
||||
|
||||
scaler12:scaler@6 {
|
||||
status = "disabled";
|
||||
iommus = <&mmu_aw 1 0>;
|
||||
delay_init = <1>;
|
||||
};
|
||||
|
||||
scaler13:scaler@7 {
|
||||
|
@ -327,7 +332,8 @@
|
|||
};
|
||||
|
||||
scaler22:scaler@10 {
|
||||
status = "disabled";
|
||||
iommus = <&mmu_aw 1 0>;
|
||||
delay_init = <1>;
|
||||
};
|
||||
|
||||
scaler23:scaler@11 {
|
||||
|
@ -346,7 +352,8 @@
|
|||
};
|
||||
|
||||
scaler32:scaler@14 {
|
||||
status = "disabled";
|
||||
iommus = <&mmu_aw 1 0>;
|
||||
delay_init = <1>;
|
||||
};
|
||||
|
||||
scaler33:scaler@15 {
|
||||
|
@ -372,6 +379,12 @@
|
|||
flash0_flvdd_vol = <>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
sensor_vsync0: sensor_vsync0@0 {
|
||||
vsync_gpio = <&pio PE 11 1 0 1 0>;
|
||||
switch_gpio = <&pio PF 3 1 0 1 0>;
|
||||
};
|
||||
|
||||
/*
|
||||
sensor0:sensor@0 {
|
||||
device_type = "sensor0";
|
||||
|
@ -421,8 +434,6 @@
|
|||
/* sensor0_dvdd-supply = <®_dldo2>; */
|
||||
/* sensor0_dvdd_vol = <1200000>; */
|
||||
/* sensor0_power_en = <>; */
|
||||
/* sensor0_power_en = <&pio PF 3 1 0 1 0>; */
|
||||
/* sensor0_reset = <&pio PD 20 1 0 1 0>; */
|
||||
sensor0_pwdn = <&pio PE 8 1 0 1 0>;
|
||||
sensor0_sm_hs = <>;
|
||||
sensor0_sm_vs = <>;
|
||||
|
@ -431,12 +442,11 @@
|
|||
status = "okay";
|
||||
};
|
||||
|
||||
// right
|
||||
sensor1:sensor@1 {
|
||||
device_type = "sensor1";
|
||||
sensor1_mname = "ov02b10_mipi";
|
||||
sensor1_mname = "sc2356_mipi";
|
||||
sensor1_twi_cci_id = <1>;
|
||||
sensor1_twi_addr = <0x78>;
|
||||
sensor1_twi_addr = <0x6c>;
|
||||
sensor1_mclk_id = <1>;
|
||||
sensor1_pos = "front";
|
||||
sensor1_isp_used = <1>;
|
||||
|
@ -444,15 +454,15 @@
|
|||
sensor1_stby_mode = <0>;
|
||||
sensor1_vflip = <0>;
|
||||
sensor1_hflip = <0>;
|
||||
/* sensor1_iovdd-supply = <®_aldo2>; */
|
||||
/* sensor1_iovdd_vol = <1800000>; */
|
||||
/* sensor1_avdd-supply = <®_bldo2>; */
|
||||
/* sensor1_avdd_vol = <2800000>; */
|
||||
/* sensor1_dvdd-supply = <®_dldo2>; */
|
||||
/* sensor1_dvdd_vol = <1200000>; */
|
||||
sensor1_power_en = <&pio PF 3 1 0 1 0>;
|
||||
/* sensor0_iovdd-supply = <®_aldo2>; */
|
||||
/* sensor0_iovdd_vol = <1800000>; */
|
||||
/* sensor0_avdd-supply = <®_bldo2>; */
|
||||
/* sensor0_avdd_vol = <2800000>; */
|
||||
/* sensor0_dvdd-supply = <®_dldo2>; */
|
||||
/* sensor0_dvdd_vol = <1200000>; */
|
||||
/* sensor0_power_en = <>; */
|
||||
sensor1_reset = <&pio PE 6 1 0 1 0>;
|
||||
sensor1_pwdn = <&pio PE 9 1 0 1 0>;
|
||||
sensor1_pwdn = <&pio PE 7 1 0 1 0>;
|
||||
sensor1_sm_hs = <>;
|
||||
sensor1_sm_vs = <>;
|
||||
flash_handle = <>;
|
||||
|
@ -460,36 +470,6 @@
|
|||
status = "okay";
|
||||
};
|
||||
|
||||
// left
|
||||
// sensor1:sensor@1 {
|
||||
// device_type = "sensor1";
|
||||
// sensor1_mname = "ov02b10_mipi";
|
||||
// sensor1_twi_cci_id = <1>;
|
||||
// sensor1_twi_addr = <0x7A>;
|
||||
// sensor1_mclk_id = <1>;
|
||||
// sensor1_pos = "front";
|
||||
// sensor1_isp_used = <1>;
|
||||
// sensor1_fmt = <1>;
|
||||
// sensor1_stby_mode = <0>;
|
||||
// sensor1_vflip = <0>;
|
||||
// sensor1_hflip = <0>;
|
||||
// /* sensor1_iovdd-supply = <®_aldo2>; */
|
||||
// /* sensor1_iovdd_vol = <1800000>; */
|
||||
// /* sensor1_avdd-supply = <®_bldo2>; */
|
||||
// /* sensor1_avdd_vol = <2800000>; */
|
||||
// /* sensor1_dvdd-supply = <®_dldo2>; */
|
||||
// /* sensor1_dvdd_vol = <1200000>; */
|
||||
// /* sensor1_power_en = <>; */
|
||||
// sensor1_power_en = <&pio PF 3 1 0 1 0>;
|
||||
// sensor1_reset = <&pio PE 7 1 0 1 0>;
|
||||
// sensor1_pwdn = <&pio PE 10 1 0 1 0>;
|
||||
// sensor1_sm_hs = <>;
|
||||
// sensor1_sm_vs = <>;
|
||||
// flash_handle = <>;
|
||||
// act_handle = <>;
|
||||
// status = "okay";
|
||||
// };
|
||||
|
||||
vinc00:vinc@0 {
|
||||
vinc0_csi_sel = <0>;
|
||||
vinc0_mipi_sel = <0>;
|
||||
|
@ -508,6 +488,7 @@
|
|||
vinc01:vinc@1 {
|
||||
vinc1_csi_sel = <1>;
|
||||
vinc1_mipi_sel = <1>;
|
||||
vinc1_csi_ch = <0x10>;
|
||||
vinc1_isp_sel = <1>;
|
||||
vinc1_isp_tx_ch = <0>;
|
||||
vinc1_tdm_rx_sel = <1>;
|
||||
|
@ -520,15 +501,18 @@
|
|||
};
|
||||
|
||||
vinc02:vinc@2 {
|
||||
vinc2_csi_sel = <2>;
|
||||
vinc2_mipi_sel = <0xff>;
|
||||
vinc2_csi_sel = <1>;
|
||||
vinc2_mipi_sel = <1>;
|
||||
vinc2_csi_ch = <0x11>;
|
||||
vinc2_isp_sel = <2>;
|
||||
vinc2_isp_tx_ch = <2>;
|
||||
vinc2_isp_tx_ch = <0>;
|
||||
vinc2_tdm_rx_sel = <2>;
|
||||
vinc2_rear_sensor_sel = <0>;
|
||||
vinc2_front_sensor_sel = <0>;
|
||||
vinc2_rear_sensor_sel = <1>;
|
||||
vinc2_front_sensor_sel = <1>;
|
||||
vinc2_sensor_list = <0>;
|
||||
status = "disabled";
|
||||
iommus = <&mmu_aw 1 0>;
|
||||
delay_init = <1>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
vinc03:vinc@3 {
|
||||
|
@ -561,6 +545,7 @@
|
|||
vinc11:vinc@5 {
|
||||
vinc5_csi_sel = <1>;
|
||||
vinc5_mipi_sel = <1>;
|
||||
vinc5_csi_ch = <0x10>;
|
||||
vinc5_isp_sel = <1>;
|
||||
vinc5_isp_tx_ch = <0>;
|
||||
vinc5_tdm_rx_sel = <1>;
|
||||
|
@ -573,15 +558,18 @@
|
|||
};
|
||||
|
||||
vinc12:vinc@6 {
|
||||
vinc6_csi_sel = <2>;
|
||||
vinc6_mipi_sel = <0xff>;
|
||||
vinc6_isp_sel = <0>;
|
||||
vinc6_csi_sel = <1>;
|
||||
vinc6_mipi_sel = <1>;
|
||||
vinc6_csi_ch = <0x11>;
|
||||
vinc6_isp_sel = <2>;
|
||||
vinc6_isp_tx_ch = <0>;
|
||||
vinc6_tdm_rx_sel = <0>;
|
||||
vinc6_rear_sensor_sel = <0>;
|
||||
vinc6_front_sensor_sel = <0>;
|
||||
vinc6_tdm_rx_sel = <2>;
|
||||
vinc6_rear_sensor_sel = <1>;
|
||||
vinc6_front_sensor_sel = <1>;
|
||||
vinc6_sensor_list = <0>;
|
||||
status = "disabled";
|
||||
iommus = <&mmu_aw 1 0>;
|
||||
delay_init = <1>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
vinc13:vinc@7 {
|
||||
|
@ -598,7 +586,7 @@
|
|||
|
||||
vinc20:vinc@8 {
|
||||
vinc8_csi_sel = <0>;
|
||||
vinc8_mipi_sel = <0x0>;
|
||||
vinc8_mipi_sel = <0>;
|
||||
vinc8_isp_sel = <0>;
|
||||
vinc8_isp_tx_ch = <0>;
|
||||
vinc8_tdm_rx_sel = <0>;
|
||||
|
@ -614,6 +602,7 @@
|
|||
vinc21:vinc@9 {
|
||||
vinc9_csi_sel = <1>;
|
||||
vinc9_mipi_sel = <1>;
|
||||
vinc9_csi_ch = <0x10>;
|
||||
vinc9_isp_sel = <1>;
|
||||
vinc9_isp_tx_ch = <0>;
|
||||
vinc9_tdm_rx_sel = <1>;
|
||||
|
@ -626,15 +615,18 @@
|
|||
};
|
||||
|
||||
vinc22:vinc@10 {
|
||||
vinc10_csi_sel = <2>;
|
||||
vinc10_mipi_sel = <0xff>;
|
||||
vinc10_isp_sel = <0>;
|
||||
vinc10_csi_sel = <1>;
|
||||
vinc10_mipi_sel = <1>;
|
||||
vinc10_csi_ch = <0x11>;
|
||||
vinc10_isp_sel = <2>;
|
||||
vinc10_isp_tx_ch = <0>;
|
||||
vinc10_tdm_rx_sel = <0>;
|
||||
vinc10_rear_sensor_sel = <0>;
|
||||
vinc10_front_sensor_sel = <0>;
|
||||
vinc10_tdm_rx_sel = <2>;
|
||||
vinc10_rear_sensor_sel = <1>;
|
||||
vinc10_front_sensor_sel = <1>;
|
||||
vinc10_sensor_list = <0>;
|
||||
status = "disabled";
|
||||
iommus = <&mmu_aw 1 0>;
|
||||
delay_init = <1>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
vinc23:vinc@11 {
|
||||
|
@ -651,7 +643,7 @@
|
|||
|
||||
vinc30:vinc@12 {
|
||||
vinc12_csi_sel = <0>;
|
||||
vinc12_mipi_sel = <0x0>;
|
||||
vinc12_mipi_sel = <0>;
|
||||
vinc12_isp_sel = <0>;
|
||||
vinc12_isp_tx_ch = <0>;
|
||||
vinc12_tdm_rx_sel = <0>;
|
||||
|
@ -667,6 +659,7 @@
|
|||
vinc31:vinc@13 {
|
||||
vinc13_csi_sel = <1>;
|
||||
vinc13_mipi_sel = <1>;
|
||||
vinc13_csi_ch = <0x10>;
|
||||
vinc13_isp_sel = <1>;
|
||||
vinc13_isp_tx_ch = <0>;
|
||||
vinc13_tdm_rx_sel = <1>;
|
||||
|
@ -679,15 +672,18 @@
|
|||
};
|
||||
|
||||
vinc32:vinc@14 {
|
||||
vinc14_csi_sel = <2>;
|
||||
vinc14_mipi_sel = <0xff>;
|
||||
vinc14_isp_sel = <0>;
|
||||
vinc14_csi_sel = <1>;
|
||||
vinc14_mipi_sel = <1>;
|
||||
vinc14_csi_ch = <0x11>;
|
||||
vinc14_isp_sel = <2>;
|
||||
vinc14_isp_tx_ch = <0>;
|
||||
vinc14_tdm_rx_sel = <0>;
|
||||
vinc14_rear_sensor_sel = <0>;
|
||||
vinc14_front_sensor_sel = <0>;
|
||||
vinc14_tdm_rx_sel = <2>;
|
||||
vinc14_rear_sensor_sel = <1>;
|
||||
vinc14_front_sensor_sel = <1>;
|
||||
vinc14_sensor_list = <0>;
|
||||
status = "disabled";
|
||||
iommus = <&mmu_aw 1 0>;
|
||||
delay_init = <1>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
vinc33:vinc@15 {
|
||||
|
@ -939,8 +935,8 @@
|
|||
};
|
||||
|
||||
mipib_pins_a: mipib@0 {
|
||||
allwinner,pins = "PA8", "PA9", "PA10", "PA11";
|
||||
allwinner,pname = "mipib_d1n", "mipib_d1p", "mipib_ck0n", "mipib_ck0p";
|
||||
allwinner,pins = "PA10", "PA11";
|
||||
allwinner,pname = "mipib_ck0n", "mipib_ck0p";
|
||||
allwinner,function = "mipib_rx";
|
||||
allwinner,muxsel = <2>;
|
||||
allwinner,drive = <1>;
|
||||
|
@ -948,14 +944,14 @@
|
|||
};
|
||||
|
||||
mipib_pins_b: mipib@1 {
|
||||
allwinner,pins = "PA8", "PA9", "PA10", "PA11";
|
||||
allwinner,pins = "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";
|
||||
|
@ -973,13 +969,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 = <1>;
|
||||
allwinner,drive = <0>;
|
||||
allwinner,pull = <1>;
|
||||
};
|
||||
|
||||
|
@ -987,7 +983,7 @@
|
|||
allwinner,pins = "PE4", "PE5";
|
||||
allwinner,function = "io_disabled";
|
||||
allwinner,muxsel = <0xf>;
|
||||
allwinner,drive = <1>;
|
||||
allwinner,drive = <0>;
|
||||
allwinner,pull = <0>;
|
||||
};
|
||||
|
||||
|
@ -996,7 +992,7 @@
|
|||
allwinner,pname = "twi1_scl", "twi1_sda";
|
||||
allwinner,function = "twi1";
|
||||
allwinner,muxsel = <8>;
|
||||
allwinner,drive = <1>;
|
||||
allwinner,drive = <0>;
|
||||
allwinner,pull = <1>;
|
||||
};
|
||||
|
||||
|
@ -1004,7 +1000,7 @@
|
|||
allwinner,pins = "PE2", "PE3";
|
||||
allwinner,function = "io_disabled";
|
||||
allwinner,muxsel = <0xf>;
|
||||
allwinner,drive = <1>;
|
||||
allwinner,drive = <0>;
|
||||
allwinner,pull = <0>;
|
||||
};
|
||||
|
||||
|
@ -1936,7 +1932,7 @@
|
|||
memory-mappings =
|
||||
/* DA len PA */
|
||||
/* DDR for e907 */
|
||||
< 0x43c00000 0x00400000 0x43c00000 >;
|
||||
< 0x45010000 0x00530000 0x45010000 >;
|
||||
|
||||
// iommus = <&mmu_aw 5 1>;
|
||||
fw-region = <&e907_fw>;
|
||||
|
|
|
@ -1737,7 +1737,7 @@ CONFIG_VIDEO_V4L2=y
|
|||
CONFIG_VIDEOBUF2_CORE=y
|
||||
CONFIG_VIDEOBUF2_MEMOPS=y
|
||||
CONFIG_VIDEOBUF2_DMA_CONTIG=y
|
||||
CONFIG_VIDEOBUF2_VMALLOC=m
|
||||
CONFIG_VIDEOBUF2_VMALLOC=y
|
||||
# CONFIG_TTPCI_EEPROM is not set
|
||||
|
||||
#
|
||||
|
@ -1759,11 +1759,11 @@ CONFIG_ENABLE_SENSOR_FLIP_OPTION=y
|
|||
# CONFIG_PIPELINE_RESET is not set
|
||||
# CONFIG_MULTI_FRAME is not set
|
||||
CONFIG_SUPPORT_ISP_TDM=y
|
||||
CONFIG_TDM_LBC_EN=y
|
||||
# CONFIG_TDM_LBC_EN is not set
|
||||
# CONFIG_TDM_ONE_BUFFER is not set
|
||||
# CONFIG_TDM_OFFLINE_HANDLE_RAW is not set
|
||||
# CONFIG_MIPI_VC is not set
|
||||
# CONFIG_AVG_TDM_FIFO is not set
|
||||
CONFIG_MIPI_VC=y
|
||||
CONFIG_AVG_TDM_FIFO=y
|
||||
# CONFIG_DISPPLAY_SYNC is not set
|
||||
CONFIG_VIN_IOMMU=y
|
||||
CONFIG_D3D=y
|
||||
|
@ -1773,7 +1773,7 @@ CONFIG_D3D_COMPRESS_EN=y
|
|||
CONFIG_FRAMEDONE_TWO_BUFFER=y
|
||||
CONFIG_ISP_SERVER_MELIS=y
|
||||
CONFIG_VIN_INIT_MELIS=y
|
||||
# CONFIG_SUPPORT_THREE_CAMERA_MELIS is not set
|
||||
CONFIG_SUPPORT_THREE_CAMERA_MELIS=y
|
||||
CONFIG_VIDEO_SUNXI_VIN_SPECIAL=y
|
||||
|
||||
#
|
||||
|
@ -1788,7 +1788,7 @@ CONFIG_VIDEO_SUNXI_VIN_SPECIAL=y
|
|||
# CONFIG_SENSOR_OV7251_MIPI is not set
|
||||
# CONFIG_SENSOR_OV2735_MIPI is not set
|
||||
# CONFIG_SENSOR_OV7750_MIPI is not set
|
||||
CONFIG_SENSOR_OV02B10_MIPI=y
|
||||
# CONFIG_SENSOR_OV02B10_MIPI is not set
|
||||
# CONFIG_SENSOR_OV5648 is not set
|
||||
# CONFIG_SENSOR_OS02G10 is not set
|
||||
# CONFIG_SENSOR_GC2145 is not set
|
||||
|
@ -1812,6 +1812,7 @@ CONFIG_SENSOR_GC2083_MIPI=y
|
|||
# CONFIG_SENSOR_SC2336_MIPI is not set
|
||||
# CONFIG_SENSOR_SC5336_MIPI is not set
|
||||
# CONFIG_SENSOR_SC2355_MIPI is not set
|
||||
CONFIG_SENSOR_SC2356_MIPI=y
|
||||
# CONFIG_SENSOR_SC031GS_MIPI is not set
|
||||
# CONFIG_SENSOR_SC500AI_MIPI is not set
|
||||
# CONFIG_SENSOR_SC530AI_MIPI is not set
|
||||
|
@ -2024,8 +2025,8 @@ CONFIG_VIDEO_KERNEL_ENC_SUNXI=y
|
|||
# CONFIG_VIDEO_GOOGLE_VP9_DECODER_SUNXI is not set
|
||||
CONFIG_VIDEO_RT_MEDIA=y
|
||||
# CONFIG_RT_MEDIA_SINGEL_SENSOR is not set
|
||||
CONFIG_RT_MEDIA_DUAL_SENSOR=y
|
||||
# CONFIG_RT_MEDIA_THREE_SENSOR is not set
|
||||
# CONFIG_RT_MEDIA_DUAL_SENSOR is not set
|
||||
CONFIG_RT_MEDIA_THREE_SENSOR=y
|
||||
CONFIG_RT_MEDIA_CDC_LOG_LEVEL=3
|
||||
# CONFIG_RT_MEDIA_SETUP_RECORDER_IN_KERNEL is not set
|
||||
# CONFIG_AW_TSC is not set
|
||||
|
|
|
@ -600,12 +600,12 @@ static void __isp_stats_process(struct hw_isp_device *isp, const void *buffer)
|
|||
exp_gain.b_gain |= (isp->id << 16);
|
||||
#if (HW_ISP_DEVICE_NUM > 1)
|
||||
/*isp0 and isp1 are opened and have same head sensor, so we only use isp0 control ae*/
|
||||
if (isp->id == 1 && media_params.isp_dev[0] != NULL && media_params.isp_dev[1] != NULL &&
|
||||
!strcmp(media_params.isp_dev[0]->sensor.info.name, media_params.isp_dev[1]->sensor.info.name)) {
|
||||
ISP_DEV_LOG(ISP_LOG_ISP, "isp0 and isp1 are opened and have same head, so we only use isp0 to do ae!\n");
|
||||
} else {
|
||||
// if (isp->id == 1 && media_params.isp_dev[0] != NULL && media_params.isp_dev[1] != NULL &&
|
||||
// !strcmp(media_params.isp_dev[0]->sensor.info.name, media_params.isp_dev[1]->sensor.info.name)) {
|
||||
// ISP_DEV_LOG(ISP_LOG_ISP, "isp0 and isp1 are opened and have same head, so we only use isp0 to do ae!\n");
|
||||
// } else {
|
||||
isp_sensor_set_exp_gain(isp, &exp_gain);
|
||||
}
|
||||
// }
|
||||
#else
|
||||
isp_sensor_set_exp_gain(isp, &exp_gain);
|
||||
#endif
|
||||
|
|
|
@ -1021,6 +1021,7 @@
|
|||
sunxi-dly-208M = <1 1 0 0 0 0>;
|
||||
/*sunxi-dly-104M-ddr = <1 0 0 0>;*/
|
||||
/*sunxi-dly-208M-ddr = <1 0 0 0>;*/
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
sdc1: sdmmc@04021000 {
|
||||
|
|
|
@ -140,6 +140,10 @@ config SENSOR_SC2355_MIPI
|
|||
tristate "use sc2355_mipi driver"
|
||||
default n
|
||||
|
||||
config SENSOR_SC2356_MIPI
|
||||
tristate "use sc2356_mipi driver"
|
||||
default n
|
||||
|
||||
config SENSOR_SC031GS_MIPI
|
||||
tristate "use sc031gs_mipi driver"
|
||||
default n
|
||||
|
|
|
@ -28,6 +28,7 @@ obj-$(CONFIG_SENSOR_GC5603_MIPI) += gc5603_mipi.o
|
|||
obj-$(CONFIG_SENSOR_GC02M1_MIPI) += gc02m1_mipi.o
|
||||
obj-$(CONFIG_SENSOR_SC2336_MIPI) += sc1346_mipi.o
|
||||
obj-$(CONFIG_SENSOR_SC2336_MIPI) += sc2336_mipi.o
|
||||
obj-$(CONFIG_SENSOR_SC2356_MIPI) += sc2356_mipi.o
|
||||
obj-$(CONFIG_SENSOR_SC2232_MIPI) += sc2232_mipi.o
|
||||
obj-$(CONFIG_SENSOR_SC5336_MIPI) += sc5336_mipi.o
|
||||
obj-$(CONFIG_SENSOR_SC2355_MIPI) += sc2355_mipi.o
|
||||
|
|
|
@ -143,6 +143,7 @@ struct sensor_info {
|
|||
unsigned int act_fps;
|
||||
void (*sensor_fps_chenge_callback)(int act_fps);
|
||||
struct sensor_vysnc_config sensor_vysnc_cfg;
|
||||
unsigned int isp_id[2];
|
||||
};
|
||||
|
||||
#endif /*__CAMERA__H__*/
|
||||
|
|
|
@ -43,6 +43,8 @@ typedef enum tag_CAMERA_IO_CMD {
|
|||
GET_SENSOR_OUTPUT_BIT_WIDTH,
|
||||
SET_SENSOR_OUTPUT_BIT_WIDTH,
|
||||
SET_SWITCH_CHANGE,
|
||||
SET_HFLIP,
|
||||
SET_VFLIP,
|
||||
} __camera_cmd_t;
|
||||
|
||||
struct sensor_exif_attribute {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2584,6 +2584,10 @@ static int __vin_s_input(struct vin_core *vinc, unsigned int i)
|
|||
vinc->exp_gain.exp_val = info->exp;
|
||||
vinc->exp_gain.gain_val = info->gain;
|
||||
vinc->stream_idx = info->stream_seq + 2;
|
||||
/*check link of isp and mipi-vc when mipi-vc enable*/
|
||||
if ((vinc->csi_ch != 0xff) && (vinc->csi_ch & 0x10)) {
|
||||
info->isp_id[vinc->csi_ch & 0xf] = vinc->isp_sel;
|
||||
}
|
||||
}
|
||||
|
||||
if (cap->pipe.sd[VIN_IND_MIPI] != NULL) {
|
||||
|
@ -4309,8 +4313,28 @@ int sensor_flip_option(struct vin_vid_cap *cap, struct v4l2_control c)
|
|||
int input_seq;
|
||||
int sensor_fmt_code;
|
||||
int ret, i;
|
||||
struct sensor_vc_flip sensor_set_flip;
|
||||
|
||||
/*It need sent isp_id to sensor when enable mipi-vc, so filp cmd
|
||||
* need to sent by v4l2_subdev_call not v4l2_s_ctrl*/
|
||||
if ((cap->vinc->csi_ch != 0xff) && (cap->vinc->csi_ch & 0x10)) {
|
||||
sensor_set_flip.isp_id = cap->vinc->isp_sel;
|
||||
sensor_set_flip.value = c.value;
|
||||
switch (c.id) {
|
||||
case V4L2_CID_VFLIP:
|
||||
ret = v4l2_subdev_call(sensor, core,
|
||||
ioctl, SET_VFLIP, &sensor_set_flip);
|
||||
break;
|
||||
case V4L2_CID_HFLIP:
|
||||
ret = v4l2_subdev_call(sensor, core,
|
||||
ioctl, SET_HFLIP, &sensor_set_flip);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/*not mipi-vc mode*/
|
||||
ret = v4l2_s_ctrl(NULL, sensor->ctrl_handler, &c);
|
||||
}
|
||||
|
||||
ret = v4l2_s_ctrl(NULL, sensor->ctrl_handler, &c);
|
||||
ret = v4l2_subdev_call(sensor, core, ioctl, VIDIOC_VIN_GET_SENSOR_CODE, &sensor_fmt_code);
|
||||
if (ret < 0) {
|
||||
vin_err("get sensor mbus code fail");
|
||||
|
|
|
@ -1029,8 +1029,9 @@ static int __vin_pipeline_s_stream(struct vin_pipeline *p, int on_idx)
|
|||
else
|
||||
vin_warn("large image mode not support isp%d\n", vinc->isp_sel);
|
||||
} else {
|
||||
if ((vinc->csi_ch != 0xff) && (vinc->csi_ch & 0x10))
|
||||
if ((vinc->csi_ch != 0xff) && (vinc->csi_ch & 0x10)){
|
||||
csic_isp_input_select(vind->id, vinc->isp_sel/ISP_VIRT_NUM, vinc->isp_sel%ISP_VIRT_NUM + 0, vinc->csi_sel, vinc->csi_ch & 0xf);
|
||||
}
|
||||
else {
|
||||
for (i = 0; i < vinc->total_rx_ch; i++)
|
||||
csic_isp_input_select(vind->id, vinc->isp_sel/ISP_VIRT_NUM, vinc->isp_sel%ISP_VIRT_NUM + i, vinc->csi_sel, i);
|
||||
|
@ -1710,6 +1711,7 @@ static int vin_create_media_links(struct vin_md *vind)
|
|||
vin_log(VIN_LOG_MD, "created link [%s] %c> [%s]\n",
|
||||
source->name, '=', sink->name);
|
||||
} else {
|
||||
#if defined CONFIG_MIPI_VC
|
||||
source = &csi->entity;
|
||||
sink = &isp->entity;
|
||||
ret = media_create_pad_link(source, SCALER_PAD_SOURCE,
|
||||
|
@ -1717,6 +1719,7 @@ static int vin_create_media_links(struct vin_md *vind)
|
|||
MEDIA_LNK_FL_ENABLED);
|
||||
vin_log(VIN_LOG_MD, "created link [%s] %c> [%s]\n",
|
||||
source->name, '=', sink->name);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
cap_sd = &vinc->vid_cap.subdev;
|
||||
|
@ -1753,7 +1756,7 @@ static int vin_create_media_links(struct vin_md *vind)
|
|||
vin_log(VIN_LOG_MD, "created link [%s] %c> [%s]\n",
|
||||
source->name, '=', sink->name);
|
||||
}
|
||||
|
||||
#if !defined CONFIG_MIPI_VC
|
||||
for (i = 0; i < VIN_MAX_CSI; i++) {
|
||||
#ifdef SUPPORT_ISP_TDM
|
||||
struct vin_core *vinc = NULL;
|
||||
|
@ -1780,7 +1783,7 @@ static int vin_create_media_links(struct vin_md *vind)
|
|||
source->name, '-', sink->name);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
for (i = 0; i < VIN_MAX_ISP; i++) {
|
||||
isp = vind->isp[i].sd;
|
||||
if (isp == NULL)
|
||||
|
|
|
@ -311,6 +311,11 @@ struct sensor_isp_cfg {
|
|||
__u8 large_image;
|
||||
};
|
||||
|
||||
struct sensor_vc_flip {
|
||||
int isp_id;
|
||||
__s32 value;
|
||||
};
|
||||
|
||||
enum dma_buffer_num {
|
||||
BK_MUL_BUFFER = 0,
|
||||
BK_ONE_BUFFER,
|
||||
|
|
|
@ -28,8 +28,7 @@ CONFIG_FPU_DOUBLE=y
|
|||
# Sunxi Platform Support
|
||||
#
|
||||
# CONFIG_CPUFREQ_SUPPORT is not set
|
||||
CONFIG_PANIC_CLI=y
|
||||
CONFIG_PANIC_CLI_PWD=y
|
||||
# CONFIG_PANIC_CLI is not set
|
||||
|
||||
#
|
||||
# RTOS Kernel Setup
|
||||
|
@ -213,7 +212,8 @@ 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=2
|
||||
CONFIG_ISP_NUMBER=3
|
||||
CONFIG_SUPPORT_THREE_CAMERA=y
|
||||
|
||||
#
|
||||
# sensor driver select
|
||||
|
@ -224,6 +224,7 @@ CONFIG_ISP_NUMBER=2
|
|||
CONFIG_SENSOR_GC2083_MIPI=y
|
||||
# CONFIG_SENSOR_GC4663_MIPI is not set
|
||||
# CONFIG_SENSOR_SC2355_MIPI is not set
|
||||
CONFIG_SENSOR_SC2356_MIPI=y
|
||||
# CONFIG_SENSOR_SC2336_MIPI is not set
|
||||
# CONFIG_SENSOR_SC3336_MIPI is not set
|
||||
# CONFIG_SENSOR_SC500AI_MIPI is not set
|
||||
|
@ -242,7 +243,7 @@ CONFIG_SENSOR_GC2083_MIPI=y
|
|||
# CONFIG_SENSOR_F355P_DVP is not set
|
||||
# CONFIG_SENSOR_F37P_DVP is not set
|
||||
# CONFIG_SENSOR_F37P_MIPI is not set
|
||||
CONFIG_SENSOR_OV02B10_MIPI=y
|
||||
# CONFIG_SENSOR_OV02B10_MIPI is not set
|
||||
|
||||
#
|
||||
# Osal Setup
|
||||
|
@ -286,7 +287,7 @@ CONFIG_RPMSG_NOTIFY=y
|
|||
# CONFIG_RPMSG_SPEEDTEST is not set
|
||||
CONFIG_AMP_SHARE_IRQ=y
|
||||
CONFIG_RPMSG_CLIENT=y
|
||||
# CONFIG_RPMSG_CLIENT_TEST is not set
|
||||
CONFIG_RPMSG_CLIENT_TEST=y
|
||||
CONFIG_RPMSG_CLIENT_QUEUE_SIZE=16
|
||||
# CONFIG_RPMSG_CLIENT_DEBUG is not set
|
||||
CONFIG_RPMSG_HEARBEAT=y
|
||||
|
@ -427,7 +428,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=1
|
||||
CONFIG_LOG_DEFAULT_LEVEL=4
|
||||
# CONFIG_CC_STACKPROTECTOR_STRONG is not set
|
||||
# CONFIG_LOG_RELEASE is not set
|
||||
# CONFIG_BOOTUP_TURBO is not set
|
||||
|
@ -436,7 +437,7 @@ CONFIG_LOG_DEFAULT_LEVEL=1
|
|||
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=2
|
||||
CONFIG_DYNAMIC_LOG_DEFAULT_LEVEL=4
|
||||
# CONFIG_FRAME_POINTER is not set
|
||||
CONFIG_FRAME_WARN=8192
|
||||
CONFIG_UART_CLI_USE_NONE=y
|
||||
|
@ -473,9 +474,9 @@ CONFIG_SOC_SUN20I=y
|
|||
# CONFIG_ARCH_SUN8IW19 is not set
|
||||
CONFIG_SOC_SUN20IW3=y
|
||||
CONFIG_ARCH_SUN20IW3=y
|
||||
CONFIG_DRAM_PHYBASE=0x43c00000
|
||||
CONFIG_DRAM_VIRTBASE=0x43c00000
|
||||
CONFIG_DRAM_SIZE=0x0400000
|
||||
CONFIG_DRAM_PHYBASE=0x45010000
|
||||
CONFIG_DRAM_VIRTBASE=0x45010000
|
||||
CONFIG_DRAM_SIZE=0x0530000
|
||||
CONFIG_COHERENT_SIZE=0x00c00000
|
||||
CONFIG_COHERENT_START_ADDR=0xa0000000
|
||||
CONFIG_LOAD_DATA_TO_MEM_FROM_STORAGE=y
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
;i2c configuration
|
||||
;----------------------------------------------------------------------------------
|
||||
[twi0]
|
||||
twi0_scl = port:PE04<8><1><default><default>
|
||||
twi0_sda = port:PE05<8><1><default><default>
|
||||
twi0_scl = port:PE04<8><1><0><default>
|
||||
twi0_sda = port:PE05<8><1><0><default>
|
||||
|
||||
[twi1]
|
||||
twi1_scl = port:PE02<8><1><default><default>
|
||||
twi1_sda = port:PE03<8><1><default><default>
|
||||
twi1_scl = port:PE02<8><1><0><default>
|
||||
twi1_sda = port:PE03<8><1><0><default>
|
||||
|
||||
;[twi2]
|
||||
;twi2_scl = port:PH05<4><1><default><default>
|
||||
|
@ -54,5 +54,5 @@ mclk0 = port:PE12<5><1><default><default>
|
|||
[sensor1]
|
||||
used1 = 1
|
||||
reset1 = port:PE06<1><1><default><default>
|
||||
pwdn1 = port:PE09<1><1><default><default>
|
||||
pwdn1 = port:PE07<1><1><default><default>
|
||||
mclk1 = port:PE13<5><1><default><default>
|
||||
|
|
|
@ -8,7 +8,7 @@ OUTPUT_FORMAT("elf32-littleriscv","elf64-littleriscv","elf32-littleriscv")
|
|||
MEMORY
|
||||
{
|
||||
/*DRAM_KERNEL: 4M */
|
||||
DRAM_SEG_KRN (rwx) : ORIGIN = 0x43c00000, LENGTH = 0x00400000
|
||||
DRAM_SEG_KRN (rwx) : ORIGIN = 0x45010000, LENGTH = 0x00530000
|
||||
}
|
||||
|
||||
PHDRS
|
||||
|
|
|
@ -21,22 +21,31 @@ int app_entry(void *param)
|
|||
rpmsg_notify("tdm0", NULL, 0);
|
||||
rpmsg_notify("isp0", NULL, 0);
|
||||
rpmsg_notify("isp1", NULL, 0);
|
||||
rpmsg_notify("isp2", NULL, 0);
|
||||
rpmsg_notify("scaler0", NULL, 0);
|
||||
rpmsg_notify("scaler1", NULL, 0);
|
||||
rpmsg_notify("scaler2", NULL, 0);
|
||||
rpmsg_notify("scaler4", NULL, 0);
|
||||
rpmsg_notify("scaler5", NULL, 0);
|
||||
rpmsg_notify("scaler6", NULL, 0);
|
||||
rpmsg_notify("scaler8", NULL, 0);
|
||||
rpmsg_notify("scaler9", NULL, 0);
|
||||
rpmsg_notify("scaler10", NULL, 0);
|
||||
rpmsg_notify("scaler12", NULL, 0);
|
||||
rpmsg_notify("scaler13", NULL, 0);
|
||||
rpmsg_notify("scaler14", NULL, 0);
|
||||
rpmsg_notify("vinc0", NULL, 0);
|
||||
rpmsg_notify("vinc1", NULL, 0);
|
||||
rpmsg_notify("vinc2", NULL, 0);
|
||||
rpmsg_notify("vinc4", NULL, 0);
|
||||
rpmsg_notify("vinc5", NULL, 0);
|
||||
rpmsg_notify("vinc6", NULL, 0);
|
||||
rpmsg_notify("vinc8", NULL, 0);
|
||||
rpmsg_notify("vinc9", NULL, 0);
|
||||
rpmsg_notify("vinc10", NULL, 0);
|
||||
rpmsg_notify("vinc12", NULL, 0);
|
||||
rpmsg_notify("vinc13", NULL, 0);
|
||||
rpmsg_notify("vinc14", NULL, 0);
|
||||
#endif
|
||||
#else
|
||||
hal_msleep(200);
|
||||
|
|
|
@ -32,6 +32,10 @@ config SENSOR_SC2355_MIPI
|
|||
bool "use sc2355_mipi driver"
|
||||
default n
|
||||
|
||||
config SENSOR_SC2356_MIPI
|
||||
bool "use sc2356_mipi driver"
|
||||
default n
|
||||
|
||||
config SENSOR_SC2336_MIPI
|
||||
bool "use sc2336_mipi driver"
|
||||
default n
|
||||
|
|
|
@ -4,6 +4,7 @@ obj-$(CONFIG_SENSOR_GC2053_MIPI) += gc2053_mipi.o
|
|||
obj-$(CONFIG_SENSOR_GC2083_MIPI) += gc2083_mipi.o
|
||||
obj-$(CONFIG_SENSOR_GC4663_MIPI) += gc4663_mipi.o
|
||||
obj-$(CONFIG_SENSOR_SC2355_MIPI) += sc2355_mipi.o
|
||||
obj-$(CONFIG_SENSOR_SC2356_MIPI) += sc2356_mipi.o
|
||||
obj-$(CONFIG_SENSOR_SC2336_MIPI) += sc2336_mipi.o
|
||||
obj-$(CONFIG_SENSOR_SC3336_MIPI) += sc3336_mipi.o
|
||||
obj-$(CONFIG_SENSOR_SC500AI_MIPI) += sc500ai_mipi.o
|
||||
|
|
|
@ -156,6 +156,7 @@ extern struct sensor_fuc_core gc4663_core;
|
|||
extern struct sensor_fuc_core gc2053_core;
|
||||
extern struct sensor_fuc_core gc2083_core;
|
||||
extern struct sensor_fuc_core sc2355_core;
|
||||
extern struct sensor_fuc_core sc2356_core;
|
||||
extern struct sensor_fuc_core sc2336_core;
|
||||
extern struct sensor_fuc_core sc3336_core;
|
||||
extern struct sensor_fuc_core sc500ai_core;
|
||||
|
|
|
@ -0,0 +1,969 @@
|
|||
/*
|
||||
* A V4L2 driver for Raw cameras.
|
||||
*
|
||||
* Copyright (c) 2017 by Allwinnertech Co., Ltd. http://www.allwinnertech.com
|
||||
*
|
||||
* Authors: Zhao Wei <zhaowei@allwinnertech.com>
|
||||
* Liang WeiJie <liangweijie@allwinnertech.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <hal_timer.h>
|
||||
|
||||
#include "../../vin_mipi/combo_common.h"
|
||||
#include "camera.h"
|
||||
#include "../../utility/sunxi_camera_v2.h"
|
||||
#include "../../utility/media-bus-format.h"
|
||||
#include "../../utility/vin_supply.h"
|
||||
|
||||
#define MCLK (24*1000*1000)
|
||||
#define V4L2_IDENT_SENSOR 0x2356
|
||||
|
||||
//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
|
||||
|
||||
#define ID_REG_HIGH 0x3e07
|
||||
#define ID_REG_LOW 0x3e08
|
||||
#define ID_VAL_HIGH 0x80
|
||||
#define ID_VAL_LOW 0x00
|
||||
#define SENSOR_FRAME_RATE 30
|
||||
|
||||
#define I2C_ADDR 0x6C
|
||||
//#define I2C_ADDR_2 0x32
|
||||
|
||||
#define SENSOR_NUM 0x2
|
||||
#define SENSOR_NAME "sc2356_mipi"
|
||||
#define SENSOR_NAME_2 "sc2356_mipi_2"
|
||||
|
||||
#if 1
|
||||
#define SC2356_1600X1200_30FPS
|
||||
#else
|
||||
#define SC2356_800X600_30FPS
|
||||
#endif
|
||||
|
||||
static int sensor_power_count[2];
|
||||
static int sensor_stream_count[2];
|
||||
static struct sensor_format_struct *current_win[2];
|
||||
|
||||
/*
|
||||
* The default register settings
|
||||
*/
|
||||
#define A_I2C_ADDR 0x6c
|
||||
#define B_I2C_ADDR 0x20
|
||||
|
||||
struct sensor_switch_cfg_t {
|
||||
bool sensor_is_detected;
|
||||
bool sensor_with_switch_en;
|
||||
unsigned int sensor_num;
|
||||
unsigned int switch_status;
|
||||
unsigned int i2c_addr_container[2];
|
||||
unsigned int frame_length_save[2];
|
||||
unsigned int exp_val_save[2];
|
||||
unsigned int gain_val_save[2];
|
||||
bool set_expgain_flags[2];
|
||||
bool sensor_detect_flag[2];
|
||||
int sensor_hflip_status[2];
|
||||
int sensor_vflip_status[2];
|
||||
unsigned int vsync_cnt;
|
||||
};
|
||||
|
||||
typedef enum _sensor_switch_choice_type {
|
||||
SWITCH_SENSOR_A = 0,
|
||||
SWITCH_SENSOR_B = 1,
|
||||
SWITCH_SENSOR_MAX,
|
||||
} sensor_switch_choice_type;
|
||||
|
||||
static struct sensor_switch_cfg_t sensor_switch_cfg[2] = {
|
||||
[0] = {
|
||||
.i2c_addr_container = {A_I2C_ADDR, B_I2C_ADDR},
|
||||
.switch_status = 0,
|
||||
},
|
||||
};
|
||||
|
||||
static struct regval_list sensor_default_regs[] = {
|
||||
|
||||
};
|
||||
|
||||
#ifdef SC2356_800X600_30FPS
|
||||
static struct regval_list sensor_800x600_30_regs[] = {
|
||||
#if 0
|
||||
{0x0103, 0x01},
|
||||
{0x0100, 0x00},
|
||||
{0x36e9, 0x80},
|
||||
{0x36ea, 0x0f},
|
||||
{0x36eb, 0x24},
|
||||
{0x36ed, 0x14},
|
||||
{0x36e9, 0x01},
|
||||
{0x301f, 0x0c},
|
||||
{0x303f, 0x82},
|
||||
{0x3208, 0x03},
|
||||
{0x3209, 0x20},
|
||||
{0x320a, 0x02},
|
||||
{0x320b, 0x58},
|
||||
{0x320c, 0x07},//hts=1920
|
||||
{0x320d, 0x80},
|
||||
{0x320e, 0x04},//vts=1250 1920*1250*30=72
|
||||
{0x320f, 0xe2},
|
||||
{0x3211, 0x02},
|
||||
{0x3213, 0x02},
|
||||
{0x3215, 0x31},
|
||||
{0x3220, 0x01},
|
||||
{0x3221, 0x60},
|
||||
{0x3248, 0x02},
|
||||
{0x3253, 0x0a},
|
||||
{0x3301, 0xff},
|
||||
{0x3302, 0xff},
|
||||
{0x3303, 0x10},
|
||||
{0x3306, 0x28},
|
||||
{0x3307, 0x02},
|
||||
{0x330a, 0x00},
|
||||
{0x330b, 0xb0},
|
||||
{0x3318, 0x02},
|
||||
{0x3320, 0x06},
|
||||
{0x3321, 0x02},
|
||||
{0x3326, 0x12},
|
||||
{0x3327, 0x0e},
|
||||
{0x3328, 0x03},
|
||||
{0x3329, 0x0f},
|
||||
{0x3364, 0x4f},
|
||||
{0x33b3, 0x40},
|
||||
{0x33f9, 0x2c},
|
||||
{0x33fb, 0x38},
|
||||
{0x33fc, 0x0f},
|
||||
{0x33fd, 0x1f},
|
||||
{0x349f, 0x03},
|
||||
{0x34a6, 0x01},
|
||||
{0x34a7, 0x1f},
|
||||
{0x34a8, 0x40},
|
||||
{0x34a9, 0x30},
|
||||
{0x34ab, 0xa6},
|
||||
{0x34ad, 0xa6},
|
||||
{0x3622, 0x60},
|
||||
{0x3623, 0x40},
|
||||
{0x3624, 0x61},
|
||||
{0x3625, 0x08},
|
||||
{0x3626, 0x03},
|
||||
{0x3630, 0xa8},
|
||||
{0x3631, 0x84},
|
||||
{0x3632, 0x90},
|
||||
{0x3633, 0x43},
|
||||
{0x3634, 0x09},
|
||||
{0x3635, 0x82},
|
||||
{0x3636, 0x48},
|
||||
{0x3637, 0xe4},
|
||||
{0x3641, 0x22},
|
||||
{0x3670, 0x0f},
|
||||
{0x3674, 0xc0},
|
||||
{0x3675, 0xc0},
|
||||
{0x3676, 0xc0},
|
||||
{0x3677, 0x86},
|
||||
{0x3678, 0x88},
|
||||
{0x3679, 0x8c},
|
||||
{0x367c, 0x01},
|
||||
{0x367d, 0x0f},
|
||||
{0x367e, 0x01},
|
||||
{0x367f, 0x0f},
|
||||
{0x3690, 0x63},
|
||||
{0x3691, 0x63},
|
||||
{0x3692, 0x73},
|
||||
{0x369c, 0x01},
|
||||
{0x369d, 0x1f},
|
||||
{0x369e, 0x8a},
|
||||
{0x369f, 0x9e},
|
||||
{0x36a0, 0xda},
|
||||
{0x36a1, 0x01},
|
||||
{0x36a2, 0x03},
|
||||
{0x3900, 0x0d},
|
||||
{0x3904, 0x04},
|
||||
{0x3905, 0x98},
|
||||
{0x391b, 0x81},
|
||||
{0x391c, 0x10},
|
||||
{0x391d, 0x19},
|
||||
{0x3933, 0x01},
|
||||
{0x3934, 0x82},
|
||||
{0x3940, 0x5d},
|
||||
{0x3942, 0x01},
|
||||
{0x3943, 0x82},
|
||||
{0x3949, 0xc8},
|
||||
{0x394b, 0x64},
|
||||
{0x3952, 0x02},
|
||||
{0x3e00, 0x00},
|
||||
{0x3e01, 0x4d},
|
||||
{0x3e02, 0xe0},
|
||||
{0x4502, 0x34},
|
||||
{0x4509, 0x30},
|
||||
{0x450a, 0x71},
|
||||
{0x4819, 0x09},
|
||||
{0x481b, 0x05},
|
||||
{0x481d, 0x13},
|
||||
{0x481f, 0x04},
|
||||
{0x4821, 0x0a},
|
||||
{0x4823, 0x05},
|
||||
{0x4825, 0x04},
|
||||
{0x4827, 0x05},
|
||||
{0x4829, 0x08},
|
||||
{0x5000, 0x46},
|
||||
{0x5900, 0x01},
|
||||
{0x5901, 0x04},
|
||||
{0x0100, 0x01},
|
||||
#endif
|
||||
{0x0103,0x01},
|
||||
{0x0100,0x00},
|
||||
{0x3221,0x06},//hflip:0x06 vflip:0x60
|
||||
{0x36e9,0x80},
|
||||
{0x36e9,0x24},
|
||||
{0x301f,0x01},
|
||||
|
||||
{0x3208, 0x03},
|
||||
{0x3209, 0x20},
|
||||
{0x320a, 0x02},
|
||||
{0x320b, 0x58},
|
||||
{0x3211, 0x02},
|
||||
{0x3213, 0x02},
|
||||
|
||||
{0x3301,0xff},
|
||||
{0x3304,0x68},
|
||||
{0x3306,0x40},
|
||||
{0x3308,0x08},
|
||||
{0x3309,0xa8},
|
||||
{0x330b,0xb0},
|
||||
{0x330c,0x18},
|
||||
{0x330d,0xff},
|
||||
{0x330e,0x20},
|
||||
{0x331e,0x59},
|
||||
{0x331f,0x99},
|
||||
{0x3333,0x10},
|
||||
{0x335e,0x06},
|
||||
{0x335f,0x08},
|
||||
{0x3364,0x1f},
|
||||
{0x337c,0x02},
|
||||
{0x337d,0x0a},
|
||||
{0x338f,0xa0},
|
||||
{0x3390,0x01},
|
||||
{0x3391,0x03},
|
||||
{0x3392,0x1f},
|
||||
{0x3393,0xff},
|
||||
{0x3394,0xff},
|
||||
{0x3395,0xff},
|
||||
{0x33a2,0x04},
|
||||
{0x33ad,0x0c},
|
||||
{0x33b1,0x20},
|
||||
{0x33b3,0x38},
|
||||
{0x33f9,0x40},
|
||||
{0x33fb,0x48},
|
||||
{0x33fc,0x0f},
|
||||
{0x33fd,0x1f},
|
||||
{0x349f,0x03},
|
||||
{0x34a6,0x03},
|
||||
{0x34a7,0x1f},
|
||||
{0x34a8,0x38},
|
||||
{0x34a9,0x30},
|
||||
{0x34ab,0xb0},
|
||||
{0x34ad,0xb0},
|
||||
{0x34f8,0x1f},
|
||||
{0x34f9,0x20},
|
||||
{0x3630,0xa0},
|
||||
{0x3631,0x92},
|
||||
{0x3632,0x64},
|
||||
{0x3633,0x43},
|
||||
{0x3637,0x49},
|
||||
{0x363a,0x85},
|
||||
{0x363c,0x0f},
|
||||
{0x3650,0x31},
|
||||
{0x3670,0x0d},
|
||||
{0x3674,0xc0},
|
||||
{0x3675,0xa0},
|
||||
{0x3676,0xa0},
|
||||
{0x3677,0x92},
|
||||
{0x3678,0x96},
|
||||
{0x3679,0x9a},
|
||||
{0x367c,0x03},
|
||||
{0x367d,0x0f},
|
||||
{0x367e,0x01},
|
||||
{0x367f,0x0f},
|
||||
{0x3698,0x83},
|
||||
{0x3699,0x86},
|
||||
{0x369a,0x8c},
|
||||
{0x369b,0x94},
|
||||
{0x36a2,0x01},
|
||||
{0x36a3,0x03},
|
||||
{0x36a4,0x07},
|
||||
{0x36ae,0x0f},
|
||||
{0x36af,0x1f},
|
||||
{0x36bd,0x22},
|
||||
{0x36be,0x22},
|
||||
{0x36bf,0x22},
|
||||
{0x36d0,0x01},
|
||||
{0x370f,0x02},
|
||||
{0x3721,0x6c},
|
||||
{0x3722,0x8d},
|
||||
{0x3725,0xc5},
|
||||
{0x3727,0x14},
|
||||
{0x3728,0x04},
|
||||
{0x37b7,0x04},
|
||||
{0x37b8,0x04},
|
||||
{0x37b9,0x06},
|
||||
{0x37bd,0x07},
|
||||
{0x37be,0x0f},
|
||||
{0x3901,0x02},
|
||||
{0x3903,0x40},
|
||||
{0x3905,0x8d},
|
||||
{0x3907,0x00},
|
||||
{0x3908,0x41},
|
||||
{0x391f,0x41},
|
||||
{0x3933,0x80},
|
||||
{0x3934,0x02},
|
||||
{0x3937,0x6f},
|
||||
{0x393a,0x01},
|
||||
{0x393d,0x01},
|
||||
{0x393e,0xc0},
|
||||
{0x39dd,0x41},
|
||||
{0x3e00,0x00},
|
||||
{0x3e01,0x4d},
|
||||
{0x3e02,0xc0},
|
||||
{0x3e09,0x00},
|
||||
{0x4509,0x28},
|
||||
{0x450d,0x61},
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef SC2356_1600X1200_30FPS
|
||||
static struct regval_list sensor_1600x1200_30_regs[] = {
|
||||
{0x0103,0x01},
|
||||
{0x0100,0x00},
|
||||
{0x3221,0x06},//hflip:0x06 vflip:0x60
|
||||
{0x36e9,0x80},
|
||||
{0x36e9,0x24},
|
||||
{0x301f,0x01},
|
||||
{0x3301,0xff},
|
||||
{0x3304,0x68},
|
||||
{0x3306,0x40},
|
||||
{0x3308,0x08},
|
||||
{0x3309,0xa8},
|
||||
{0x330b,0xb0},
|
||||
{0x330c,0x18},
|
||||
{0x330d,0xff},
|
||||
{0x330e,0x20},
|
||||
{0x331e,0x59},
|
||||
{0x331f,0x99},
|
||||
{0x3333,0x10},
|
||||
{0x335e,0x06},
|
||||
{0x335f,0x08},
|
||||
{0x3364,0x1f},
|
||||
{0x337c,0x02},
|
||||
{0x337d,0x0a},
|
||||
{0x338f,0xa0},
|
||||
{0x3390,0x01},
|
||||
{0x3391,0x03},
|
||||
{0x3392,0x1f},
|
||||
{0x3393,0xff},
|
||||
{0x3394,0xff},
|
||||
{0x3395,0xff},
|
||||
{0x33a2,0x04},
|
||||
{0x33ad,0x0c},
|
||||
{0x33b1,0x20},
|
||||
{0x33b3,0x38},
|
||||
{0x33f9,0x40},
|
||||
{0x33fb,0x48},
|
||||
{0x33fc,0x0f},
|
||||
{0x33fd,0x1f},
|
||||
{0x349f,0x03},
|
||||
{0x34a6,0x03},
|
||||
{0x34a7,0x1f},
|
||||
{0x34a8,0x38},
|
||||
{0x34a9,0x30},
|
||||
{0x34ab,0xb0},
|
||||
{0x34ad,0xb0},
|
||||
{0x34f8,0x1f},
|
||||
{0x34f9,0x20},
|
||||
{0x3630,0xa0},
|
||||
{0x3631,0x92},
|
||||
{0x3632,0x64},
|
||||
{0x3633,0x43},
|
||||
{0x3637,0x49},
|
||||
{0x363a,0x85},
|
||||
{0x363c,0x0f},
|
||||
{0x3650,0x31},
|
||||
{0x3670,0x0d},
|
||||
{0x3674,0xc0},
|
||||
{0x3675,0xa0},
|
||||
{0x3676,0xa0},
|
||||
{0x3677,0x92},
|
||||
{0x3678,0x96},
|
||||
{0x3679,0x9a},
|
||||
{0x367c,0x03},
|
||||
{0x367d,0x0f},
|
||||
{0x367e,0x01},
|
||||
{0x367f,0x0f},
|
||||
{0x3698,0x83},
|
||||
{0x3699,0x86},
|
||||
{0x369a,0x8c},
|
||||
{0x369b,0x94},
|
||||
{0x36a2,0x01},
|
||||
{0x36a3,0x03},
|
||||
{0x36a4,0x07},
|
||||
{0x36ae,0x0f},
|
||||
{0x36af,0x1f},
|
||||
{0x36bd,0x22},
|
||||
{0x36be,0x22},
|
||||
{0x36bf,0x22},
|
||||
{0x36d0,0x01},
|
||||
{0x370f,0x02},
|
||||
{0x3721,0x6c},
|
||||
{0x3722,0x8d},
|
||||
{0x3725,0xc5},
|
||||
{0x3727,0x14},
|
||||
{0x3728,0x04},
|
||||
{0x37b7,0x04},
|
||||
{0x37b8,0x04},
|
||||
{0x37b9,0x06},
|
||||
{0x37bd,0x07},
|
||||
{0x37be,0x0f},
|
||||
{0x3901,0x02},
|
||||
{0x3903,0x40},
|
||||
{0x3905,0x8d},
|
||||
{0x3907,0x00},
|
||||
{0x3908,0x41},
|
||||
{0x391f,0x41},
|
||||
{0x3933,0x80},
|
||||
{0x3934,0x02},
|
||||
{0x3937,0x6f},
|
||||
{0x393a,0x01},
|
||||
{0x393d,0x01},
|
||||
{0x393e,0xc0},
|
||||
{0x39dd,0x41},
|
||||
{0x3e00,0x00},
|
||||
{0x3e01,0x4d},
|
||||
{0x3e02,0xc0},
|
||||
{0x3e09,0x00},
|
||||
{0x4509,0x28},
|
||||
{0x450d,0x61},
|
||||
|
||||
// {0x4816,0x61},//{0x4816,0x65}, //vc ch1
|
||||
// {0x3222,0x00},
|
||||
// {0x3224,0x92},
|
||||
// {0x300a,0x40},
|
||||
// {0x0100,0x01},
|
||||
};
|
||||
#endif
|
||||
static struct regval_list sensor_master_regs[] = {
|
||||
|
||||
{0x4816,0x61},//vc ch0
|
||||
|
||||
{0x300a,0x40},//bit[6]:fsync output
|
||||
{0x3032,0xa0},//bit[7]:output fsync
|
||||
|
||||
{0x0100,0x01},
|
||||
|
||||
};
|
||||
|
||||
static struct regval_list sensor_slave_regs[] = {
|
||||
|
||||
{0x4816,0x65},//vc ch1
|
||||
|
||||
{0x3222,0x02},//slave (0x00 :master)
|
||||
{0x3224,0x83},
|
||||
|
||||
{0x0100,0x01},
|
||||
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Here we'll try to encapsulate the changes for just the output
|
||||
* video format.
|
||||
*
|
||||
*/
|
||||
|
||||
static struct sensor_switch_cfg_t* sensor_mipi_switch_get_cfg(int id)
|
||||
{
|
||||
return (&sensor_switch_cfg[0]);
|
||||
|
||||
}
|
||||
|
||||
static struct regval_list sensor_fmt_raw[] = {
|
||||
|
||||
};
|
||||
|
||||
static int sensor_s_exp(int id, unsigned int exp_val)
|
||||
{
|
||||
unsigned int tmp_exp_val = exp_val;
|
||||
|
||||
sensor_write(id, EXP_HIGH, (tmp_exp_val >> 12) & 0x0f);
|
||||
sensor_write(id, EXP_MID, (tmp_exp_val >> 4) & 0xFF);
|
||||
sensor_write(id, EXP_LOW, (tmp_exp_val << 4) & 0xf0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#define GPIO_SWITCH_NUM 163 //PF3
|
||||
// 初始化GPIO
|
||||
static int init_gpio(void) {
|
||||
// 设置GPIO引脚为输出模式
|
||||
hal_gpio_set_direction(GPIOF(3), GPIO_DIRECTION_OUTPUT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void control_gpio(int value) {
|
||||
|
||||
hal_gpio_set_data(GPIOF(3), value);
|
||||
|
||||
}
|
||||
|
||||
unsigned char analog_Gain_Reg[] =
|
||||
{0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f};
|
||||
|
||||
static int setSensorGain(int id, int gain)
|
||||
{
|
||||
int ana_gain = gain / GAIN_STEP_BASE;
|
||||
int gain_flag = 1;
|
||||
|
||||
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;
|
||||
} else if(ana_gain >= 4) {
|
||||
gain_flag = 2;
|
||||
} else if(ana_gain >= 2) {
|
||||
gain_flag = 1;
|
||||
} else {
|
||||
gain_flag = 0;
|
||||
}
|
||||
|
||||
sensor_write(id, ANA_GAIN, analog_Gain_Reg[gain_flag]);
|
||||
int dig_Gain = gain >> gain_flag;
|
||||
if(dig_Gain < 2 * GAIN_STEP_BASE) {
|
||||
//1/128
|
||||
sensor_write(id, DIG_GAIN, 0x00);
|
||||
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) {
|
||||
//1/64
|
||||
sensor_write(id, DIG_GAIN, 0x01);
|
||||
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) {
|
||||
//1/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, 0x03);
|
||||
sensor_write(id, DIG_FINE_GAIN, 0xfe);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sensor_s_gain(int id, int gain_val)
|
||||
{
|
||||
sensor_dbg("gain_val:%d\n", gain_val);
|
||||
setSensorGain(id, gain_val);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sc2356_sensor_vts;
|
||||
static int sensor_s_exp_gain(int id, struct sensor_exp_gain *exp_gain)
|
||||
{
|
||||
int exp_val,gain_val;
|
||||
int shutter = 0, frame_length = 0;
|
||||
|
||||
//sensor_print("sensor_s_exp_gain exp:%d gain:%d\n", exp_gain->gain_val, exp_gain->exp_val);
|
||||
if((exp_gain->exp_val - exp_gain->exp_val / 16 * 16) > 0) {
|
||||
exp_val = exp_gain->exp_val / 16 + 1;
|
||||
} else {
|
||||
exp_val = exp_gain->exp_val / 16;
|
||||
}
|
||||
exp_val = exp_val & 0xffff;
|
||||
|
||||
gain_val = exp_gain->gain_val * GAIN_STEP_BASE;
|
||||
if((gain_val - gain_val / 16 * 16) > 0) {
|
||||
gain_val = gain_val / 16 + 1;
|
||||
} else {
|
||||
gain_val = gain_val / 16;
|
||||
}
|
||||
if (exp_val > 1250){
|
||||
exp_val = 1250;
|
||||
}
|
||||
sensor_s_exp(id, exp_val);
|
||||
sensor_s_gain(id, gain_val);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sensor_power(int id, int on)
|
||||
{
|
||||
if (on && (sensor_power_count[id])++ > 0) {
|
||||
return 0;
|
||||
} else if (!on && (sensor_power_count[id] == 0 || --(sensor_power_count[id]) > 0)) {
|
||||
return 0;
|
||||
}
|
||||
switch(on){
|
||||
case PWR_ON:
|
||||
sensor_print("PWR_ON!\n");
|
||||
vin_set_mclk_freq(id, MCLK);
|
||||
hal_usleep(1200);
|
||||
vin_set_mclk(id, 1);
|
||||
vin_gpio_set_status(id, RESET, 1);
|
||||
vin_gpio_set_status(id, PWDN, 1);
|
||||
vin_gpio_write(id, PWDN, CSI_GPIO_LOW);
|
||||
vin_gpio_write(id, RESET, CSI_GPIO_LOW);
|
||||
hal_usleep(3000);
|
||||
vin_gpio_write(id, PWDN, CSI_GPIO_HIGH);
|
||||
vin_gpio_write(id, RESET, CSI_GPIO_HIGH);
|
||||
hal_usleep(30000);
|
||||
break;
|
||||
case PWR_OFF:
|
||||
sensor_print("PWR_OFF!do nothing\n");
|
||||
vin_set_mclk(id, 0);
|
||||
hal_usleep(1000);
|
||||
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, RESET, CSI_GPIO_LOW);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
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_print("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_print("ID_VAL_HIGH = %2x, Done!\n", rdval);
|
||||
|
||||
if(rdval != ID_VAL_HIGH)
|
||||
return -ENODEV;
|
||||
|
||||
sensor_read(id, ID_REG_LOW, &rdval);
|
||||
sensor_print("ID_VAL_LOW = %2x, Done!\n", rdval);
|
||||
if(rdval != ID_VAL_LOW)
|
||||
return -ENODEV;
|
||||
sensor_print("sc2356 id is 0x2356!\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sensor_init(int id)
|
||||
{
|
||||
int ret;
|
||||
|
||||
sensor_detect("sensor_init\n");
|
||||
ret = sensor_detect(id);
|
||||
if(ret) {
|
||||
sensor_err("chip found is not an target chip.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
init_gpio();
|
||||
control_gpio(1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Store information about the video data format.
|
||||
*/
|
||||
static struct sensor_format_struct sensor_formats[] = {
|
||||
#ifdef SC2356_800X600_30FPS
|
||||
{
|
||||
.mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10, /*.mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10, */
|
||||
.width = 800,
|
||||
.height = 600,//1080,
|
||||
.hoffset = 0,
|
||||
.voffset = 0,
|
||||
.hts = 1920,
|
||||
.vts = 1250,
|
||||
.pclk = 72000000,
|
||||
.mipi_bps = 297 * 1000 * 1000,
|
||||
.fps_fixed = 30,
|
||||
.bin_factor = 1,
|
||||
.intg_min = 1 << 4,
|
||||
.intg_max = 1125 << 4,
|
||||
.gain_min = 1 << 4,
|
||||
.gain_max = 16 << 4,
|
||||
.offs_h = 0,
|
||||
.offs_v = 0,
|
||||
.regs = sensor_800x600_30_regs,
|
||||
.regs_size = ARRAY_SIZE(sensor_800x600_30_regs),
|
||||
},
|
||||
#endif
|
||||
|
||||
#ifdef SC2356_1600X1200_30FPS
|
||||
{
|
||||
.mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10, /*.mbus_code = MEDIA_BUS_FMT_SBGGR10_1X10, */
|
||||
.width = 1600,
|
||||
.height = 1200,//1080,
|
||||
.hoffset = 0,
|
||||
.voffset = 0,
|
||||
.hts = 1920,
|
||||
.vts = 1250,
|
||||
.pclk = 71250000,
|
||||
.mipi_bps = 297 * 1000 * 1000,
|
||||
.fps_fixed = 15,
|
||||
.bin_factor = 1,
|
||||
.intg_min = 1 << 4,
|
||||
.intg_max = 1250 << 4,
|
||||
.gain_min = 1 << 4,
|
||||
.gain_max = 16 << 4,
|
||||
.offs_h = 0,
|
||||
.offs_v = 0,
|
||||
.regs = sensor_1600x1200_30_regs,
|
||||
.regs_size = ARRAY_SIZE(sensor_1600x1200_30_regs),
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct sensor_format_struct *sensor_get_format(int id, int isp_id)
|
||||
{
|
||||
int ispid = clamp(isp_id, 0, ISP_GET_CFG_NUM - 1);
|
||||
struct sensor_format_struct *sensor_format = NULL;
|
||||
int wdr_on = isp_get_cfg[ispid].sensor_wdr_on;
|
||||
int fps = isp_get_cfg[ispid].sensor_get_fps;
|
||||
int i;
|
||||
|
||||
if (current_win[id])
|
||||
return current_win[id];
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(sensor_formats); i++) {
|
||||
if (sensor_formats[i].wdr_mode == wdr_on) {
|
||||
if (sensor_formats[i].fps_fixed == fps) {
|
||||
sensor_format = &sensor_formats[i];
|
||||
sensor_print("fine wdr is %d, fine fps is %d\n", wdr_on, fps);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sensor_format == NULL) {
|
||||
for (i = 0; i < ARRAY_SIZE(sensor_formats); i++) {
|
||||
if (sensor_formats[i].wdr_mode == wdr_on) {
|
||||
sensor_format = &sensor_formats[i];
|
||||
isp_get_cfg[ispid].sensor_get_fps = sensor_format->fps_fixed;
|
||||
sensor_print("fine wdr is %d, use fps is %d\n", wdr_on, sensor_format->fps_fixed);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sensor_format == NULL) {
|
||||
sensor_format = &sensor_formats[0];
|
||||
isp_get_cfg[ispid].sensor_wdr_on = sensor_format->wdr_mode;
|
||||
isp_get_cfg[ispid].sensor_get_fps = sensor_format->fps_fixed;
|
||||
sensor_print("use wdr is %d, use fps is %d\n", sensor_format->wdr_mode, sensor_format->fps_fixed);
|
||||
}
|
||||
|
||||
done:
|
||||
current_win[id] = sensor_format;
|
||||
return sensor_format;
|
||||
}
|
||||
|
||||
static int sensor_g_mbus_config(int id, struct v4l2_mbus_config *cfg, struct mbus_framefmt_res *res)
|
||||
{
|
||||
cfg->type = V4L2_MBUS_CSI2;
|
||||
cfg->flags = 0 | V4L2_MBUS_CSI2_1_LANE | V4L2_MBUS_CSI2_CHANNEL_0 | V4L2_MBUS_CSI2_CHANNEL_1;
|
||||
res->res_time_hs = 0x11;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sensor_reg_init_vc(int id, int isp_id)
|
||||
{
|
||||
int ret;
|
||||
struct sensor_exp_gain exp_gain;
|
||||
int ispid = clamp(isp_id, 0, ISP_GET_CFG_NUM - 1);
|
||||
int switch_choice;
|
||||
struct sensor_switch_cfg_t *sensor_switch_config;
|
||||
sensor_switch_config = sensor_mipi_switch_get_cfg(id);
|
||||
sensor_switch_config->vsync_cnt = 0;
|
||||
|
||||
for (switch_choice = SWITCH_SENSOR_A; switch_choice < 2; switch_choice++)
|
||||
{
|
||||
sensor_set_twi_addr(id,sensor_switch_config->i2c_addr_container[switch_choice]);
|
||||
ret = sensor_write_array(id, sensor_default_regs, ARRAY_SIZE(sensor_default_regs));
|
||||
if (ret < 0) {
|
||||
sensor_err("write sensor_default_regs error\n");
|
||||
return ret;
|
||||
}
|
||||
if (current_win[id]->regs)
|
||||
ret = sensor_write_array(id, current_win[id]->regs, current_win[id]->regs_size);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if(switch_choice == SWITCH_SENSOR_A){
|
||||
sensor_print("ready to write master regs for i2c_addr:0x%x\n", sensor_switch_config->i2c_addr_container[switch_choice]);
|
||||
ret = sensor_write_array(id, sensor_master_regs, ARRAY_SIZE(sensor_master_regs));
|
||||
}
|
||||
else
|
||||
{
|
||||
sensor_print("ready to write slave regs for i2c_addr:0x%x\n", sensor_switch_config->i2c_addr_container[switch_choice]);
|
||||
ret = sensor_write_array(id, sensor_slave_regs, ARRAY_SIZE(sensor_slave_regs));
|
||||
}
|
||||
}
|
||||
sensor_set_twi_addr(id,sensor_switch_config->i2c_addr_container[0]);
|
||||
#ifndef CONFIG_ISP_READ_THRESHOLD
|
||||
exp_gain.exp_val = 1088;
|
||||
exp_gain.gain_val = 16;
|
||||
#else
|
||||
if (ispid == 0) {
|
||||
exp_gain.exp_val = clamp(*((unsigned int *)ISP0_NORFLASH_SAVE + 2), 16, 1125 << 4);
|
||||
exp_gain.gain_val = clamp(*((unsigned int *)ISP0_NORFLASH_SAVE + 1), 16, 110 << 4);
|
||||
printk("isp0 read gain is %d,exp is %d \n",*((unsigned int *)ISP0_NORFLASH_SAVE + 1),*((unsigned int *)ISP0_NORFLASH_SAVE + 2));
|
||||
} else {
|
||||
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);
|
||||
printk("isp1 read gain is %d,exp is %d \n",*((unsigned int *)ISP1_NORFLASH_SAVE + 1),*((unsigned int *)ISP1_NORFLASH_SAVE + 2));
|
||||
}
|
||||
printk("<<<kajon exp = %d, gain = %d function = %s, line=%d \n file=%s \n", exp_gain.exp_val, exp_gain.gain_val,__func__,__LINE__,__FILE__);
|
||||
#endif
|
||||
sensor_s_exp_gain(id, &exp_gain);
|
||||
|
||||
sc2356_sensor_vts = 1250;
|
||||
//sensor_dbg("sc2356_sensor_vts = %d\n", sc2356_sensor_vts);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sensor_reg_init(int id, int isp_id)
|
||||
{
|
||||
sensor_dbg("step sensor_reg_init\n");
|
||||
int ret;
|
||||
struct sensor_exp_gain exp_gain;
|
||||
int ispid = clamp(isp_id, 0, ISP_GET_CFG_NUM - 1);
|
||||
|
||||
sensor_print("sensor ready to write reg!\n");
|
||||
ret = sensor_write_array(id, sensor_default_regs,
|
||||
ARRAY_SIZE(sensor_default_regs));
|
||||
if (ret < 0) {
|
||||
sensor_err("write sensor_default_regs error\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (current_win[id]->regs)
|
||||
ret = sensor_write_array(id, current_win[id]->regs, current_win[id]->regs_size);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
#ifndef CONFIG_ISP_READ_THRESHOLD
|
||||
exp_gain.exp_val = 1088;
|
||||
exp_gain.gain_val = 16;
|
||||
#else
|
||||
if (ispid == 0) {
|
||||
exp_gain.exp_val = clamp(*((unsigned int *)ISP0_NORFLASH_SAVE + 2), 16, 1125 << 4);
|
||||
exp_gain.gain_val = clamp(*((unsigned int *)ISP0_NORFLASH_SAVE + 1), 16, 110 << 4);
|
||||
printk("isp0 read gain is %d,exp is %d \n",*((unsigned int *)ISP0_NORFLASH_SAVE + 1),*((unsigned int *)ISP0_NORFLASH_SAVE + 2));
|
||||
} else {
|
||||
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);
|
||||
printk("isp1 read gain is %d,exp is %d \n",*((unsigned int *)ISP1_NORFLASH_SAVE + 1),*((unsigned int *)ISP1_NORFLASH_SAVE + 2));
|
||||
}
|
||||
printk("<<<kajon exp = %d, gain = %d function = %s, line=%d \n file=%s \n", exp_gain.exp_val, exp_gain.gain_val,__func__,__LINE__,__FILE__);
|
||||
#endif
|
||||
sensor_s_exp_gain(id, &exp_gain);
|
||||
|
||||
sc2356_sensor_vts = 1250;
|
||||
//sensor_dbg("sc2356_sensor_vts = %d\n", sc2356_sensor_vts);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sensor_init_with_switch(int id)
|
||||
{
|
||||
unsigned int switch_choice = 0;
|
||||
unsigned int sensor_num = 0;
|
||||
int ret;
|
||||
int iic_addr;
|
||||
struct sensor_switch_cfg_t *sensor_switch_config;
|
||||
|
||||
sensor_switch_config = sensor_mipi_switch_get_cfg(id);
|
||||
if (!sensor_switch_config) {
|
||||
sensor_err("sensor_switch_config is NULL\n");
|
||||
return -1;
|
||||
}
|
||||
for (switch_choice = 0; switch_choice < 2; switch_choice++) {
|
||||
sensor_set_twi_addr(0,sensor_switch_config->i2c_addr_container[switch_choice]);
|
||||
sensor_print("Get i2c addr is 0x%x\n",sensor_switch_config->i2c_addr_container[switch_choice]);
|
||||
|
||||
ret = sensor_detect(id);
|
||||
if (ret) {
|
||||
sensor_print("chip found is not an target chip, iic_addr = 0x%x\n",
|
||||
sensor_switch_config->i2c_addr_container[switch_choice]);
|
||||
sensor_switch_config->sensor_detect_flag[switch_choice] = false;
|
||||
} else {
|
||||
sensor_print("[0:A, 1:B] detect sensor%d i2c_addr = 0x%x\n", switch_choice, sensor_switch_config->i2c_addr_container[switch_choice]);
|
||||
sensor_switch_config->sensor_detect_flag[switch_choice] = true;
|
||||
sensor_num++;
|
||||
}
|
||||
}
|
||||
sensor_print("detect sensor num : %d\n", sensor_num);
|
||||
return sensor_num;
|
||||
}
|
||||
|
||||
|
||||
static int sensor_s_stream(int id, int isp_id, int enable)
|
||||
{
|
||||
int sensor_num;
|
||||
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;
|
||||
|
||||
if (!enable)
|
||||
return 0;
|
||||
|
||||
sensor_num = sensor_init_with_switch(id);
|
||||
|
||||
if (sensor_num == 2){
|
||||
return sensor_reg_init_vc(id, isp_id);
|
||||
}
|
||||
else{
|
||||
return sensor_reg_init(id, isp_id);
|
||||
}
|
||||
}
|
||||
|
||||
static int sensor_test_i2c(int id)
|
||||
{
|
||||
int ret;
|
||||
sensor_power(id, PWR_ON);
|
||||
ret = sensor_init(id);
|
||||
sensor_power(id, PWR_OFF);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct sensor_fuc_core sc2356_core = {
|
||||
.g_mbus_config = sensor_g_mbus_config,
|
||||
.sensor_test_i2c = sensor_test_i2c,
|
||||
.sensor_power = sensor_power,
|
||||
.s_stream = sensor_s_stream,
|
||||
.s_exp_gain = sensor_s_exp_gain,
|
||||
.sensor_g_format = sensor_get_format,
|
||||
};
|
|
@ -10,6 +10,9 @@ struct sensor_cfg_array sensor_array[] = {
|
|||
#ifdef CONFIG_SENSOR_SC2355_MIPI
|
||||
{"sc2355_mipi", &sc2355_core},
|
||||
#endif
|
||||
#ifdef CONFIG_SENSOR_SC2356_MIPI
|
||||
{"sc2356_mipi", &sc2356_core},
|
||||
#endif
|
||||
#ifdef CONFIG_SENSOR_SC5336_MIPI
|
||||
{"sc5336_mipi", &sc5336_core},
|
||||
#endif
|
||||
|
|
|
@ -54,7 +54,7 @@ unsigned int vin_vipp_irq[VIN_MAX_SCALER/DEV_VIRT_NUM] = {
|
|||
struct vin_clk_info vind_default_clk[VIN_MAX_CLK] = {
|
||||
[VIN_TOP_CLK] = {
|
||||
.clock = HAL_CLK_PERIPH_CSI_TOP,
|
||||
.frequency = 340000000,
|
||||
.frequency = 300000000,
|
||||
},
|
||||
[VIN_TOP_CLK_SRC] = {
|
||||
.clock = HAL_CLK_PLL_CSIX4,
|
||||
|
@ -590,16 +590,16 @@ 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_CSIX4,
|
||||
.pin = GPIOA(12),
|
||||
.pin_func = {0x4, 0xf},
|
||||
.clk_pll = HAL_CLK_PLL_CSI,
|
||||
.pin = GPIOE(12),
|
||||
.pin_func = {0x5, 0xf},
|
||||
},
|
||||
{
|
||||
.mclk = HAL_CLK_PERIPH_CSI_MASTER1,
|
||||
.clk_24m = HAL_CLK_SRC_HOSC,
|
||||
.clk_pll = HAL_CLK_PLL_CSIX4,
|
||||
.pin = GPIOA(13),
|
||||
.pin_func = {0x4, 0xf},
|
||||
.clk_pll = HAL_CLK_PLL_CSI,
|
||||
.pin = GPIOE(13),
|
||||
.pin_func = {0x5, 0xf},
|
||||
},
|
||||
{
|
||||
.mclk = HAL_CLK_PERIPH_CSI_MASTER2,
|
||||
|
@ -721,23 +721,115 @@ struct sensor_list global_sensors[VIN_MAX_CSI] = {
|
|||
.ir_led_gpio = 0xffff,
|
||||
},
|
||||
#endif
|
||||
#if defined(CONFIG_SENSOR_SC2356_MIPI)
|
||||
#if 1
|
||||
/*mipi0 parser0*/
|
||||
[0] = {
|
||||
.used = 1,
|
||||
.sensor_name = "gc2083_mipi",
|
||||
.sensor_twi_addr = 0x6e,
|
||||
.sensor_twi_id = 0,
|
||||
.mclk_id = 0,
|
||||
.use_isp = 1,
|
||||
.id = 0,
|
||||
.addr_width = 16,
|
||||
.data_width = 8,
|
||||
.reset_gpio = GPIOF(5),
|
||||
.pwdn_gpio = GPIOE(8),
|
||||
.ir_cut_gpio[0] = GPIOF(1),/*-cut*/
|
||||
.ir_cut_gpio[1] = GPIOF(2),/*+cut*/
|
||||
.ir_led_gpio = 0xffff,
|
||||
},
|
||||
/*mipi1 parser1*/
|
||||
[1] = {
|
||||
.used = 1,
|
||||
.sensor_name = "sc2356_mipi",
|
||||
.sensor_twi_addr = 0x6c,
|
||||
.sensor_twi_id = 1,
|
||||
.mclk_id = 1,
|
||||
.use_isp = 1,
|
||||
.id = 1,
|
||||
.addr_width = 16,
|
||||
.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, //GPIOE(10)
|
||||
},
|
||||
#else
|
||||
/*mipi0 parser0*/
|
||||
[0] = {
|
||||
.used = 1,
|
||||
.sensor_name = "sc2356_mipi",
|
||||
.sensor_twi_addr = 0x6c,
|
||||
.sensor_twi_id = 1,
|
||||
.mclk_id = 1,
|
||||
.use_isp = 1,
|
||||
.id = 0,
|
||||
.addr_width = 16,
|
||||
.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, //GPIOE(10)
|
||||
},
|
||||
/*mipi1 parser1*/
|
||||
[1] = {
|
||||
.used = 1,
|
||||
.sensor_name = "gc2083_mipi",
|
||||
.sensor_twi_addr = 0x6e,
|
||||
.sensor_twi_id = 0,
|
||||
.mclk_id = 0,
|
||||
.use_isp = 1,
|
||||
.id = 1,
|
||||
.addr_width = 16,
|
||||
.data_width = 8,
|
||||
.reset_gpio = GPIOF(5),
|
||||
.pwdn_gpio = GPIOE(8),
|
||||
.ir_cut_gpio[0] = GPIOF(1),/*-cut*/
|
||||
.ir_cut_gpio[1] = GPIOF(2),/*+cut*/
|
||||
.ir_led_gpio = 0xffff,
|
||||
},
|
||||
#endif
|
||||
#endif
|
||||
#if defined(CONFIG_SENSOR_F355P_DVP)
|
||||
/*dvp*/
|
||||
[2] = {
|
||||
.used = 1,
|
||||
.sensor_name = "f355p_dvp",
|
||||
.sensor_twi_addr = 0x80,
|
||||
.sensor_twi_id = 4,
|
||||
.mclk_id = 2,
|
||||
.use_isp = 1,
|
||||
.id = 2,
|
||||
.addr_width = 8,
|
||||
.data_width = 8,
|
||||
.reset_gpio = GPIOI(4),
|
||||
.pwdn_gpio = 0xffff,
|
||||
.ir_cut_gpio[0] = 0xffff,/*-cut*/
|
||||
.ir_cut_gpio[1] = 0xffff,/*+cut*/
|
||||
.ir_led_gpio = 0xffff,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
struct vin_core global_video[VIN_MAX_VIDEO] = {
|
||||
[0] = {
|
||||
.used = 1,
|
||||
.id = 0,
|
||||
.rear_sensor = 2,
|
||||
.rear_sensor = 0,
|
||||
.front_sensor = 0,
|
||||
.csi_sel = 2,
|
||||
.mipi_sel = 0xff,
|
||||
.csi_sel = 0,
|
||||
.mipi_sel = 0,
|
||||
.isp_sel = 0,
|
||||
.tdm_rx_sel = 0,
|
||||
.isp_tx_ch = 0,
|
||||
.base = CSI_DMA0_REG_BASE,
|
||||
.irq = SUNXI_IRQ_CSIC_DMA0,
|
||||
.o_width = 512,
|
||||
.o_height = 288,
|
||||
.o_width = 1920,
|
||||
.o_height = 1080,
|
||||
//.fourcc = V4L2_PIX_FMT_LBC_2_5X,
|
||||
.fourcc = V4L2_PIX_FMT_NV12,
|
||||
.use_sensor_list = 0,
|
||||
|
@ -745,17 +837,18 @@ struct vin_core global_video[VIN_MAX_VIDEO] = {
|
|||
[1] = {
|
||||
.used = 1,
|
||||
.id = 1,
|
||||
.rear_sensor = 0,
|
||||
.front_sensor = 0,
|
||||
.csi_sel = 0,
|
||||
.mipi_sel = 0,
|
||||
.rear_sensor = 1,
|
||||
.front_sensor = 1,
|
||||
.csi_sel = 1,
|
||||
.mipi_sel = 1,
|
||||
.csi_ch = 0x10,
|
||||
.isp_sel = 1,
|
||||
.tdm_rx_sel = 1,
|
||||
.isp_tx_ch = 0,
|
||||
.base = CSI_DMA0_REG_BASE,
|
||||
.irq = SUNXI_IRQ_CSIC_DMA0,
|
||||
.o_width = 512,
|
||||
.o_height = 288,
|
||||
.o_width = 1600,
|
||||
.o_height = 1200,
|
||||
//.fourcc = V4L2_PIX_FMT_LBC_2_5X,
|
||||
.fourcc = V4L2_PIX_FMT_NV12,
|
||||
.use_sensor_list = 0,
|
||||
|
@ -764,16 +857,17 @@ struct vin_core global_video[VIN_MAX_VIDEO] = {
|
|||
.used = 1,
|
||||
.id = 2,
|
||||
.rear_sensor = 1,
|
||||
.front_sensor = 0,
|
||||
.csi_sel = 1,
|
||||
.front_sensor = 1,
|
||||
.csi_sel =1,
|
||||
.mipi_sel = 1,
|
||||
.csi_ch = 0x11,
|
||||
.isp_sel = 2,
|
||||
.tdm_rx_sel = 2,
|
||||
.isp_tx_ch = 0,
|
||||
.base = CSI_DMA0_REG_BASE,
|
||||
.irq = SUNXI_IRQ_CSIC_DMA0,
|
||||
.o_width = 512,
|
||||
.o_height = 288,
|
||||
.o_width = 1600,
|
||||
.o_height = 1200,
|
||||
//.fourcc = V4L2_PIX_FMT_LBC_2_5X,
|
||||
.fourcc = V4L2_PIX_FMT_NV12,
|
||||
.use_sensor_list = 0,
|
||||
|
|
|
@ -582,24 +582,6 @@ 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;
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -774,8 +756,16 @@ int csi_init(int argc, const char **argv)
|
|||
vin_subdev_ccu_en(i, PWR_ON);
|
||||
|
||||
vin_pipeline_set_mbus_config(i);
|
||||
for (j = 0; j < vinc->total_rx_ch; j++) {
|
||||
csic_isp_input_select(vinc->isp_sel/ISP_VIRT_NUM, vinc->isp_sel%ISP_VIRT_NUM + j, vinc->csi_sel, j);
|
||||
|
||||
if ((vinc->csi_ch != 0xff) && (vinc->csi_ch & 0x10))
|
||||
{
|
||||
csic_isp_input_select(vinc->isp_sel/ISP_VIRT_NUM, vinc->isp_sel%ISP_VIRT_NUM + 0, vinc->csi_sel, vinc->csi_ch & 0xf);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (j = 0; j < vinc->total_rx_ch; j++) {
|
||||
csic_isp_input_select(vinc->isp_sel/ISP_VIRT_NUM, vinc->isp_sel%ISP_VIRT_NUM + j, vinc->csi_sel, j);
|
||||
}
|
||||
}
|
||||
csic_vipp_input_select(vinc->vipp_sel/VIPP_VIRT_NUM, vinc->isp_sel/ISP_VIRT_NUM, vinc->isp_tx_ch);
|
||||
|
||||
|
|
|
@ -37,12 +37,12 @@
|
|||
#define VIN_PLL_CSI_RATE (2376UL*1000*1000)
|
||||
|
||||
#ifdef CONFIG_SUPPORT_THREE_CAMERA
|
||||
#define MEMRESERVE 0x421FE000
|
||||
#define MEMRESERVE_SIZE (0xe00000 - 0x3000) //0x2000 reserved for boot0 read flash and write to it
|
||||
#define MEMRESERVE 0x43210000
|
||||
#define MEMRESERVE_SIZE (0x01E00000 - 0x3000) //0x2000 reserved for boot0 read flash and write to it
|
||||
#else
|
||||
// #define MEMRESERVE 0x5f700000
|
||||
#define MEMRESERVE 0x43200000
|
||||
#define MEMRESERVE_SIZE (0xa00000 - 0x2000) //0x2000 reserved for boot0 read flash and write to it
|
||||
#define MEMRESERVE_SIZE (0x1400000 - 0x2000) //0x2000 reserved for boot0 read flash and write to it
|
||||
#endif
|
||||
extern struct rt_memheap isp_mempool;
|
||||
|
||||
|
|
|
@ -22,6 +22,19 @@
|
|||
//
|
||||
//}
|
||||
|
||||
int sensor_set_twi_addr(int id, int addr)
|
||||
{
|
||||
|
||||
global_sensors[id].sensor_twi_addr = addr;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sensor_get_twi_addr(int id)
|
||||
{
|
||||
return global_sensors[id].sensor_twi_addr;
|
||||
}
|
||||
|
||||
static int cci_read_a8_d8(int id, unsigned char addr, unsigned char *value)
|
||||
{
|
||||
unsigned char data[2];
|
||||
|
|
|
@ -25,6 +25,8 @@ struct regval_list {
|
|||
};
|
||||
|
||||
//u64 v4l2_get_timestamp(void);
|
||||
int sensor_set_twi_addr(int id, int addr);
|
||||
int sensor_get_twi_addr(int id);
|
||||
int sensor_read(int id, addr_type reg, data_type *value);
|
||||
int sensor_write(int id, addr_type reg, data_type value);
|
||||
int sensor_write_array(int id, struct regval_list *regs, int array_size);
|
||||
|
|
|
@ -68,7 +68,7 @@ struct isp_test_param gc2083_mipi_isp_test_settings = {
|
|||
.gtm_en = 1,
|
||||
.gamma_en = 1,
|
||||
.cem_en = 1,
|
||||
.encpp_en = 1,
|
||||
.encpp_en = 0,
|
||||
.enc_3dnr_en = 0,
|
||||
.enc_2dnr_en = 0
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -37,7 +37,7 @@
|
|||
#if (ISP_VERSION >= 600)
|
||||
#if defined CONFIG_SENSOR_GC2053_MIPI || defined CONFIG_SENSOR_GC4663_MIPI || defined CONFIG_SENSOR_SC5336_MIPI || \
|
||||
defined CONFIG_SENSOR_GC1084_MIPI || CONFIG_SENSOR_BF2257CS_MIPI || CONFIG_SENSOR_SC2355_MIPI || CONFIG_SENSOR_F37P_MIPI || \
|
||||
defined CONFIG_SENSOR_F355P_MIPI || CONFIG_SENSOR_OV02B10_MIPI || CONFIG_SENSOR_GC2083_MIPI
|
||||
defined CONFIG_SENSOR_F355P_MIPI || CONFIG_SENSOR_OV02B10_MIPI || CONFIG_SENSOR_GC2083_MIPI || CONFIG_SENSOR_SC2356_MIPI
|
||||
#ifdef CONFIG_SENSOR_GC4663_MIPI
|
||||
#include "SENSOR_H/gc4663_mipi_default_ini_v853.h"
|
||||
#include "SENSOR_H/gc4663_120fps_mipi_default_ini_v853.h"
|
||||
|
@ -116,6 +116,10 @@
|
|||
#include "SENSOR_H/gc2083_mipi_isp600_20240911_ir.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SENSOR_SC2356_MIPI
|
||||
#include "SENSOR_H/sc2356_mipi_isp600_20241226_141139.h"
|
||||
#endif
|
||||
|
||||
#else
|
||||
#include "SENSOR_H/gc2053_mipi_default_ini_v853.h"
|
||||
#endif
|
||||
|
@ -130,7 +134,7 @@ struct isp_cfg_array cfg_arr[] = {
|
|||
#if (ISP_VERSION >= 600)
|
||||
#if defined CONFIG_SENSOR_GC2053_MIPI || defined CONFIG_SENSOR_GC4663_MIPI || defined CONFIG_SENSOR_SC5336_MIPI || \
|
||||
defined CONFIG_SENSOR_GC1084_MIPI || CONFIG_SENSOR_BF2257CS_MIPI || CONFIG_SENSOR_SC2355_MIPI || CONFIG_SENSOR_F37P_MIPI || \
|
||||
defined CONFIG_SENSOR_F355P_MIPI || CONFIG_SENSOR_OV02B10_MIPI || CONFIG_SENSOR_GC2083_MIPI
|
||||
defined CONFIG_SENSOR_F355P_MIPI || CONFIG_SENSOR_OV02B10_MIPI || CONFIG_SENSOR_GC2083_MIPI || CONFIG_SENSOR_SC2356_MIPI
|
||||
|
||||
#ifdef CONFIG_SENSOR_GC2053_MIPI
|
||||
{"gc2053_mipi", "gc2053_mipi_isp600_20231212_111630_day", 1920, 1088, 20, 0, 0, &gc2053_mipi_v853_isp_cfg},
|
||||
|
@ -199,6 +203,11 @@ struct isp_cfg_array cfg_arr[] = {
|
|||
{"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_20241226_141139", 1600, 1200, 15, 0, 0, &sc2356_mipi_isp_cfg},
|
||||
{"sc2356_mipi", "sc2356_mipi_isp600_20241220_143956", 1600, 1200, 15, 1, 0, &sc2356_mipi_isp_cfg},
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SENSOR_GC1084_MIPI
|
||||
{"gc1084_mipi", "gc1084_mipi_v853_20230410_164555_day", 1280, 720, 15, 0, 0, &gc1084_mipi_v853_isp_cfg},
|
||||
#ifdef CONFIG_ENABLE_AIISP
|
||||
|
|
|
@ -2126,6 +2126,9 @@ static int isp_rpbuf_buffer_rx_cb(struct rpbuf_buffer *buffer,
|
|||
rpmsg_data[5] = awb_result->wb_gain_output.r_gain * 256 / awb_result->wb_gain_output.gr_gain;
|
||||
rpmsg_data[6] = awb_result->wb_gain_output.b_gain * 256 / awb_result->wb_gain_output.gb_gain;
|
||||
}
|
||||
|
||||
rpmsg_data[5] |= (hw_isp->id << 16);
|
||||
rpmsg_data[6] |= (hw_isp->id << 16);
|
||||
isp_rpmsg_ept_send(hw_isp->ept, rpmsg_data, 7*4);
|
||||
|
||||
isp_rpmsg_encpp_send(hw_isp);
|
||||
|
|
|
@ -41,6 +41,7 @@ struct vin_core {
|
|||
int sensor_sel;
|
||||
int csi_sel;
|
||||
int mipi_sel;
|
||||
int csi_ch;
|
||||
int isp_sel;
|
||||
int vipp_sel;
|
||||
int tdm_rx_sel;
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue