imx8qxp parallel-csi tw9912(4.14.62 AndroidP)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx8qxp parallel-csi tw9912(4.14.62 AndroidP)

1,831 Views
jiujinhong
Contributor IV

Hi,

we use tw9912 in imx8qxp with parallel-csi, tw9912(yuv422) reg config is from imx6d which works fine. but camera preview data is not correct. there are not  detail parallel-csi reg explantation in reference manual. can you do some help? 

tw9912: tw9912@44 {
compatible = "ovti,tw9912";
reg = <0x44>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_parallel_csi>;
clocks = <&clk IMX8QXP_PARALLEL_CSI_MISC0_CLK>;
clock-names = "csi_mclk";
/*ldo-gpios = <&gpio3 2 0>;*/
rst-gpios = <&gpio3 3 1>;
csi_id = <0>;
mclk = <24000000>;
mclk_source = <0>;
status = "okay";
port {
tw9912_ep: endpoint {
remote-endpoint = <&parallel_csi_ep>;
};
};
};

&cameradev {
parallel_csi;
status = "okay";
};

&parallel_csi {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
port@0 {
reg = <0>;
parallel_csi_ep: endpoint {
remote-endpoint = <&tw9912_ep>;
};
};
};

&isi_0 { │

interface = <6 0 2>; /* INPUT: 6-PARALLEL CSI */ 
parallel_csi;
status = "okay"; 
};

pastedImage_2.png

run log:

[ 147.477963] tw9912 8-0044: tw9912:ioctl_enum_frameintervals
[ 147.484567] tw9912 8-0044: tw9912:ioctl_enum_framesizes
[ 147.490501] tw9912 8-0044: In tw9912:ioctl_s_parm
[ 147.495372] mxc-isi 58100000.isi: mxc_isi_cap_s_fmt_mplane, fmt=0x56595559
[ 147.502600] mxc-isi 58100000.isi: num_planes = 1
[ 147.507433] mxc-isi 58100000.isi: bpl = 0, sizeimage = 0
[ 147.513051] mxc-isi 58100000.isi: sizeimage = 691200
[ 147.518396] tw9912 8-0044: ioctl_g_fmt_cap code=0x2008, w/h=(720,480), colorspace=7, field=1
[ 147.527143] mxc-parallel-csi 58261000.pcsi: width=720, height=480, fmt.code=0x2008
[ 147.542839] bypass csc
[ 147.545284] input fmt RGB4
[ 147.548584] output fmt YUYV
[ 148.278537] mxc-parallel-csi 58261000.pcsi: mxc_pcsi_s_stream: 442, pcsidev: 0x1
[ 148.286705] tw9912 8-0044: ioctl_g_fmt_cap code=0x2008, w/h=(720,480), colorspace=7, field=1
[ 148.295350] mxc-parallel-csi 58261000.pcsi: width=720, height=480, fmt.code=0x2008
[ 148.314522] mxc-parallel-csi 58261000.pcsi: HW_IF_CTRL_REG = 0x00001003
[ 148.321171] mxc-parallel-csi 58261000.pcsi: HW_CSI_CTRL_REG = 0x1ad04805
[ 148.328597] mxc-parallel-csi 58261000.pcsi: HW_CSI_STATUS = 0x00000000
[ 148.335816] mxc-parallel-csi 58261000.pcsi: HW_CSI_CTRL_REG1 = 0x05a002cf

console:/ #
console:/ #
console:/ #
console:/ # dmesg | grep tw9912
[ 4.918491] tw9912 8-0044: tw9912_probe sensor_clk = 0
[ 4.923678] tw9912 8-0044: tw9912_probe:tw9912 probe i2c address is 0x44
[ 4.930901] tw9912 8-0044: tw9912_probe:Analog Device TW9912 detected!
[ 4.937487] mx8-img-md: Registered sensor subdevice: tw9912 8-0044 (1)
[ 4.957514] mx8-img-md: created link [tw9912 8-0044] => [mxc-parallel-csi]
[ 5.004876] tw9912 8-0044: tw9912_probe camera tw9912, is found
[ 13.251612] tw9912 8-0044: tw9912:ioctl_enum_framesizes
[ 13.318726] tw9912 8-0044: tw9912:ioctl_enum_frameintervals
[ 13.376363] tw9912 8-0044: tw9912:ioctl_enum_frameintervals
[ 13.438577] tw9912 8-0044: tw9912:ioctl_enum_framesizes
[ 13.560456] tw9912 8-0044: tw9912:ioctl_enum_framesizes
[ 13.638747] tw9912 8-0044: tw9912:ioctl_enum_frameintervals
[ 13.694569] tw9912 8-0044: tw9912:ioctl_enum_frameintervals
[ 13.814599] tw9912 8-0044: tw9912:ioctl_enum_framesizes
[ 147.477963] tw9912 8-0044: tw9912:ioctl_enum_frameintervals
[ 147.484567] tw9912 8-0044: tw9912:ioctl_enum_framesizes
[ 147.490501] tw9912 8-0044: In tw9912:ioctl_s_parm
[ 147.518396] tw9912 8-0044: ioctl_g_fmt_cap code=0x2008, w/h=(720,480), colorspace=7, field=1
[ 148.286705] tw9912 8-0044: ioctl_g_fmt_cap code=0x2008, w/h=(720,480), colorspace=7, field=1
console:/ #
console:/ #
console:/ #
console:/ #
console:/ #

Tags (1)
0 Kudos
Reply
5 Replies

1,436 Views
igorpadykov
NXP Employee
NXP Employee

Hi jiu

Ov5640 parallel CSI camera is supported by default, the dts is fsl-imx8qxp-mek-ov5640.dts.
One can refer to the driver to customize parallel CSI camera.
If the captured image flicker serious, or the data value is all 0, one can check the clock polarity
of custom camera and modify the polarity control bits in register CSI_CTRL_REG.
For supported format one can check and configure DATA_TYPE_IN.

fsl-imx8qxp-mek-ov5640.dts\freescale\dts\boot\arm64\arch - linux-imx - i.MX Linux kernel 

mx8_v4l2_cap_drm.c\mxc_v4l2_test\test - imx-test - i.MX Driver Test Application Software 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,436 Views
jiujinhong
Contributor IV

Hi Igor,

The TW9912 is a low power NTSC/PAL/SECAM video decoder chip that also supports analog
component video as its input. The video decoder decodes the base-band analog CVBS or S-video
signals into digital 8-bit 4:2:2 YCbCr format. The analog component video is digitized into 8-bit YCbCr
format. On the digital output, it supports the standard BT.656 format for interlaced video. It can also
output progressive BT.656 format in the case of progressive component input or by converting the
interlaced video into progressive format.

Question:

even if hardware connect HS/VS to CSI_HSYNC/CSI_VSYNC, it shouldn't use for BT.656, right?

why parallel csi driver need to config VSYNC_RESET_EN/EXT_VSYNC_EN? 

else if (pcsidev->mode & CCIR_MODE) {
val |= (CSI_CTRL_REG_CCIR_EN |
CSI_CTRL_REG_CCIR_VSYNC_RESET_EN |
CSI_CTRL_REG_CCIR_EXT_VSYNC_EN |
CSI_CTRL_REG_CCIR_ECC_ERR_CORRECT_EN);
}

0 Kudos
Reply

1,436 Views
jiujinhong
Contributor IV

Hi Igor,

if set CSI_CTRL_REG_UV_SWAP_EN, the camera works fine, otherwise  it drops some color.  tw9912 spec told that it support Ycbcr(4:2:2) output and tw9912 driver register with YUYV. Why? it seems that SOC support YVYU only?

0 Kudos
Reply

1,436 Views
jiujinhong
Contributor IV

Hi Igor,

the camera working fine after force pcsidev->uv_swap. one question need to help from you.

tw9912 output format is  BT656 YUV422 and  Parallel Capture interface is hooked to the Imaging subsystem via the Pixel Link.  mxc_pcsi_csr_config below PL data type to DATA_TYPE_OUT_YUV444, 

question is , which one convert YUV444 to YUV422? bypass mode don't need any convert?

/* Config PL Data Type */
val = IF_CTRL_REG_DATA_TYPE(DATA_TYPE_OUT_YUV444);
writel(val, pcsidev->csr_regs + IF_CTRL_REG_SET);

/* Config CTRL REG */
val = readl(pcsidev->csr_regs + CSI_CTRL_REG);
val |= (
CSI_CTRL_REG_DATA_TYPE_IN(DATA_TYPE_IN_UYVY_BT656_8BITS) |
CSI_CTRL_REG_HSYNC_POL |
CSI_CTRL_REG_MASK_VSYNC_COUNTER(3) |
CSI_CTRL_REG_HSYNC_PULSE(2));

0 Kudos
Reply

1,436 Views
jiujinhong
Contributor IV

it works fine now.  tw9912 need to set pcsidev->mode  CCIR_MODE, data type need to set  DATA_TYPE_IN_UYVY_BT656_8BITS

0 Kudos
Reply