AnsweredAssumed Answered

dma_alloc_coherent error for mipi csi2 camera

Question asked by srinivasaporam on Jan 7, 2016
Latest reply on Feb 2, 2016 by Yuri Muhin

Hi,

We have got imx6Q customized board designed based on reference board (Wandboard).

 

Custom board is having 512 MB RAM (LPDDR2) where as reference board has got 2GB DDR3 RAM.

 

We have connected MIPI CSI2 interface and when we are running the following command:

 

$ sudo avconv -f video4linux2 -s 640x480 -i /dev/video0 -ss 0:0:2 -frames 1 /tmp/out.jpg

 

we are getting the following error:

 

ERROR: v4l2 capture: VIDIOC_REQBUFS: not enough buffers                   
ERROR: v4l2 capture: mxc_allocate_frame_buf failed. 

 

When i searched for the same in my kernel source got the place where this error will be coming

 

/drivers/media/platform/mxc/capture/mxc_v4l2_capture.c

 

static int mxc_allocate_frame_buf(cam_data *cam, int count)

{

    int i;

 

    pr_debug("In MVC:mxc_allocate_frame_buf - size=%d\n",

        cam->v2f.fmt.pix.sizeimage);

 

    for (i = 0; i < count; i++) {

        cam->frame[i].vaddress =

            dma_alloc_coherent(0,

                       PAGE_ALIGN(cam->v2f.fmt.pix.sizeimage),

                       &cam->frame[i].paddress,

                       GFP_DMA | GFP_KERNEL);

        if (cam->frame[i].vaddress == 0) {

            pr_err("ERROR: v4l2 capture: "

                "mxc_allocate_frame_buf failed.\n");

            mxc_free_frame_buf(cam);

            return -ENOBUFS;

        }

        cam->frame[i].buffer.index = i;

        cam->frame[i].buffer.flags = V4L2_BUF_FLAG_MAPPED;

        cam->frame[i].buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;

        cam->frame[i].buffer.length =

            PAGE_ALIGN(cam->v2f.fmt.pix.sizeimage);

        cam->frame[i].buffer.memory = V4L2_MEMORY_MMAP;

        cam->frame[i].buffer.m.offset = cam->frame[i].paddress;

        cam->frame[i].index = i;

    }

 

    return 0;

}

 

 

so, why dma_alloc_coherent is returning 0 which is being assigned to  cam->frame[i].vaddress.

 

How to resolve this issue???

Outcomes