How to add a v4l2 capture device? (3.10.31 I Driver)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to add a v4l2 capture device? (3.10.31 I Driver)

8,854 Views
repoman
Contributor III

I have been working on adding  a device driver for video capture to the 310.31 kernel for a custom Board.  I have written the driver and all compiles fine. I even can insmod  the drive at run-time and have it show up under v4l2-int-device in the lsmod list along with mxc_v4l2_capture.  however, it does not appear that the new driver is registering as a slave v4l2-int-device to the freescale mxc_v4l2_capture device. How should I ensure it registers correctly?

I have looked at the sources for the ov5640 and ov5642 drivers and do not clearly see any files which link the master device to the slave which makes me believe it is a run-time connection. Or is it something that is needed to specify in the device tree?

Also, does Freescale plan to migrate the CSI capture features to the new V4L2 subdev device framework?

Message was edited by: John Reep Grammatical editing on 02/12/2015

Labels (4)
6 Replies

582 Views
evankahn
Contributor II

repoman

Hi,

I am experiencing your original issue when setting up the ov5647 with a MIPI serial interface on an i.MX6 development board.

Adding additional device information reveals that the v4l_int_device struct attaches as a master rather than a slave, leading to the driver complaining of "no slave found". I'm using ipu0/csi1 on an i.MX6 single-chip module.

Would you mind sharing how you ultimately solved this problem? I know it's been a while.

Thanks very much!

0 Kudos

582 Views
shrinidhirao
Contributor II

I have the same problem. Do let me know how to fix it

0 Kudos

582 Views
krisztianbakos
Contributor II

Hello John,

Do you have any idea how you got your original problem solved? I just have the same problem with my custom MIPI sensor, where it does not see any slave device so I can't get it to bind to any /dev/video device.

In my case the sensor is not controllable, it has no I2C bus, it just outputs the signals to MIPI whenever powered, so I should be able to see some picture "instantly".

This is a MIPI-CSI2 sensor and I "ported" the ov5640_camera_mipi driver because it seems quite similar.

Thank you very much in advance!

Best Regards,

Krisztian

582 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi,

"I have looked at the sources for the ov5640 and ov5642 drivers and do not clearly see any files which link the master device to the slave which makes me believe it is a run-time connection" Do you refer to the i2c master-slave connection?

I wonder if you can share more details.

Best Regards,

Alejandro

582 Views
repoman
Contributor III

Alejandro,

  Thanks for the reply.  I really meant the connection between the ov5640 to the mxc_v4l2_capture driver.

In the mxc_v4l2_capture.c file, the file is setup to provide a V4L2_int_device Master and it setups up the initialization.  The ov5640.c file sets up an I2C slave device because it does not include the macros for module_init and module_clean.  Whereas, the ov5642 driver and the ov5640_mipi driver source files do include the module_init/clean macros to produce a device driver.  Also, both of these driver sets are setup to provide a v4l2_int_device slave device.

The driver I have written follows the ov5640/ov5642 which is why I asked about them.  I have tried my driver both ways and it will load into the kernel at run time.  However, I never can tell how to have the mxc_v4l2_capture Master device found my slave device.  Even if I do:

:$ modprobe mxc_v4l2_capture

:$ modprobe ov5640_camera

The mxc_v4l2_capture just reports "Error: No slave found"  and then I can't test the V4L2 capture.  I have since posting this added support for the IPU2 CSI1 camera configuration as well from the patches and references found on the forum.  The piece that I seem to be missing is how does the mxc_v4l2_capture driver know what device it can use as slave device drivers?  I believe this to be a run-time action but am uncertain as to what I have missed.  I would like to test the camera capture capabilities as well as finish developing my specific device driver for the video capture device I am developing with.  As another note, I have referenced up to the latest GA release of 3.10.53 and I have not moved yet from 3.10.31.  However, the files are the same between the two and so I do not believe the version of the kernel to be the issue.

When I lsmod, I see an entry for v4l2_int_device and it will have both the mxc_v4l2_capture and the ov5640 (or other depending on which to use) but I can never test with the unit test/mxc_v4l2_capture.out references.  If I try the mxc_v4l2_capture.out then the error that gets reported is "/dev/video0 cannot be open or is unavailable".

Any thoughts would be greatly appreciated,

John

As a clarificiation:

  My device driver as well as the ov5640 or ov5642 device drivers produce an I2C device.  The I2C subsystem is active and I can even use the Linux utilities for i2cdetect, i2cset, i2cget to communicate with the respective devices on the i2c system.  I do not believe this to be the issue and these drivers attach to the i2c system correctly and can be seen correctly in the /sys tree.

0 Kudos

582 Views
repoman
Contributor III

Alejandro,

  I have moved past my current issue.  I can get the devices to attach.  I wanted to use the IPU2 CSI1 as well as the IPU1 CSI 0 parallel ports.  It appears that some work has been done by the community.

My next question that I am hoping you may answer:

Is it possible to use IPU2_CSI1_DATA15 to DATA00 instead of DATA19 to DATA04?  From the manual, this appears to be possible but I am uncertain as to which sets of code need to be modified.  I.e: Can I just specify in the device tree:

  pinctrl_ipu2_2: ipu2grp-2 { /* 8-Bit parallel camera */

  fsl,pins = <

  MX6QDL_PAD_EIM_DA1__IPU2_CSI1_DATA08 0x80000000

  MX6QDL_PAD_EIM_DA0__IPU2_CSI1_DATA09 0x80000000

  MX6QDL_PAD_EIM_EB1__IPU2_CSI1_DATA10 0x80000000

  MX6QDL_PAD_EIM_EB0__IPU2_CSI1_DATA11 0x80000000

  MX6QDL_PAD_EIM_A17__IPU2_CSI1_DATA12 0x80000000

  MX6QDL_PAD_EIM_A18__IPU2_CSI1_DATA13 0x80000000

  MX6QDL_PAD_EIM_A19__IPU2_CSI1_DATA14 0x80000000

  MX6QDL_PAD_EIM_A20__IPU2_CSI1_DATA15 0x80000000

  MX6QDL_PAD_EIM_A16__IPU2_CSI1_PIXCLK 0x80000000

  MX6QDL_PAD_EIM_DA11__IPU2_CSI1_HSYNC   0x80000000

  MX6QDL_PAD_EIM_DA12__IPU2_CSI1_VSYNC 0x80000000

  MX6QDL_PAD_EIM_DA10__IPU2_CSI1_DATA_EN 0x80000000

  >;

  };

Or is there more that needs to be done in order to ensure that the offset occurs as to where MSB of the IPU2/CSI1 parallel data starts? 

R,
John

0 Kudos