imx6q: ipu camera preview faults after suspend

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

imx6q: ipu camera preview faults after suspend

1,176 Views
maximkuk
Contributor III

Hello!

I use imx6q on Sabre SD board with linux 3.14. When I run camera preview via GStreamer or v4l2 itself, after suspend/resume video freezes and "ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0" appears in console.

 

It seems that IPU resumes incorrect and CSI/IDMA channel resets on suspend and not configures again (IPU tasks are always wait for signal and do nothing).

 

What should I do to proper resume IPU? May be there are some patches or newer mxc_v4l2_capture or IPU drivers?

 

in attachement - dmesg output after suspend/resume

 

-------------------------

EDIT:

It seems that I resolve my question. The algorithm is:

- disable SCI on suspend

- restart stream on resume:

  - if ready_q is empty get back one buffer from working_q

  - if after that in ready_q only one buffer - get dummy_frame.buffer for "ping-pong"

 

I added "mxc_streamrestart" function for this purpose. You can get it from patch below. Hope, this patch will not damage anything .

Original Attachment has been moved to: dmesg.log.zip

Original Attachment has been moved to: 0001-fix-camera-preview-fault-after-system-suspend.patch.zip

Labels (4)
0 Kudos
4 Replies

371 Views
Yann31
Contributor II

Hello,

I think i have the same issue . (https://community.nxp.com/t5/i-MX-Processors/Error-on-standby-mode-due-to-gstreamer/m-p/1568373/high... 

do you figure it out how to restart stream properly after suspend ?

 

Best regards

0 Kudos

644 Views
maximkuk
Contributor III

Ok, in case when in ready_q there is only one buffer, I can do the same thing as in camera_callback: give IDMA a dummy buffer. But what if ready_q is empty?

0 Kudos

644 Views
maximkuk
Contributor III

another "internal" source of buffers is working_q. I think I can get buffer back to ready_q from working_q because dma was stopped and data in "working" buffer are useless. But what if working_q will be empty too? Is it real in suspend/resume case? Can I get buffers from cam->frame array by the driver without signalling to userspace?

0 Kudos

644 Views
maximkuk
Contributor III

It seems I found way to restart IDMA channel after suspend/resume: 

- call cam->enc_disable_csi(cam); on suspend to clear irq handlers and reset ipu->csi_use_count. It is needed to start IDMA flow on resume with standard IPU API;

- do cam->capture_on = false; before mxc_streamon(cam); on resume to start stream. Else if cam->capture_on == true, mxc_streamon do nothing.

BUT there is one problem: I haven't enough buffers in ready_q queue after resume and stream can't start because "mxc_streamon buffer need ping pong at least two buffers". 

So the question is: Where can I find one more free buffer after resume?

0 Kudos