V4L not getting ioctl interrupts from IPU2 of IMX6Q

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

V4L not getting ioctl interrupts from IPU2 of IMX6Q

2,062 Views
nathanmak
Contributor II

I'm trying to run CSI1 data into IPU2 from an ADV7180 similar to how the sabre board runs CSI0 data into IPU1 from an ADV7180.

The problem

when I run "gst-launch -v tvsrc device=/dev/video1 ! mfw_ipucsc ! videocrop left=40 right=40 ! mfw_v4lsink " is a "ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0"

This is caused because v4l2 isn't getting ioctl interrupts as it should be.

For testing purposes I have disabled running both at the same time since I know the default ADV7180 driver can only support one.

I suspect either my pin muxing is incorrect, or I have IPU2 incorrectly configured

What works

- gst-launch -v tvsrc device=/dev/video0 ! mfw_ipucsc ! videocrop left=40 right=40 ! mfw_v4lsink  successfully outputs video

- an oscilloscope shows that data is being sent over the CSI1 lines and thus the ADV7180 initializes correctly over I2C

My current setup

Here are my relevant pin muxes

imx6q.dtsi

/{

&soc

ipu2: ipu@02800000 {

compatible = "fsl,imx6q-ipu";

reg = <0x02800000 0x400000>;

interrupts = <0 8 0x4 0 7 0x4>;

clocks = <&clks 133>, <&clks 134>, <&clks 137>,

<&clks 41>, <&clks 42>,

<&clks 135>, <&clks 136>;

clock-names = "bus", "di0", "di1",

"di0_sel", "di1_sel",

"ldb_di0", "ldb_di1";

resets = <&src 4>;

bypass_reset = <0>;

};

};

};

&iomuxc {

  ipu2 {

  pinctrl_ipu2_1: ipu2grp-1 { /* parallel camera */

  fsl,pins = <

  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_D19__IPU2_CSI1_DATA16     0x80000000

  MX6QDL_PAD_EIM_A22__IPU2_CSI1_DATA17     0x80000000

  MX6QDL_PAD_EIM_A23__IPU2_CSI1_DATA18     0x80000000

  MX6QDL_PAD_EIM_A24__IPU2_CSI1_DATA19     0x80000000

  //MX6QDL_PAD_EIM_DA10__IPU2_CSI1_DATA_EN 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

  >;

  };

  };

};

custom.dtsi

/{

#if 1

  v4l2_cap_0 {

  compatible = "fsl,imx6q-v4l2-capture";

  ipu_id = <0>;

  csi_id = <0>;

  mclk_source = <0>;

  status = "okay";

  };

#endif

#if 1

  v4l2_cap_1 {

  compatible = "fsl,imx6q-v4l2-capture";

  ipu_id = <1>;

  csi_id = <1>;

  mclk_source = <0>;

  status = "okay";

  };

#endif


#if 1

  v4l2_out {

  compatible = "fsl,mxc_v4l2_output";

  status = "okay";

  };

#endif

};

&i2c3 {

  clock-frequency = <100000>;

  pinctrl-names = "default";

  pinctrl-0 = <&pinctrl_i2c3_3>;

  status = "okay";

  #if 1 // Don't activate more than one at a time until ADV7180.c is modified

  adv7180_camera1: adv7180@21 {

  compatible = "adv,adv7180";

  reg = <0x21>; // I2C address is actually 0x42 but bitshifted

  pinctrl-names = "default";

  pinctrl-0 = <&pinctrl_ipu1_2>;

  clocks = <&clks 201>;

  clock-names = "csi_mclk";

  DOVDD-supply = <&reg_3p3v>; /* 3.3v, enabled via 2.8 VGEN6 */

  AVDD-supply = <&reg_3p3v>;  /* 1.8v */

  DVDD-supply = <&reg_3p3v>;  /* 1.8v */

  PVDD-supply = <&reg_3p3v>;  /* 1.8v */

  //pwn-gpios = <&gpio4 30 0>;

  csi_id = <0>;

  mclk = <24000000>;

  mclk_source = <0>;

  cvbs = <1>;

  };

  #endif

  #if 0 // Don't activate more than one at a time until ADV7180.c is modified

  adv7180_camera2: adv7180@20 {

  compatible = "adv,adv7180";

  reg = <0x20>; // I2C address is actually 0x40 but bitshifted

  pinctrl-names = "default";

  pinctrl-0 = <&pinctrl_ipu2_1>;

  clocks = <&clks 201>;

  clock-names = "csi_mclk";

  DOVDD-supply = <&reg_3p3v>; /* 3.3v, enabled via 2.8 VGEN6 */

  AVDD-supply = <&reg_3p3v>;  /* 1.8v */

  DVDD-supply = <&reg_3p3v>;  /* 1.8v */

  PVDD-supply = <&reg_3p3v>;  /* 1.8v */

  //pwn-gpios = <&gpio4 30 0>;

  csi_id = <1>;

  mclk = <24000000>;

  mclk_source = <0>;

  cvbs = <1>;

  };

  #endif

};

Sources that have helped me get this far

https://community.freescale.com/message/435854#435854 - I used portions of Omar's patch to set up CSI0 and CSI1 where by default freescale refers only to CSI0.

0 Kudos
1 Reply

556 Views
nathanmak
Contributor II

For what it's worth, this is the output of the above gstreamer command for video1. It includes some custom debug messages I used to verify that the v4l devices are correctly  attaching master and slave. One weird bit that I don't understand is Mxc Camera comes up once as sensor is null but then finds the adv7180 after.

output of gst-launch -v tvsrc device=/dev/video1 ! mfw_ipucsc ! videocrop left=40 right=40 ! mfw_v4lsink

MFW_GST_tvsrc_PLUGIN 3.0.9 build on Sep  5 2014 14:41:24.

IPU_CSC_CORE_LIBRARY_VERSION_INFOR_01.00.

MFW_GST_IPU_CSC_PLUGIN 3.0.9 build on Sep  5 2014 14:42:37.

[  108.392779]

[  108.392779] In MVC: mxc_v4l_open

[  108.397502]    device name is Mxc Camera

[  108.401469] mxc_v4l_open    device name=Mxc Camera type=0

[  108.406874] mxc_v4l_open    sensor is null

[  108.411094] mxc_v4l_open ERROR: v4l2 capture: slave not found!

[  108.417059]

[  108.417059] In MVC: mxc_v4l_open

[  108.421799]    device name is Mxc Camera

[  108.425730] mxc_v4l_open    device name=Mxc Camera type=1

[  108.431183] mxc_v4l_open    sensor name is adv7180

[  108.435982] ioctl_g_ifparm

[  108.438706] ioctl_g_ifparm complete

[  108.442217] ioctl_g_fmt_cap complete

[  108.445819] ioctl_g_fmt_cap complete

[  108.449419] End of mxc_v4l_open: v2f pix widthxheight 288 x 352

[  108.455347] End of mxc_v4l_open: crop_bounds widthxheight 720 x 625

[  108.461645] End of mxc_v4l_open: crop_defrect widthxheight 720 x 625

[  108.468004] End of mxc_v4l_open: crop_current widthxheight 720 x 625

[  108.474373] On Open: Input to ipu size is 720 x 625

[  108.479280] ipu_csi_init_interface

[  108.482722] ipu_csi_init_interface complete

[  108.486918] ioctl_s_power

[  108.899425] ioctl_s_power complete

[  108.902844] ioctl_init

[  108.905236] ioctl_dev_init

[  108.907970] mxc_v4l_open complete

[  108.911356] In MVC:mxc_v4l_ioctl

[  108.914609] In MVC: mxc_v4l_do_ioctl 80685600

[  108.918977]    case VIDIOC_QUERYCAP

[  108.922525] In MVC:mxc_v4l_close

[  108.925774] ioctl_s_power

[  108.928902] ioctl_s_power complete

[  108.932357] mxc_v4l_close: release resource

[  108.936565] MVC: In mxc_free_frame_buf

[  108.940390] In MVC:mxc_free_frames

MFW_GST_V4LSINK_PLUGIN 3.0.9 build on Sep  5 2014 14:40:39.

Setting pipeline to PAUSED ...[  108.977869]

[  108.977869] In MVC: mxc_v4l_open

[  108.983185]    device name is Mxc Camera

[  108.987266] mxc_v4l_open    device name=Mxc Camera type=1

[  108.992686] mxc_v4l_open    sensor name is adv7180

[  108.997482] ioctl_g_ifparm

[  109.000219] ioctl_g_ifparm complete

[  109.003708] ioctl_g_fmt_cap complete

[  109.007296] ioctl_g_fmt_cap complete

[  109.010923] End of mxc_v4l_open: v2f pix widthxheight 288 x 352

[  109.016856] End of mxc_v4l_open: crop_bounds widthxheight 720 x 625

[  109.023149] End of mxc_v4l_open: crop_defrect widthxheight 720 x 625

[  109.029521] End of mxc_v4l_open: crop_current widthxheight 720 x 625

[  109.035876] On Open: Input to ipu size is 720 x 625

[  109.040784] ipu_csi_init_interface

[  109.044207] ipu_csi_init_interface complete

[  109.048499] ioctl_s_power

[  109.459413] ioctl_s_power complete

[  109.462837] ioctl_init

[  109.465231] ioctl_dev_init

[  109.467966] mxc_v4l_open complete

[  109.471349] In MVC:mxc_v4l_ioctl

[  109.474604] In MVC: mxc_v4l_do_ioctl c02c5651

sensor chip is adv7180_decoder[  109.479151] In MVC:mxc_v4l_ioctl

[  109.484990] In MVC: mxc_v4l_do_ioctl 80085617

[  109.489521]    case VIDIOC_G_STD

[  109.492773] In mxc_v4l2_g_std

[  109.495750] ioctl_g_fmt_cap complete

[  109.499355] adv7180_get_std

[  109.502236] adv7180_read

[  109.505418] adv7180_read complete val = 13 reg = 0x10

[  109.510519] adv7180_get_std complete

[  109.514118] ioctl_g_fmt_cap complete

[  109.517702] MVC: mxc_v4l2_g_std: Changing standard

[  109.522547] In mxc_v4l2_s_std b000

[  109.525969]    Setting standard to NTSC b000

[  109.530300] In MVC:mxc_v4l_ioctl

[  109.533551] In MVC: mxc_v4l_do_ioctl 40085618

[  109.537917]    case VIDIOC_S_STD

[  109.541185] In mxc_v4l2_s_std b000

[  109.544609]    Setting standard to NTSC b000

should set the input to 1[  109.549017] In MVC:mxc_v4l_ioctl

[  109.554437] In MVC: mxc_v4l_do_ioctl c0045627

[  109.558929]    case VIDIOC_S_INPUT

[  109.562409] In MVC:mxc_streamoff

[  109.565846] In MVC:mxc_v4l_ioctl

[  109.569107] In MVC: mxc_v4l_do_ioctl c0cc5616

[  109.573526]    case VIDIOC_S_PARM

[  109.576861] In mxc_v4l2_s_param

[  109.580051] ioctl_g_parm

[  109.582725] ioctl_g_parm complete

[  109.586050]    Current capabilities are 0

[  109.590106]    Current capturemode is 0  change to 0

[  109.595096]    Current framerate is 30  change to 1

[  109.600010] ioctl_s_parm

[  109.602576] ioctl_s_parm complete

[  109.605898] ioctl_g_ifparm

[  109.608631] ioctl_g_ifparm complete

[  109.612157]    clock_curr=mclk=0

[  109.615397] ioctl_g_fmt_cap complete

[  109.619012] ioctl_g_fmt_cap complete

[  109.622632]    g_fmt_cap returns widthxheight of input as 720 x 525

[  109.628946] ipu_csi_init_interface

[  109.632453] ipu_csi_init_interface complete

[  109.636687] In MVC:mxc_v4l_ioctl

[  109.639983] In MVC: mxc_v4l_do_ioctl c0cc5605

[  109.644359]    case VIDIOC_S_FMT

[  109.647595] In MVC: mxc_v4l2_s_fmt

[  109.651036]    type=V4L2_BUF_TYPE_VIDEO_CAPTURE

[  109.655586] End of mxc_v4l2_s_fmt: v2f pix widthxheight 720 x 480

[  109.661719] End of mxc_v4l2_s_fmt: crop_bounds widthxheight 720 x 525

[  109.668184] End of mxc_v4l2_s_fmt: crop_defrect widthxheight 720 x 625

[  109.674747] End of mxc_v4l2_s_fmt: crop_current widthxheight 720 x 480

[  109.681360] In MVC:mxc_v4l_ioctl

[  109.684609] In MVC: mxc_v4l_do_ioctl c0cc5604

[  109.688979]    case VIDIOC_G_FMT

[  109.692231] In MVC: mxc_v4l2_g_fmt type=1

[  109.696246]    type is V4L2_BUF_TYPE_VIDEO_CAPTURE

[  109.701055] End of mxc_v4l2_g_fmt: v2f pix widthxheight 720 x 480

[  109.707154] End of mxc_v4l2_g_fmt: crop_bounds widthxheight 720 x 525

[  109.713608] End of mxc_v4l2_g_fmt: crop_defrect widthxheight 720 x 625

[  109.720154] End of mxc_v4l2_g_fmt: crop_current widthxheight 720 x 480

[  109.726684] In MVC:mxc_v4l_ioctl

[  109.729935] In MVC: mxc_v4l_do_ioctl c0145608

[  109.734296]    case VIDIOC_REQBUFS

[  109.737698] In MVC:mxc_streamoff

[  109.740945] MVC: In mxc_free_frame_buf

[  109.744700] In MVC:mxc_allocate_frame_buf - size=518400

[  109.769137] In MVC:mxc_v4l_ioctl

[  109.772404] In MVC: mxc_v4l_do_ioctl c0cc5604

[  109.776763]    case VIDIOC_G_FMT

[  109.780005] In MVC: mxc_v4l2_g_fmt type=1

[  109.784021]    type is V4L2_BUF_TYPE_VIDEO_CAPTURE

[  109.788814] End of mxc_v4l2_g_fmt: v2f pix widthxheight 720 x 480

[  109.794921] End of mxc_v4l2_g_fmt: crop_bounds widthxheight 720 x 525

[  109.801385] End of mxc_v4l2_g_fmt: crop_defrect widthxheight 720 x 625

[  109.807913] End of mxc_v4l2_g_fmt: crop_current widthxheight 720 x 480

[  109.814549] In MVC:mxc_v4l_ioctl

[  109.817798] In MVC: mxc_v4l_do_ioctl c0445609

[  109.822287]    case VIDIOC_QUERYBUF

[  109.825783] In MVC:mxc_v4l2_buffer_status

[  109.829832] In MVC:mxc_mmap

[  109.832633]    pgoff=0x44780, start=0x766a7000, end=0x76726000

[  109.839007] In MVC:mxc_v4l_ioctl

[  109.842261] In MVC: mxc_v4l_do_ioctl c044560f

[  109.846628]    case VIDIOC_QBUF

[  109.849796] In MVC:mxc_v4l_ioctl

[  109.853029] In MVC: mxc_v4l_do_ioctl c0445609

[  109.857399]    case VIDIOC_QUERYBUF

[  109.860908] In MVC:mxc_v4l2_buffer_status

[  109.864928] In MVC:mxc_mmap

[  109.867724]    pgoff=0x44800, start=0x76628000, end=0x766a7000

[  109.874040] In MVC:mxc_v4l_ioctl

[  109.877271] In MVC: mxc_v4l_do_ioctl c044560f

[  109.881647]    case VIDIOC_QBUF

[  109.884814] In MVC:mxc_v4l_ioctl

[  109.888045] In MVC: mxc_v4l_do_ioctl c0445609

[  109.892421]    case VIDIOC_QUERYBUF

[  109.895914] In MVC:mxc_v4l2_buffer_status

[  109.899941] In MVC:mxc_mmap

[  109.902740]    pgoff=0x44880, start=0x765a9000, end=0x76628000

[  109.909031] In MVC:mxc_v4l_ioctl

[  109.912276] In MVC: mxc_v4l_do_ioctl c044560f

[  109.916638]    case VIDIOC_QBUF

[  109.919803] In MVC:mxc_v4l_ioctl

[  109.923034] In MVC: mxc_v4l_do_ioctl c0445609

[  109.927391]    case VIDIOC_QUERYBUF

[  109.930897] In MVC:mxc_v4l2_buffer_status

[  109.934916] In MVC:mxc_mmap

[  109.937712]    pgoff=0x44900, start=0x7652a000, end=0x765a9000

[  109.944036] In MVC:mxc_v4l_ioctl

[  109.947267] In MVC: mxc_v4l_do_ioctl c044560f

[  109.951637]    case VIDIOC_QBUF

[  109.954788] In MVC:mxc_v4l_ioctl

[  109.958018] In MVC: mxc_v4l_do_ioctl c0445609

[  109.962386]    case VIDIOC_QUERYBUF

[  109.965876] In MVC:mxc_v4l2_buffer_status

[  109.969902] In MVC:mxc_mmap

[  109.972701]    pgoff=0x44980, start=0x764ab000, end=0x7652a000

[  109.978983] In MVC:mxc_v4l_ioctl

[  109.982225] In MVC: mxc_v4l_do_ioctl c044560f

[  109.986586]    case VIDIOC_QBUF

[  109.989750] In MVC:mxc_v4l_ioctl

[  109.992981] In MVC: mxc_v4l_do_ioctl c0445609

[  109.997337]    case VIDIOC_QUERYBUF

[  110.000838] In MVC:mxc_v4l2_buffer_status

[  110.004854] In MVC:mxc_mmap

[  110.007649]    pgoff=0x44a00, start=0x7642c000, end=0x764ab000

[  110.013936] In MVC:mxc_v4l_ioctl

[  110.017168] In MVC: mxc_v4l_do_ioctl c044560f

[  110.021543]    case VIDIOC_QBUF

[  110.024703] In MVC:mxc_v4l_ioctl

[  110.027933] In MVC: mxc_v4l_do_ioctl 40045612

[  110.032310]    case VIDIOC_STREAMON

[  110.035802] In MVC:mxc_streamon

[  110.038943] IPU:In csi_enc_enabling_tasks

[  110.045883] csi_enc_setup

[  110.048509] In csi_enc_setup

[  110.051415]  sensor                  name=adv7180 type=2

[  110.055518]  self                    name=mxc_v4l2_cap1 type=1

[  110.059975]  all_sensors[0]  name=adv7180 type=2

[  110.064625] csi_enc_setup leaving complete

/GstPipeline:pipeline0/MFWGstTVSRC:mfwgsttvsrc0.GstPad:src: caps [  110.076028] In MVC:mxc_v4l_ioctl

= video/x-raw-yuv, framerate=(fra[  110.081189] In MVC: mxc_v4l_do_ioctl c0445611

ction)30/1, format=(fourcc)NV12, [  110.088377]    case VIDIOC_DQBUF

width=(int)720, height=(int)480, [  110.094483] In MVC:mxc_v4l_dqueue

pixel-aspect-ratio=(fraction)1/1

Pipeline is live and does not need PREROLL ...

Setting pipeline to PLAYING ...

New clock: GstSystemClock

[  120.099442] ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0

ERROR: from element /GstPipeline:pipeline0/MFWGstTVSRC:mfwgsttvsrc0: Internal data flow error.

Additional debug info:

/data/cat2700/build/var-som-mx6-dora-v5/build_mx6q/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/gstreamer/0.10.36-r2/gstreamer-0.10.36/libs/gst/base/gstbasesrc.c(2625): gst_base_src_loop (): /GstPipeline:pipeline0/MFWGstTVSRC:mfwgsttvsrc0:

streaming task paused, reason error (-5)

Execution ended after 10031074668 ns.

Setting pipeline to PAUSED ...

Setting pipeline to READY ...

[  120.320870] In MVC:mxc_v4l_ioctl

[  120.324108] In MVC: mxc_v4l_do_ioctl 40045613

[  120.328465]    case VIDIOC_STREAMOFF

[  120.332091] In MVC:mxc_streamoff

[  120.829637] In MVC:mxc_free_frames

[  120.833387] In MVC:mxc_v4l_close

[  120.836633] In MVC:mxc_streamoff

[  120.839918] ioctl_s_power

[  120.843078] ioctl_s_power complete

[  120.846499] mxc_v4l_close: release resource

[  120.850742] MVC: In mxc_free_frame_buf

[  120.855589] In MVC:mxc_free_frames

/GstPipeline:pipeline0/MFWGstTVSRC:mfwgsttvsrc0.GstPad:src: caps = NULL

Setting pipeline to NULL ...

Total rendered:0

Freeing pipeline ...

[--->FINALIZE v4l_sink

0 Kudos