关于zynqmp linux ov5640摄像头

ZYNQMP 使用ov5640摄像头,调用ioct,返回错误-1;

ZYNQMP 硬件描述结构 摄像头MIPI->mipi_csi2_rx_subsyst_0->v_demosaic_0->v_gamma_lut_0->VDMA

root@xilinx-3eg:~# media-ctl -p -d /dev/media0
Media controller API version 5.4.0

Media device information
---[  392.533450] ov5640_get_fmt
---------------------
driver          xilinx-video
model           Xilinx Video Composite Device
serial
bus info
hw revision     0x0
driver version  5.4.0

Device topology
- entity 1: video_cap output 0 (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video0
        pad0: Sink
                <- "80040000.v_gamma_lut":1 [ENABLED]

- entity 5: ov5640 0-003c (1 pad, 1 link)
            type V4L2 subdev subtype Sensor flags 0
            device node name /dev/v4l-subdev0
        pad0: Source
                [fmt:JPEG_1X8/640x480@1/30 field:none colorspace:jpeg xfer:srgb ycbcr:601 quantization:full-range]
                -> "80050000.mipi_csi2_rx_subsystem":1 [ENABLED]

- entity 7: 80050000.mipi_csi2_rx_subsystem (2 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev1
        pad0: Source
                [fmt:UYVY8_1X16/1920x1080 field:none colorspace:srgb]
                -> "80060000.v_demosaic":0 [ENABLED]
        pad1: Sink
                [fmt:UYVY8_1X16/1920x1080 field:none colorspace:srgb]
                <- "ov5640 0-003c":0 [ENABLED]

- entity 10: 80060000.v_demosaic (2 pads, 2 links)
             type V4L2 subdev subtype Unknown flags 0
             device node name /dev/v4l-subdev2
        pad0: Sink
                [fmt:SRGGB8_1X8/1280x720 field:none colorspace:srgb]
                <- "80050000.mipi_csi2_rx_subsystem":0 [ENABLED]
        pad1: Source
                [fmt:RBG888_1X24/1280x720 field:none colorspace:srgb]
                -> "80040000.v_gamma_lut":0 [ENABLED]

- entity 13: 80040000.v_gamma_lut (2 pads, 2 links)
             type V4L2 subdev subtype Unknown flags 0
             device node name /dev/v4l-subdev3
        pad0: Sink
                [fmt:RBG888_1X24/1280x720 field:none colorspace:srgb]
                <- "80060000.v_demosaic":1 [ENABLED]
        pad1: Source
                [fmt:RBG888_1X24/1280x720 field:none colorspace:srgb]
                -> "video_cap output 0":0 [ENABLED]

操作

  fd = open(FILE_V4LSUBDEV,O_RDWR);
    if(fd < 0) {
        printf("Error opening\r\n");
        return -1;
    }
  struct v4l2_subdev_format fmt;

  if(-1 == ioctl(fd,VIDIOC_SUBDEV_G_FMT    , &fmt)){
    printf("VIDIOC_SUBDEV_G_FMT fail \r\n");
    close(fd);
    return -1;
  }

ioct返回-1

问题解决

struct v4l2_subdev_format fmt;
  fmt.which = 1;
  fmt.pad = 0;
```c++


```

看看摄像头是不是没有正确连接