Hello,
im working on a custom board with a mx6dl and a tw9910 video decoder as a tvin source.
It looks like the tw9910 has a lot in common with the adv7180 so i used that driver as a starting point.
I removed the i2c communication from that driver and initialize the tw9910 from userspace.
The tw9910 is decoding the video fine and we verified that it sends the data with a pixelclock of 27Mhz to the CSI0 of the imx.
Hsync and Vsync are provided.
adv7180: adv7180@21 { | |
compatible = "adv,adv7180"; | |
reg = <0x21>; | |
pinctrl-names = "default"; | |
pinctrl-0 = <&pinctrl_ipu1_4>; | |
clocks = <&clks 201>; | |
clock-names = "csi_mclk"; | |
DOVDD-supply = <®_3p3v>; /* 3.3v, enabled via 2.8 VGEN6 */ | |
AVDD-supply = <®_3p3v>; /* 1.8v */ | |
DVDD-supply = <®_3p3v>; /* 1.8v */ | |
PVDD-supply = <®_3p3v>; /* 1.8v */ | |
pwn-gpios = <&gpio1 6 0>; | |
csi_id = <0>; | |
mclk = <27000000>; | |
mclk_source = <0>; | |
cvbs = <1>; | |
};
v4l2_cap_1 { | |
compatible = "fsl,imx6q-v4l2-capture"; | |
ipu_id = <0>; | |
csi_id = <0>; | |
mclk_source = <0>; | |
status = "okay"; |
};
pinctrl_ipu1_4: ipu1grp-4 { | ||||
fsl,pins = < | ||||
MX6QDL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12 | 0x80000000 | |||
MX6QDL_PAD_CSI0_DAT13__IPU1_CSI0_DATA13 | 0x80000000 | |||
MX6QDL_PAD_CSI0_DAT14__IPU1_CSI0_DATA14 | 0x80000000 | |||
MX6QDL_PAD_CSI0_DAT15__IPU1_CSI0_DATA15 | 0x80000000 | |||
MX6QDL_PAD_CSI0_DAT16__IPU1_CSI0_DATA16 | 0x80000000 | |||
MX6QDL_PAD_CSI0_DAT17__IPU1_CSI0_DATA17 | 0x80000000 | |||
MX6QDL_PAD_CSI0_DAT18__IPU1_CSI0_DATA18 | 0x80000000 | |||
MX6QDL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19 | 0x80000000 | |||
MX6QDL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK 0x80000000 | ||||
MX6QDL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC | 0x80000000 | |||
MX6QDL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC | 0x80000000 |
//Data Enable has to be pulled HIGH! | |||
MX6QDL_PAD_CSI0_DATA_EN__IPU1_CSI0_DATA_EN 0x80000000 | |||
>; | |||
}; |
The CSI0_DATA_EN pin should be pulled high but isn't connected on the board.
So i assume that through the default configuration it is pulled high by the imx.
I also assume that the IPU1 correlates to the ipu_id = <0> and the csi to csi_id = <0>. Is that correct?
The video0 device is showing up but reading from it resolves in an error:
In MVC: mxc_v4l_open
device name is Mxc Camera
End of mxc_v4l_open: v2f pix widthxheight 720 x 576
End of mxc_v4l_open: crop_bounds widthxheight 720 x 625
End of mxc_v4l_open: crop_defrect widthxheight 720 x 625
End of mxc_v4l_open: crop_current widthxheight 720 x 625
On Open: Input to ipu size is 720 x 625
Inside ipu_csi_init_interface with pixel_fmt=1498831189
Inside ipu_csi_init_interface: Selected CSI_SENS_CONF_DATA_FMT_YUV422_UYVY
imx-ipuv3 2400000.ipu: CSI_SENS_CONF = 0x00000A02
imx-ipuv3 2400000.ipu: CSI_ACT_FRM_SIZE = 0x027002CF
In MVC:mxc_v4l_ioctl
In MVC: mxc_v4l_do_ioctl 80685600
case VIDIOC_QUERYCAP
cap.capabilities= 5000005In MVC:mxc_v4l_ioctl
In MVC: mxc_v4l_do_ioctl c02c563a
case VIDIOC_CROPCAP
In MVC:mxc_v4l_ioctl
In MVC: mxc_v4l_do_ioctl 4014563c
case VIDIOC_S_CROP
Cropping Input to ipu size 720 x 625
In MVC:mxc_v4l_ioctl
In MVC: mxc_v4l_do_ioctl c0cc5605
case VIDIOC_S_FMT
In MVC: mxc_v4l2_s_fmt
type=V4L2_BUF_TYPE_VIDEO_CAPTURE
End of mxc_v4l2_s_fmt: v2f pix widthxheight 720 x 576
End of mxc_v4l2_s_fmt: crop_bounds widthxheight 720 x 625
End of mxc_v4l2_s_fmt: crop_defrect widthxheight 720 x 625
End of mxc_v4l2_s_fmt: crop_current widthxheight 720 x 625
In MVC:mxc_poll
frameRead
ERROR: v4l2 capture: mxc_v4l_read timeout counter 0
imx-ipuv3 2400000.ipu: CSI stop timeout - 5 * 10ms
read error 62, Timer expiredIn MVC:mxc_v4l_close
mxc_v4l_close: release resource
MVC: In mxc_free_frame_buf
In MVC:mxc_free_frames
I tried to change different parameters for the csi capture like: csi_param.Vsync_pol, csi_param.Hsync_pol, csi_param.data_en_pol but i still get no csi_irq_handler interrupt.
Do you have any suggestions where i could look next or what i'm doing wrong?
Thanks for you answers!
Hi Lars
You should try to use an exisiting driver, you could follow next link:
linux/tw9910.c at master · spotify/linux · GitHub
Best regards.
Jaime
Hi Jaime,
thank you for your reply.
I'm using parts of that driver to initialize the tw9910 (but from the userspace at the moment).
I don't want to use the whole driver as it is, because it is not compatible to the device-tree.
From the adv7180 driver i removed every i2c communication.
But i think i found one problem:
I need to set the IOMUX_GPR13 regs because my board isn't specified as compatible to fsl,imx6dl-sabresd / fsl,imx6dl-sabreauto:
regmap_update_bits(gpr, IOMUXC_GPR13, 0x07, 0x04);
Now it seems like the IPU is at least receiving something:
imx-ipuv3 2400000.ipu: IPU Warning - IPU_INT_STAT_5 = 0x00000001
New Frame before end-of-frame error indication of Channel interrupt. This bit is the status bit of New Frame before end-of-frame error interrupt of Channel 0.
Now i'm unsure how to fix that problem. The parameters im variating are:
in probe:
sensor_data.pix.priv = 1; /* 1 is used to indicate TV in */
in ioctl_g_ifparm:
p->u.bt656.bt_sync_correct = 1; // 0
p->u.bt656.clock_curr = 27000000; // 0=IPU_CSI_CLK_MODE_CCIR656_INTERLACED, !=0=IPU_CSI_CLK_MODE_GATED_CLK
And then i'm using the tw9910 config from the tw9910 driver or the config that is specified by the datasheet for ITU-R BT.656 compatibility (which doesn't seem to match!).
But in these 16 combinations non of them gave me a full image capture.
Additionally from the userspace i'm automatically variating stuff like vsync/hsync polarity.
From the "Data Sheet: Technical Data: i.MX 6Dual/6QuadAutomotive and Infotainment Applications Processors" Figure 65 i think the hsync is not really an hsync-pulse but corresponds to the hactive from the tw9910 which i also tried. Is that correct?
Best regards.
Lars