Add IMX138_I2C and fix init scripts for Hi3516Cv100

pull/236/head
Dmitry Ermakov 2022-06-13 19:47:48 +03:00
parent 173e3f5f5b
commit d1aa19942a
5 changed files with 128 additions and 19 deletions

View File

@ -37,6 +37,7 @@ start() {
export TZ=$(cat /etc/TZ)
load_hisilicon -i
#
export SENSOR=$(fw_printenv -n sensor)
load_majestic
}

View File

@ -13,9 +13,8 @@ os_mem_size=$(fw_printenv -n osmem | tr -d 'M')
os_mem_size=${os_mem_size:=32}
# Sensor config
# SNS_TYPE=$(awk -F '=' '$1=="sensor"{print $2}' RS=" " /proc/cmdline)
SNS_TYPE=$(fw_printenv -n sensor)
SNS_TYPE=${SNS_TYPE:=ar0130}
# SENSOR=$(fw_printenv -n sensor)
# SENSOR=${SENSOR:=ar0130}
report_error() {
echo "******* Error: There's something wrong, please check! *****"
@ -28,13 +27,13 @@ insert_osal() {
insert_detect() {
cd /lib/modules/3.0.8/hisilicon
sys_config;
sys_config
insert_osal
insmod hi3518_base.ko
insmod hi3518_sys.ko
insmod hi3518_isp.ko
insmod hi_i2c.ko
SNS_TYPE=imx122 insert_sns
SENSOR=imx122 insert_sns
}
remove_detect() {
@ -71,7 +70,7 @@ remove_audio() {
}
insert_sns() {
case $SNS_TYPE in
case $SENSOR in
ar0130 | 9m034 | po3100k | bf3116 | bg0703)
devmem 0x20030030 32 0x5 #Sensor clock 27 MHz
insmod ssp_ad9020.ko
@ -89,13 +88,16 @@ insert_sns() {
devmem 0x20030030 32 0x5 #Sensor clock 27MHz
insmod ssp_pana.ko
;;
imx104 | imx122 | imx138 | imx222 | imx225 | imx322 | imx323)
imx104 | imx122 | imx123 | imx138 | imx222 | imx225 | imx322 | imx323)
devmem 0x200f000c 32 0x1 #pinmux SPI0
devmem 0x200f0010 32 0x1 #pinmux SPI0
devmem 0x200f0014 32 0x1 #pinmux SPI0
devmem 0x20030030 32 0x6 #Sensor clock 37.125 MHz
insmod ssp_sony.ko
;;
imx138_i2c)
devmem 0x20030030 32 0x6 #Sensor clock 37.125 MHz
;;
ov9712 | ov9732 | soih22 | ov2710 | jxh22 | jxh42)
devmem 0x20030030 32 0x1 #Sensor clock 24 MHz
insmod ssp_ad9020.ko
@ -115,7 +117,7 @@ insert_sns() {
devmem 0x20030030 32 0x6 #Sensor clock 37.125 MHz
;;
*)
echo "xxxx Invalid sensor type $SNS_TYPE xxxx"
echo "xxxx Invalid sensor type $SENSOR xxxx"
report_error
;;
esac
@ -318,12 +320,12 @@ insert_ko() {
insert_sns >/dev/null
insert_audio
echo "==== Your input Sensor type is $SNS_TYPE ===="
echo "==== Your input Sensor type is $SENSOR ===="
insmod wdt.ko
# system configuration
sysctl;
sysctl
}
remove_ko() {
@ -409,8 +411,8 @@ else
logger -s -p daemon.info -t hisilicon "Get data from environment and set SENSOR as ${SENSOR}"
else
insert_detect
SNS_TYPE=$(ipcinfo --short-sensor)
export SENSOR=${SNS_TYPE:=unknown}
SENSOR_DETECT=$(ipcinfo --short-sensor)
export SENSOR=${SENSOR_DETECT:=unknown}
remove_detect
logger -s -p daemon.info -t hisilicon "Get data from ipcinfo and set SENSOR as ${SENSOR}"
fw_setenv sensor $SENSOR && logger -s -p daemon.info -t hisilicon "Write detected ${SENSOR} to U-Boot ENV"
@ -419,12 +421,12 @@ fi
# load module
if [ "$SENSOR" = "unknown" ]; then
exit 1
exit 1
else
if [ "$1" = "-i" ]; then
cd /lib/modules/3.0.8/hisilicon
insert_ko
fi
if [ "$1" = "-i" ]; then
cd /lib/modules/3.0.8/hisilicon
insert_ko
fi
fi
if [ "$1" = "-r" ]; then

View File

@ -0,0 +1,106 @@
[sensor]
Sensor_type=imx138
Mode=WDR_MODE_NONE
DllFile=libsns_imx138_i2c_dc.so
[mode]
input_mode=INPUT_MODE_CMOS_33V
dev_attr=2
[mipi]
data_type=RAW_DATA_12BIT
lane_id = -1|-1|-1|-1|-1|-1|-1|-1| ;lane_id: -1 - disable
[isp_image]
Isp_x =80
Isp_y =20
Isp_W =1280
Isp_H =720
Isp_FrameRate=30
Isp_Bayer=BAYER_GBRG
[vi_dev]
Input_mod=VI_MODE_DIGITAL_CAMERA
Work_mod =0 ;VI_WORK_MODE_1Multiplex = 0
;VI_WORK_MODE_2Multiplex,
;VI_WORK_MODE_4Multiplex
Combine_mode =0 ;Y/C composite or separation mode
;VI_COMBINE_COMPOSITE = 0 /*Composite mode */
;VI_COMBINE_SEPARATE, /*Separate mode */
Comp_mode =0 ;Component mode (single-component or dual-component)
;VI_COMP_MODE_SINGLE = 0, /*single component mode */
;VI_COMP_MODE_DOUBLE = 1, /*double component mode */
Clock_edge =1 ;Clock edge mode (sampling on the rising or falling edge)
;VI_CLK_EDGE_SINGLE_UP=0, /*rising edge */
;VI_CLK_EDGE_SINGLE_DOWN, /*falling edge */
Mask_num =2 ;Component mask
Mask_0 =0xFFF00000
Mask_1 =0x0
Scan_mode = 1;VI_SCAN_INTERLACED = 0
;VI_SCAN_PROGRESSIVE,
Data_seq =2 ;data sequence (ONLY for YUV format)
;----2th component U/V sequence in bt1120
; VI_INPUT_DATA_VUVU = 0,
; VI_INPUT_DATA_UVUV,
;----input sequence for yuv
; VI_INPUT_DATA_UYVY = 0,
; VI_INPUT_DATA_VYUY,
; VI_INPUT_DATA_YUYV,
; VI_INPUT_DATA_YVYU
Vsync =1 ; vertical synchronization signal
;VI_VSYNC_FIELD = 0,
;VI_VSYNC_PULSE,
VsyncNeg=0 ;Polarity of the vertical synchronization signal
;VI_VSYNC_NEG_HIGH = 0,
;VI_VSYNC_NEG_LOW /*if VIU_VSYNC_E
Hsync =0 ;Attribute of the horizontal synchronization signal
;VI_HSYNC_VALID_SINGNAL = 0,
;VI_HSYNC_PULSE,
HsyncNeg =0 ;Polarity of the horizontal synchronization signal
;VI_HSYNC_NEG_HIGH = 0,
;VI_HSYNC_NEG_LOW
VsyncValid =1 ;Attribute of the valid vertical synchronization signal
;VI_VSYNC_NORM_PULSE = 0,
;VI_VSYNC_VALID_SINGAL,
VsyncValidNeg =0;Polarity of the valid vertical synchronization signal
;VI_VSYNC_VALID_NEG_HIGH = 0,
;VI_VSYNC_VALID_NEG_LOW
Timingblank_HsyncHfb =0 ;Horizontal front blanking width
Timingblank_HsyncAct =1280 ;Horizontal effetive width
Timingblank_HsyncHbb =0 ;Horizontal back blanking width
Timingblank_VsyncVfb =0 ;Vertical front blanking height
Timingblank_VsyncVact =720 ;Vertical effetive width
Timingblank_VsyncVbb=0 ;Vertical back blanking height
Timingblank_VsyncVbfb =0 ;Even-field vertical front blanking height(interlace, invalid progressive)
Timingblank_VsyncVbact=0 ;Even-field vertical effetive width(interlace, invalid progressive)
Timingblank_VsyncVbbb =0 ;Even-field vertical back blanking height(interlace, invalid progressive)
FixCode=0
FieldPolar=0
DataPath=1
InputDataType=1 ;VI_DATA_TYPE_YUV = 0,VI_DATA_TYPE_RGB = 1,
DataRev =FALSE ;Data reverse. FALSE = 0; TRUE = 1
DevRect_x=0
DevRect_y=0
DevRect_w=1280
DevRect_h=720
[vi_chn]
CapRect_X =0
CapRect_Y =0
CapRect_Width=1280
CapRect_Height=720
DestSize_Width=1280
DestSize_Height=720
CapSel =2 ;Frame/field select. ONLY used in interlaced mode
;VI_CAPSEL_TOP = 0, /* top field */
;VI_CAPSEL_BOTTOM, /* bottom field */
;VI_CAPSEL_BOTH, /* top and bottom field */
PixFormat =19;PIXEL_FORMAT_YUV_SEMIPLANAR_422 = 22
;PIXEL_FORMAT_YUV_SEMIPLANAR_420 = 23 ...etc
CompressMode =0 ;COMPRESS_MODE_NONE = 0
;COMPRESS_MODE_SEG =1 ...etc
SrcFrameRate=-1 ;Source frame rate. -1: not controll
FrameRate =-1 ;Target frame rate. -1: not controll

View File

@ -12,8 +12,8 @@ data_type=RAW_DATA_12BIT
lane_id = -1|-1|-1|-1|-1|-1|-1|-1| ;lane_id: -1 - disable
[isp_image]
Isp_x =0
Isp_y =0
Isp_x =80
Isp_y =20
Isp_W =1280
Isp_H =720
Isp_FrameRate=30