AnsweredAssumed Answered

BT1120 1080p capture on imx6q ipu1-CSI1 in linux4.1

Question asked by JIFFY HE on May 21, 2018
Latest reply on May 29, 2018 by JIFFY HE

Hi,

 

I'm using an i.mx6q sabrelite with a kernel  4.1.15

There is a BT1120 1080P  SDR video form FPGA  connected on IPU1-CSI1 (parallel mode),

the video souce of FPGA is gs2971. The connect as follows  GS2971<------>FPGA<----->imx6q .

 FPGA  configure GS2971 output BT1120 1080P  SDR 16bit ,and the frequence of pclk is 74.25MHz. 

the pin mapping between imx6q and FPGA  is CSIx_DAT2 ~ CSIx_DAT9 <----> C[0] ~ C[7], CSIx_DAT12 ~ CSIx_DAT19 <----> Y[0] ~ Y[7].  according to "《IMX6DQCEC.PDF》 table 66  YCBCR7 16BIT "  and The SAV and EAV  are embedded. 

the HS, VS,DATAEN, PCLK has been connected to imx6q.

i created a driver, and communicate to V4l2 driver ,and the following steps has been done.

 

1、arch/arm/mach-imx/mach-imx6q.c

to enbale IPU1-CSI1 and IPU0-CSI0

 

regmap_update_bits(gpr, IOMUXC_GPR1, 3 << 19, 3 << 19);  

 

2、 arch/arm/boot/dts/imx6qdl-sabresd.dtsi 

set pinmux:

 

pinctrl_ipu2_2: ipu2grp-2 { /* ipu2 parallel camera */
fsl,pins = <
MX6QDL_PAD_EIM_DA9__IPU2_CSI1_DATA00 0x10000
MX6QDL_PAD_EIM_DA8__IPU2_CSI1_DATA01 0x10000
MX6QDL_PAD_EIM_DA7__IPU2_CSI1_DATA02 0xb0b1
MX6QDL_PAD_EIM_DA6__IPU2_CSI1_DATA03 0xb0b1
MX6QDL_PAD_EIM_DA5__IPU2_CSI1_DATA04 0xb0b1
MX6QDL_PAD_EIM_DA4__IPU2_CSI1_DATA05 0xb0b1
MX6QDL_PAD_EIM_DA3__IPU2_CSI1_DATA06 0xb0b1
MX6QDL_PAD_EIM_DA2__IPU2_CSI1_DATA07 0xb0b1
MX6QDL_PAD_EIM_DA1__IPU2_CSI1_DATA08 0xb0b1
MX6QDL_PAD_EIM_DA0__IPU2_CSI1_DATA09 0xb0b1
MX6QDL_PAD_EIM_EB1__IPU2_CSI1_DATA10 0x10000
MX6QDL_PAD_EIM_EB0__IPU2_CSI1_DATA11 0x10000
MX6QDL_PAD_EIM_A17__IPU2_CSI1_DATA12 0xb0b1
MX6QDL_PAD_EIM_A18__IPU2_CSI1_DATA13 0xb0b1
MX6QDL_PAD_EIM_A19__IPU2_CSI1_DATA14 0xb0b1
MX6QDL_PAD_EIM_A20__IPU2_CSI1_DATA15 0xb0b1
MX6QDL_PAD_EIM_A21__IPU2_CSI1_DATA16 0xb0b1
MX6QDL_PAD_EIM_A22__IPU2_CSI1_DATA17 0xb0b1
MX6QDL_PAD_EIM_A23__IPU2_CSI1_DATA18 0xb0b1
MX6QDL_PAD_EIM_A24__IPU2_CSI1_DATA19 0xb0b1
MX6QDL_PAD_EIM_DA10__IPU2_CSI1_DATA_EN 0xb0b1
MX6QDL_PAD_EIM_DA11__IPU2_CSI1_HSYNC 0x10000
MX6QDL_PAD_EIM_DA12__IPU2_CSI1_VSYNC 0x10000
MX6QDL_PAD_EIM_A16__IPU2_CSI1_PIXCLK 0xb0b1
>;
};

 

set driver :

 

gs2971: gs2971@5c {
compatible = "gs2971";
reg = <0x5c>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ipu2_2>;
clocks = <&clks IMX6QDL_CLK_CKO>;
clock-names = "csi_mclk";
csi_id = <1>;
mclk = <77856768>;
mclk_source = <0>;
cvbs = <1>;
};

 

v4l2_cap_1 {
compatible = "fsl,imx6q-v4l2-capture";
ipu_id = <1>;
csi_id = <1>;
mclk_source = <0>;
status = "ok";
};

 

3、add the slave driver 

add file  "drivers/media/platform/mxc/capture/gs2971.c" and modify kconfig and Makefile

 

4、modify ipu driver for Support BT1120 progressive mode

 

drivers/mxc/ipu3/ipu_capture.c

drivers/media/platform/mxc/capture/v4l2-int-device.h

drivers/media/platform/mxc/capture/mxc_v4l2_capture.c

 has been changed .

 

5、use mxc_v4l2_capture.out to test

 

./mxc_v4l2_capture.out -iw 1920 -ih 1080 -ow 1920 -oh 1080 -d /dev/video1 -r 1 -c 2  -f YUYV -fr 30 frame.yuv

out_width = 1920, out_height = 1080
top = 0, left = 0
sensor chip is gs2971_decoder
sensor supported frame size:
720x576
Width = 1920 Height = 1080 Image size = 4147200
pixelformat: YUYV
imx-ipuv3 2800000.ipu: IC output size(1080) cannot exceed 1024
imx-ipuv3 2800000.ipu: failed to calculate prpenc height scaling coefficients
ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0
VIDIOC_DQBUF failed.
buf.index 0
ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0
VIDIOC_DQBUF failed.
buf.index 0

 

/dev/video0  for IPU0-CSI0  (PAL video  720x576 )  and video0 can capture image

 

dump ipu1-csi1 some register

 

CSI_SENS_CONF 0xa50

CSI_SENS_FRM_SIZE 0x437077f

CSI_ACT_FRM_SIZE 0x437077f

CSI_OUT_FRM_CTRL 0x0

 

what else can I do for this issue?  Any help appreciated

 

reference from:

BT1120 1080P connect to imx6q 

Support BT1120 progressive mode in Mx6Q 

Patch to support adv7180 TVin chip for Freescale Android R10.4 BSP on iMX53 -blog archive 

BT.1120 capture on i.mx6q CSI1 using linux 

https://community.nxp.com/thread/311765#348083 

i.MX6 CSI-interface and .BT1120 

Outcomes