Dear Craig,
Hi! Thanks for your advice! I could not test it until today!
As you suggested us, we looked at drivers/media/video/mxc/capture/mxc_v4l2_capture.c and we found this piece of code:
/* This may not work on other platforms. Check when adding a new one.*/
pr_debug(" clock_curr=mclk=%d\n", ifparm.u.bt656.clock_curr);
if (ifparm.u.bt656.clock_curr == 0) {
csi_param.clk_mode = IPU_CSI_CLK_MODE_CCIR656_INTERLACED;
} else {
csi_param.clk_mode = IPU_CSI_CLK_MODE_GATED_CLK;
}
csi_param.pixclk_pol = ifparm.u.bt656.latch_clk_inv;
if (ifparm.u.bt656.mode == V4L2_IF_TYPE_BT656_MODE_NOBT_8BIT) {
csi_param.data_width = IPU_CSI_DATA_WIDTH_8;
} else if (ifparm.u.bt656.mode== V4L2_IF_TYPE_BT656_MODE_NOBT_10BIT) {
csi_param.data_width = IPU_CSI_DATA_WIDTH_10;
} else {
csi_param.data_width = IPU_CSI_DATA_WIDTH_8;
}
So, we assumed that the clock setting you were talking about was ifparm.u.bt656.clock_curr .
Then, we modified our driver in order to set this value to return a 0, like this:
static int ioctl_g_ifparm(struct v4l2_int_device *s, struct v4l2_ifparm *p)
{
#ifdef DEBUG
printk("In tvp5147:ioctl_g_ifparm\n");
#endif
if (s == NULL) {
printk("<3>"" ERROR!! no slave device set!\n");
return -1;
}
/* Initialize structure to 0s then set any non-0 values. */
memset(p, 0, sizeof(*p));
p->if_type = V4L2_IF_TYPE_BT656; /* This is the only possibility.*/
p->u.bt656.mode = V4L2_IF_TYPE_BT656_MODE_BT_10BIT;
//p->u.bt656.nobt_hs_inv = 1;
p->u.bt656.bt_sync_correct = 1;
/* tvp5147 has a dedicated clock so no clock settings needed. */
p->u.bt656.clock_curr = 0;
return 0;
}
And then we also add some printk's in mxc_v4l2_capture.c :
if (ifparm.u.bt656.clock_curr == 0) {
csi_param.clk_mode = IPU_CSI_CLK_MODE_CCIR656_INTERLACED;
printk("INTERLACED!!\n");
} else {
csi_param.clk_mode = IPU_CSI_CLK_MODE_GATED_CLK;
printk("NOT INTERLACED!!\n");
}
Finally, we run the mxc_v4l2_overlay.out and mxc_v4l2_capture.out unit tests, but in both cases we saw the same results: two separated image of about 288 lines each vertically aligned (instead of one unique image of 576 lines), and in the serial console we could see the printk output "INTERLACED!!".
Any ideas?
Thanks in advance,
Lautaro
P.S.: We still have to try to capture using the csi->mem path
Craig Petku said:
To start with I am working with the 10.2 version of FSL android. However, looking at an older ltib release from 2010 it looks like ths has been out for awhile.
Look at ./drivers/mxc/ipu3/ipu_common.c. You should find something like...
if (_ipu_chan_is_interlaced(channel)) {
_ipu_ch_param_set_interlaced_scan(dma_chan);
}
In my case this handles the CSI-MEM deinterlacing.
So Where does the interlace parameter come from?...
Look at mxc_v4l_open in ./drivers/media/video/mxc/capture
Older distro's have something like
csi_param.pixclk_pol = ifparm.u.bt656.latch_clk_inv;
/* Once we handle multiple inputs this will need to change. */
csi_param.csi = 0;
if (ifparm.u.bt656.mode
== V4L2_IF_TYPE_BT656_MODE_NOBT_8BIT)
csi_param.data_width = IPU_CSI_DATA_WIDTH_8;
else if (ifparm.u.bt656.mode
== V4L2_IF_TYPE_BT656_MODE_NOBT_10BIT)
csi_param.data_width = IPU_CSI_DATA_WIDTH_10;
Newer ones include the magic parameter based upon a clock setting returned by the sensor driver. Sorry I can't post the actual code tonight, so I'll try from work tomorrow. Worst case, pull down the latest version of the linux OS and look in the mxc_capture around where I posted, then update your sensor driver to return a 0 (I think) in the parameter that results in interlaced video being identified.